MixNRMI2cens {BNPdensity} | R Documentation |
Normalized Random Measures Mixture of Type II for censored data
Description
Bayesian nonparametric estimation based on normalized measures driven mixtures for locations and scales.
Usage
MixNRMI2cens(
xleft,
xright,
probs = c(0.025, 0.5, 0.975),
Alpha = 1,
Kappa = 0,
Gama = 0.4,
distr.k = "normal",
distr.py0 = "normal",
distr.pz0 = "gamma",
mu.pz0 = 3,
sigma.pz0 = sqrt(10),
delta_S = 4,
kappa = 2,
delta_U = 2,
Meps = 0.01,
Nx = 150,
Nit = 1500,
Pbi = 0.1,
epsilon = NULL,
printtime = TRUE,
extras = TRUE,
adaptive = FALSE
)
Arguments
xleft |
Numeric vector. Lower limit of interval censoring. For exact data the same as xright |
xright |
Numeric vector. Upper limit of interval censoring. For exact data the same as xleft. |
probs |
Numeric vector. Desired quantiles of the density estimates. |
Alpha |
Numeric constant. Total mass of the centering measure. See details. |
Kappa |
Numeric positive constant. See details. |
Gama |
Numeric constant. |
distr.k |
The distribution name for the kernel. Allowed names are "normal", "gamma", "beta", "double exponential", "lognormal" or their common abbreviations "norm", "exp", or an integer number identifying the mixture kernel: 1 = Normal; 2 = Gamma; 3 = Beta; 4 = Double Exponential; 5 = Lognormal. |
distr.py0 |
The distribution name for the centering measure for locations. Allowed names are "normal", "gamma", "beta", or their common abbreviations "norm", "exp", or an integer number identifying the centering measure for locations: 1 = Normal; 2 = Gamma; 3 = Beta. |
distr.pz0 |
The distribution name for the centering measure for scales. Allowed names are "gamma", "lognormal", "half-Cauchy", "half-normal", "half-student", "uniform" and "truncated normal", or their common abbreviations "norm", "exp", "lnorm", "halfcauchy", "halfnorm", "halft" and "unif", or an integer number identifying the centering measure for scales: 2 = Gamma, 5 = Lognormal, 6 = Half Cauchy, 7 = Half Normal, 8 = Half Student-t, 9 = Uniform, 10 = Truncated Normal. |
mu.pz0 |
Numeric constant. Prior mean of the centering measure for scales. |
sigma.pz0 |
Numeric constant. Prior standard deviation of the centering measure for scales. |
delta_S |
Numeric positive constant. Metropolis-Hastings proposal variation coefficient for sampling the scales. |
kappa |
Numeric positive constant. Metropolis-Hastings proposal variation coefficient for sampling the location parameters. |
delta_U |
Numeric positive constant. Metropolis-Hastings proposal variation coefficient for sampling the latent U. If 'adaptive=TRUE', 'delta_U'is the starting value for the adaptation. |
Meps |
Numeric constant. Relative error of the jump sizes in the continuous component of the process. Smaller values imply larger number of jumps. |
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 |
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, sigmas, weights and Js. |
adaptive |
Logical. If TRUE, uses an adaptive MCMC strategy to sample the latent U (adaptive delta_U). |
Details
This generic function fits a normalized random measure (NRMI) mixture model for density estimation (James et al. 2009). Specifically, the model assumes a normalized generalized gamma (NGG) prior for both, locations (means) and standard deviations, of the mixture kernel, leading to a fully nonparametric mixture model.
The details of the model are:
X_i|Y_i,Z_i \sim
k(\cdot|Y_i,Z_i)
(Y_i,Z_i)|P \sim P,
i=1,\dots,n
P \sim
\textrm{NGG}(\texttt{Alpha, Kappa, Gama; P\_0})
where, X_i
's are the observed data, (Y_i,Z_i)
's are
bivariate latent (location and scale) vectors, k
is a parametric
kernel parameterized in terms of mean and standard deviation, (Alpha,
Kappa, Gama; P_0)
are the parameters of the NGG prior with a bivariate
P_0
being the centering measure with independent components, that is,
P_0(Y,Z) = P_0(Y)*P_0(Z)
. The parameters of P_0(Y)
are assigned
vague hyper prior distributions and (mu.pz0,sigma.pz0)
are the
hyper-parameters of P_0(Z)
. In particular, NGG(Alpha, 1, 0;
P_0)
defines a Dirichlet process; NGG(1, Kappa, 1/2;P_0)
defines a
Normalized inverse Gaussian process; and NGG(1, 0, Gama; P_0)
defines
a normalized stable process. The evaluation grid ranges from min(x) -
epsilon
to max(x) + epsilon
. By default epsilon=sd(x)/4
.
Value
The function returns a list with the following components:
xx |
Numeric vector. Evaluation grid. |
qx |
Numeric array. Matrix
of dimension |
cpo |
Numeric vector of |
R |
Numeric vector of
|
U |
Numeric vector of |
Allocs |
List of
|
means |
List of |
sigmas |
Numeric vector of
|
weights |
List of |
Js |
List of
|
Nm |
Integer constant. Number of jumps of the continuous component of the unnormalized process. |
delta_Us |
List of
|
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 |
procTime |
Numeric
vector with execution time provided by |
distr.k |
Integer corresponding to the kernel chosen for the mixture |
data |
Data used for the fit |
NRMI_params |
A named list with the parameters of the NRMI process |
Warning
The function is computing intensive. Be patient.
Author(s)
Barrios, E., Kon Kam King, G. and Nieto-Barajas, L.E.
References
1.- Barrios, E., Lijoi, A., Nieto-Barajas, L. E. and Prünster, I. (2013). Modeling with Normalized Random Measure Mixture Models. Statistical Science. Vol. 28, No. 3, 313-334.
2.- James, L.F., Lijoi, A. and Prünster, I. (2009). Posterior analysis for normalized random measure with independent increments. Scand. J. Statist 36, 76-97.
3.- Kon Kam King, G., Arbel, J. and Prünster, I. (2016). Species Sensitivity Distribution revisited: a Bayesian nonparametric approach. In preparation.
See Also
MixNRMI2
, MixNRMI1cens
,
MixNRMI2cens
, multMixNRMI1
Examples
## Not run:
### Example 1
# Data
data(acidity)
x <- acidity
# Fitting the model under default specifications
out <- MixNRMI2cens(x, x)
# Plotting density estimate + 95% credible interval
plot(out)
## End(Not run)
## Not run:
### Example 2
# Data
data(salinity)
# Fitting the model under special specifications
out <- MixNRMI2cens(
xleft = salinity$left, xright = salinity$right, Nit = 5000, distr.pz0 = 10,
mu.pz0 = 1, sigma.pz0 = 2
)
# Plotting density estimate + 95% credible interval
attach(out)
plot(out)
# Plotting number of clusters
par(mfrow = c(2, 1))
plot(R, type = "l", main = "Trace of R")
hist(R, breaks = min(R - 0.5):max(R + 0.5), probability = TRUE)
detach()
## End(Not run)