BNPdens {BNPmix}R Documentation

BNPdens class constructor

Description

A constructor for the BNPdens class. The class BNPdens is a named list containing the output generated by a specified Bayesian nonparametric mixture model implemented by means of a specified MCMC strategy, as in PYdensity, DDPdensity, and PYregression.

Usage

BNPdens(
  density = NULL,
  data = NULL,
  grideval = NULL,
  grid_x = NULL,
  grid_y = NULL,
  clust = NULL,
  mean = NULL,
  beta = NULL,
  sigma2 = NULL,
  probs = NULL,
  niter = NULL,
  nburn = NULL,
  tot_time = NULL,
  univariate = TRUE,
  regression = FALSE,
  dep = FALSE,
  group_log = NULL,
  group = NULL,
  wvals = NULL
)

Arguments

density

a matrix containing the values taken by the density at the grid points;

data

a dataset;

grideval

a set of values where to evaluate the density;

grid_x

regression grid, independent variable;

grid_y

regression grid, dependent variable;

clust

a (niter - nburn) \times nrow(data)-dimensional matrix containing the cluster labels for each observation (cols) and MCMC iteration (rows);

mean

values for the location parameters;

beta

coefficients for regression model (only for PYregression);

sigma2

values of the scale parameters;

probs

values for the mixture weights;

niter

number of MCMC iterations;

nburn

number of MCMC iterations to discard as burn-in;

tot_time

total execution time;

univariate

logical, TRUE if the model is univariate;

regression

logical, TRUE for the output of PYregression;

dep

logical, TRUE for the output of DDPdensity;

group_log

group allocation for each iteration (only for DDPdensity);

group

vector, allocation of observations to strata (only for DDPdensity);

wvals

values of the processes weights (only for DDPdensity).

Examples

data_toy <- c(rnorm(100, -3, 1), rnorm(100, 3, 1))
grid <- seq(-7, 7, length.out = 50)
est_model <- PYdensity(y = data_toy, mcmc = list(niter = 100,
                      nburn = 10, nupd = 100), output = list(grid = grid))
str(est_model)
class(est_model)

[Package BNPmix version 1.0.2 Index]