Learn R Programming

mixbox (version 1.2.3)

estep1: Computing posteriors expected value.

Description

For a finite mixture model with density function $$ {\cal{M}}(\bold{y}|\bold{\Psi})=\sum_{g=1}^{G} \omega_{g} f_{\bold{Y}}(\bold{y}, \bold{\Theta}_g), $$ we use method of Basford et al. (1997) for Computing observed Fisher information matrix. Based on above representation for density function of a finite mixture model, we can write $$ \bold{Y}| {T}, W \sim N_{d}\bigl(\bold{\mu}+\bold{\lambda}{T}, {W} \Sigma\bigr), {T}| W \sim HN({0}, {W}), W \sim f_W(w| \bold{\theta}). $$ The required posteriors expectations are \(E\bigl(W^{-1}|\bold{y},\bold{\Psi}\bigr)\), \(E\bigl(W^{-1}T|\bold{y},\bold{\Psi}\bigr)\), and \(E\bigl(W^{-1}T^2|\bold{y},\bold{\Psi}\bigr)\).

Usage

estep1(Y, G, weight, mu, sigma, lambda, family, skewness, param, theta, tick, h, N, PDF)

Value

The required posteriors expectations for approximating the observed Fisher information matrix for restricted finite mixture model. These include \(\tau_{ig}=E\bigl( Z_{ig}=1 \vert {\bold{y}}_{i}, \hat{\bold{\Psi}} \bigr) = {\omega}_g f_{\bold{Y}}\bigl({\bold{y}}_{i}\big|{\bold{\Theta}_g}\bigr)/\bigl[ \sum_{g=1}^{G} {{\omega}}_g f_{\bold{Y}}\bigl({\bold{y}}_{i}\big|{\bold{\Theta}_g}\bigr) \bigr]\), \(E\bigl( W^{-1}\big \vert {\bold{y}}_{i}, \hat{\bold{\Psi}} \bigr)\), \(E\bigl( {{U}}W^{-1}\big \vert {\bold{y}}_{i}, \hat{\bold{\Psi}} \bigr)\), \(E\bigl( U^2 W^{-1}\big \vert {\bold{y}}_{i}, \hat{\bold{\Psi}} \bigr)\), and \(E\bigl( \partial f_W(w| {\bold{\theta)}})/\partial {\bold{\theta)}} \big \vert {\bold{y}}_{i}, \hat{{\bold{\Psi}}} \bigr)\).

Arguments

Y

an \(n\times d\) matrix of observations.

G

the number of components.

weight

a vector of weight parameters (or mixing proportions).

mu

a list of location vectors of G components.

sigma

a list of dispersion matrices of G components.

lambda

a list of skewness vectors of G components.

family

name of the mixing distribution. By default family = "constant" that corresponds to the finite mixture of multivariate normal (or skew normal) distribution. Other candidates for family name are: "bs" (for Birnbaum-Saunders), "burriii" (for Burr type iii), "chisq" (for chi-square), "exp" (for exponential), "f" (for Fisher), "gamma" (for gamma), "gig" (for generalized inverse-Gaussian), "igamma" (for inverse-gamma), "igaussian" (for inverse-Gaussian), "lindley" (for Lindley), "loglog" (for log-logistic), "lognorm" (for log-normal), "lomax" (for Lomax), "ptstable" (for positive \(\alpha\)-stable), "ptstable" (for polynomially tilted \(\alpha\)-stable), "rayleigh" (for Rayleigh), and "weibull" (for Weibull).

skewness

a logical statement. By default skewness = "FALSE" which means that a symmetric model is fitted to each component (cluster). If skewness = "FALSE", then a skewed model is fitted to each component.

param

name of the elements of \({\bold{\theta)}}\) as the parameter vector of mixing distribution with density function \(f_W(w|{\bold{\theta)}}\).

theta

a list of maximum likelihood estimator for \({\bold{\theta)}}\) across G components.

tick

a binary vector whose length depends on type of family. The elements of tick are either 0 or 1. If element of tick is 0, then the correspoding element of \(\bold{\theta}\) is not considered in the formula of \(f_W(w|{\bold{\theta)}}\) for computing the required posterior expectations. If element of tick is 1, then the corresponding element of \(\bold{\theta}\) is considered in the formula of \(f_W(w|{\bold{\theta)}}\). For instance, if family = "gamma" and either its shape or rate parameter is one, then tick = c(1). This is while, if family = "gamma" and both of the shape and rate parameters are in the formula of \(f_W(w|{\bold{\theta)}}\), then tick = c(1, 1).

h

a positive small value for computing numerical derivative of \(f_W(w| {\bold{\theta)}})\) with respect to \({\bold{\theta)}}\), that is \(\partial/ \partial {\bold{\theta)}} f_W(w| {\bold{\theta)}}\).

N

a large integer number for computing Monte Carlo approximation of expected value within the E-step of the EM algorithm.

PDF

expression for mixing density function \(f_W(w| {\bold{\theta)}}\).

Author

Mahdi Teimouri

References

K. E. Basford, D. R. Greenway, G. J. McLachlan, and D. Peel, (1997). Standard errors of fitted means under normal mixture, Computational Statistics, 12, 1-17.

Examples

Run this code
# \donttest{
      n <- 100
      G <- 2
 weight <- rep( 0.5, 2 )
    mu1 <- rep(-5  , 2 )
    mu2 <- rep( 5  , 2 )
 sigma1 <- matrix( c( 0.4, -0.20, -0.20, 0.5 ), nrow = 2, ncol = 2 )
 sigma2 <- matrix( c( 0.5,  0.20,  0.20, 0.4 ), nrow = 2, ncol = 2 )
lambda1 <- c( 5, -5 )
lambda2 <- c(-5,  5 )
 theta1 <- c( 10 )
 theta2 <- c( 20 )
     mu <- list( mu1, mu2 )
  sigma <- list( sigma1 , sigma2 )
 lambda <- list( lambda1, lambda2)
  theta <- list( theta1 , theta2 )
  param <- c( "a" )
    PDF <- quote( (a/2)^(a/2)*x^(-a/2 - 1)/gamma(a/2)*exp( -a/(2*x) ) )
  tick  <- rep( 1, 2 )
theta10 <- c( 10, 10 )
theta20 <- c( 20, 20 )
 theta0 <- list( theta10 , theta20 )
      Y <- rmix( n, G, weight, model = "restricted", mu, sigma, lambda, family = "igamma",
      theta0)
    estep <- estep1( Y[, 1:2], G, weight, mu, sigma, lambda, family = "igamma",
    skewness = "TRUE", param, theta, tick, h = 0.001, N = 3000, PDF)
# }

Run the code above in your browser using DataLab