MixPY2 {BNPdensity} | R Documentation |
Pitman-Yor process mixture of Type II
Description
This function calls the PYdensity function from package BNPmix, to allow fitting a Pitman-Yor process mixture to the data.
Usage
MixPY2(
x,
probs = c(0.025, 0.5, 0.975),
Alpha = 1,
Gama = 0.4,
asigma = 2,
bsigma = 1/var(x),
Nx = 100,
Nit = 1500,
Pbi = 0.5,
epsilon = NULL,
printtime = TRUE,
extras = TRUE
)
Arguments
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. |
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 |
Value
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 |
R |
Numeric vector of
|
Allocs |
List of |
means |
List of |
sigmas |
List of |
weights |
List of
|
Nit |
Integer constant. Number of MCMC iterations. |
Pbi |
Numeric constant. Burn-in period proportion of |
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
# Data
data(acidity)
x <- acidity
# Fitting the model under default specifications
out <- MixPY2(x)
# Plotting density estimate + 95% credible interval
plot(out)