bsad {bsamGP} | R Documentation |
Bayesian Semiparametric Density Estimation
Description
This function fits a semiparametric model, which consists of parametric and nonparametric components, for estimating density using a logistic Gaussian process.
Usage
bsad(x, xmin, xmax, nint, MaxNCos, mcmc = list(), prior = list(),
smoother = c('geometric', 'algebraic'),
parametric = c('none', 'normal', 'gamma', 'laplace'), marginal.likelihood = TRUE,
verbose = FALSE)
Arguments
x |
a vector giving the data from which the density estimate is to be computed. |
xmin |
minimum value of x. |
xmax |
maximum value of x. |
nint |
number of grid points for plots (need to be odd). The default is 201. |
MaxNCos |
maximum number of Fourier coefficients. |
mcmc |
a list giving the MCMC parameters.
The list includes the following integers (with default values in parentheses):
|
prior |
a list giving the prior information. The list includes the following parameters
(default values specify the non-informative prior):
|
smoother |
types of smoothing priors for Fourier coefficients. See Details. |
parametric |
specifying a distribution of the parametric part to be test. |
marginal.likelihood |
a logical variable indicating whether the log marginal likelihood is calculated. |
verbose |
a logical variable. If |
Details
This generic function fits a semiparametric model, which consists of parametric and nonparametric, for density estimation (Lenk, 2003):
where is a zero mean, second-order Gaussian process with bounded, continuous covariance function. i.e.,
Using the Karhunen-Loeve Expansion, is represented as infinite series with random coefficients
where is the cosine basis,
.
For the random Fourier coefficients of the expansion, two smoother priors are assumed (optional),
The coefficient have the popular normal prior,
To complete the model specification, independent hyper priors are assumed,
Note that the posterior algorithm is based on computing a discrete version of the likelihood over a fine mesh on .
Value
An object of class bsad
representing the Bayesian spectral analysis density estimation model fit.
Generic functions such as print
, fitted
and plot
have methods to show the results of the fit.
The MCMC samples of the parameters in the model are stored in the list mcmc.draws
,
the posterior samples of the fitted values are stored in the list fit.draws
, and
the MCMC samples for the log marginal likelihood are saved in the list loglik.draws
.
The output list also includes the following objects:
post.est |
posterior estimates for all parameters in the model. |
lmarg |
log marginal likelihood. |
ProbProbs |
posterior probability of models. |
call |
the matched call. |
mcmctime |
running time of Markov chain from |
References
Jo, S., Choi, T., Park, B. and Lenk, P. (2019). bsamGP: An R Package for Bayesian Spectral Analysis Models Using Gaussian Process Priors. Journal of Statistical Software, 90, 310-320.
Lenk, P. (2003) Bayesian semiparametric density estimation and model verification using a logistic Gaussian process. Journal of Computational and Graphical Statistics, 12, 548-565.
Examples
## Not run:
############################
# Old Faithful geyser data #
############################
data(faithful)
attach(faithful)
# mcmc parameters
mcmc <- list(nblow = 10000,
smcmc = 1000,
nskip = 10,
ndisp = 1000,
kappaloop = 5)
# fits BSAD model
fout <- bsad(x = eruptions, xmin = 0, xmax = 8, nint = 501, mcmc = mcmc,
smoother = 'geometric', parametric = 'gamma')
# Summary
print(fout); summary(fout)
# fitted values
fit <- fitted(fout)
# predictive density plot
plot(fit, ask = TRUE)
detach(faithful)
## End(Not run)