x: Numeric vector. Data set to which the density is fitted.
probs: Numeric vector. Desired quantiles of the density estimates.
Alpha: Numeric constant. Total mass of the centering measure. See
Gama: Numeric constant. c("0<=Gama<=\n", "1"). See details.
asigma: Numeric positive constant. Shape parameter of the gamma prior on the standard deviation of the mixture kernel. Default value suggested by package BNPmix.
bsigma: Numeric positive constant. Rate parameter of the gamma prior on the standard deviation of the mixture kernel. Default value suggested by package BNPmix.
Nx: Integer constant. Number of grid points for the evaluation of the density estimate.
Nit: Integer constant. Number of MCMC iterations.
Pbi: Numeric constant. Burn-in period proportion of Nit.
epsilon: Numeric constant. Extension to the evaluation grid range. See details.
printtime: Logical. If TRUE, prints out the execution time.
extras: Logical. If TRUE, gives additional objects: means and weights
Returns
The function returns a MixPY2 object. It is based on a list with the following components: - xx: Numeric vector. Evaluation grid.
qx: Numeric array. Matrix of dimension c("Nxx\n", "(length(probs)+1)") with the posterior mean and the desired quantiles input in probs.
R: Numeric vector of length(Nit*(1-Pbi)) with the number of mixtures components (clusters).
Allocs: List of length(Nit*(1-Pbi)) with the clustering allocations.
means: List of length(Nit*(1-Pbi)) with the cluster means (locations). Only if extras = TRUE.
sigmas: List of length(Nit*(1-Pbi)) with the cluster standard deviations (scales). Only if extras = TRUE.
weights: List of length(Nit*(1-Pbi)) with the mixture weights. Only if extras = TRUE.
Nit: Integer constant. Number of MCMC iterations.
Pbi: Numeric constant. Burn-in period proportion of Nit.
distr.k: Integer corresponding to the kernel chosen for the mixture. Always 1, since the Pitman-Yor process is only written to work with Gaussian kernels.
data: Data used for the fit
PY_params: A named list with the parameters of the Pitman-Yor process
Examples
# Datadata(acidity)x <- acidity
# Fitting the model under default specificationsout <- MixPY2(x)# Plotting density estimate + 95% credible intervalplot(out)