NMixPredDensMarg: Marginal (univariate) predictive density

View source: R/NMixPredDensMarg.R

NMixPredDensMargR Documentation

Marginal (univariate) predictive density

Description

This function serves as an inference tool for the MCMC output obtained using the function NMixMCMC. It computes estimated posterior predictive densities for each margin.

Usage

NMixPredDensMarg(x, ...)

## Default S3 method:
NMixPredDensMarg(x, scale, K, w, mu, Li, Krandom=TRUE, ...)

## S3 method for class 'NMixMCMC'
NMixPredDensMarg(x, grid, lgrid=500, scaled=FALSE, ...)

## S3 method for class 'GLMM_MCMC'
NMixPredDensMarg(x, grid, lgrid=500, scaled=FALSE, ...)

Arguments

x

an object of class NMixMCMC for NMixPredDensMarg.NMixMCMC function.

An object of class GLMM_MCMC for NMixPredDensMarg.GLMM_MCMC function.

A list with the grid values (see below) for NMixPredDensMarg.default function.

scale

a two component list giving the shift and the scale.

K

either a number (when Krandom=FALSE) or a numeric vector with the chain for the number of mixture components.

w

a numeric vector with the chain for the mixture weights.

mu

a numeric vector with the chain for the mixture means.

Li

a numeric vector with the chain for the mixture inverse variances (lower triangles only).

Krandom

a logical value which indicates whether the number of mixture components changes from one iteration to another.

grid

a numeric vector or a list with the grid values in which the predictive density should be evaluated.

If x$dim is 1 then grid may be a numeric vector. If x$dim is higher than then grid must be a list with numeric vectors as components giving the grids for each margin.

If grid is not specified, it is created automatically using the information from the posterior summary statistics stored in x.

lgrid

a length of the grid used to create the grid if that is not specified.

scaled

if TRUE, the density of shifted and scaled data is summarized. The shift and scale vector are taken from the scale component of the object x.

...

optional additional arguments.

Value

An object of class NMixPredDensMarg which has the following components:

x

a list with the grid values for each margin. The components of the list are named x1, ... or take names from grid argument.

freqK

frequency table for the values of K (numbers of mixture components) in the MCMC chain.

propK

proportions derived from freqK.

MCMC.length

the length of the MCMC used to compute the predictive densities.

dens

a list with the computed predictive densities for each margin. The components of the list are named 1, ..., i.e., dens[[1]]=dens[["1"]] is the predictive density for margin 1 etc.

densK

a list with the computed predictive densities for each margin, conditioned further by K. The components of the list are named 1, .... That is, dens[[1]][[1]] = dens[["1"]][[1]] is the predictive density for margin 1 conditioned by K=1, dens[[1]][[2]] = dens[["1"]][[2]] is the predictive density for margin 1 conditioned by K=2 etc.

Note that densK provides some additional information only when Krandom = TRUE or when x results from the NMixMCMC call to the reversible jump MCMC.

There is also a plot method implemented for the resulting object.

Author(s)

Arnošt Komárek arnost.komarek@mff.cuni.cz

References

Komárek, A. (2009). A new R package for Bayesian estimation of multivariate normal mixtures allowing for selection of the number of components and interval-censored data. Computational Statistics and Data Analysis, 53(12), 3932–3947.

See Also

plot.NMixPredDensMarg, NMixMCMC, GLMM_MCMC, NMixPredDensJoint2.

Examples

## See additional material available in 
## YOUR_R_DIR/library/mixAK/doc/
## or YOUR_R_DIR/site-library/mixAK/doc/
## https://www2.karlin.mff.cuni.cz/~komarek/software/mixAK/Galaxy.pdf
## https://www2.karlin.mff.cuni.cz/~komarek/software/mixAK/Faithful.pdf
## https://www2.karlin.mff.cuni.cz/~komarek/software/mixAK/Tandmob.pdf
##

mixAK documentation built on Sept. 25, 2023, 5:08 p.m.