Running examples in ‘bsamGP-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: bsad
> ### Title: Bayesian Semiparametric Density Estimation
> ### Aliases: bsad
> ### Keywords: logistic Gaussian process density estimation
> 
> ### ** Examples
> 
> ## Don't show: 
> set.seed(1)
> x <- rgamma(50,2,1)
> 
> # mcmc parameters
> mcmc <- list(nblow = 100,
+              smcmc = 100,
+              nskip = 1,
+              ndisp = 100,
+              kappaloop = 1)
> 
> # fits BSAD model
> fout <- bsad(x = x, xmin = 0, xmax = 10, nint = 501, mcmc = mcmc,
+             smoother = 'geometric', parametric = 'gamma')
> 
> # Summary
> print(fout); summary(fout)

Call:
bsad(x = x, xmin = 0, xmax = 10, nint = 501, mcmc = mcmc, smoother = "geometric", 
    parametric = "gamma")

Bayesian Spectral Analysis Density Estimation (BSAD) 
- Density Estimation using Log-Gaussian Process - 

Model:
f(x) = exp[Z(x)] /int exp[Z(s)] ds 

1. Discretize problem 
f = exp(Y_i)/(sum exp(Y_j) delta) 
2. Uses Slice Sampling to generate Y 
3. Use semiparametric regression model for Y 
Y = D*beta + Phi*Z*theta + epsilon with Z = 0 or 1 
4. [epsilon] = N(0,sigma^2I) 

Priors: 
theta_k|sigma 	~ N(0,tau^2*exp(-gamma*c_k) 

Smoothing parameters tau and gamma 
tau2 ~ IG(r0/2, s0/2) 
gamma ~ IG(u0/2, v0/2) 

Choice of two possible parametrizations of c_k 
Geometric: c_k = k 


Number of observations   = 50
Estimation Interval: min = 0 and max = 10
Number of intervals      = 501
Number of cosine terms   = 48

Number of transition iterations           = 200
Number of iterations for analysis         = 100
Number of loops between generating kappa  = 1
Number of loops between saved interations = 1
Total number of MCMC iterations           = 400

Posterior Probabilities of Parametric vs Semi-parametric with kappa 
       Para    SemiPara 
0.004543838 0.995456162 

Ln Marginal Distribution of the Data 
     Para      Semi    SemiMK 
-68.67082 -68.73977 -68.33424 

----- 
Parametric Model : 'gamma' 
Regression Coefficients 
           PostMean        STD      2.5%       50%     97.5%
ln(X-Min)  1.333800 0.17624453  1.068400  1.325967  1.667199
X-Min     -1.182333 0.09324521 -1.400259 -1.155268 -1.068092

----- 
Semiparametric Model: Estimation of Kappa 
Regression Coefficients 
            PostMean        STD       2.5%        50%      97.5%
ln(X-Min)  0.6562794 0.30721786  0.1858384  0.6787672  1.1440997
X-Min     -0.6706206 0.09888722 -0.8384908 -0.6663551 -0.4740348

Model Order kappa 
PostMean      STD     2.5%      50%    97.5% 
 27.8900  11.6869   8.0000  28.0000  46.5250 

Smoothing Parameter tau 
 PostMean       STD      2.5%       50%     97.5% 
1.5696539 0.6624122 0.7430063 1.4014055 3.3097261 

Smoothing parameter gamma 
 PostMean       STD      2.5%       50%     97.5% 
1.2816438 0.1325692 1.0725820 1.2912863 1.5485224 

----- 
Semiparametric Model: Kappa = Max # of theta 
Regression Coefficients 
           PostMean       STD      2.5%       50%     97.5%
ln(X-Min)  1.544381 0.2019641  1.228195  1.513767  1.935106
X-Min     -1.381439 0.1072458 -1.561379 -1.387153 -1.211778

Smoothing Parameter tau using Max Kappa 
 PostMean       STD      2.5%       50%     97.5% 
1.2726455 0.3677660 0.7008631 1.2162024 2.0314829 

Smoothing parameter gamma using Max Kappa 
 PostMean       STD      2.5%       50%     97.5% 
0.8076847 0.1046503 0.5862814 0.7962062 1.0152737 

> 
> # fitted values
> fit <- fitted(fout, HPD = FALSE)
> 
> # predictive density plot
> plot(fit, ask = FALSE)
Error in grid.Call.graphics(C_setviewport, vp, TRUE) : 
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
Calls: <Anonymous> ... push.vp.vpTree -> push.vp -> push.vp.viewport -> grid.Call.graphics
Execution halted