Learn R Programming

moc (version 2.0)

residuals.moc: Posterior and residuals methods for MOC models

Description

post is a generic method for computing posterior probabilities of a fitted model.

post.moc computes the posterior mixture probabilities for each subject of a fitted moc model.

residuals.moc computes response, deviance, gradient and mixture residuals. The residuals are optionally weighted by the posterior mixture probabilities, globally (with post) or within each group (in that case post is divided by its mean for each group).

npmle.gradient computes the components and average of the mixture gradient function at some specified parameters values $$\frac{1}{n}\sum_{i=1}^n\Bigl{(}\frac{\hat{h}_j(y_i|\,x_i)} {\sum_k\hat{\pi}_k(z_i,x_i)\,\hat{h}_k(y_i|\,x_i)} - 1\Bigr{)}$$ or the empirical mixture gradient which is $$\frac{1}{n}\sum_{i=1}^n\Bigl{(}\frac{d\hat{F}(y_i)}{\sum_k\hat{\pi}_k(z_i,x_i)\, \hat{h}_k(y_i|\,x_i)} - 1\Bigr{)}$$ where \(d\hat{F}()\) is the empirical measure.

Usage

post(object, …)
   
# S3 method for moc
post(object, …)

# S3 method for moc residuals(object, …, type = c("deviance","response","mixture","gradient"), post.weight = TRUE, within = FALSE)

npmle.gradient(object, parm = object$coef, gradient = TRUE, average = FALSE)

Arguments

object

Object of class moc.

type

Type of residuals: either "deviance" (the default), "response", "gradient" and "mixture" (see description and details).

post.weight

Specify if the residuals must be weighted by the posterior mixture probabilities. Weighting is preferable, it is the default.

within

Boolean that specify if the posterior weights are rescaled within each mixture group.

parm

Parameters values at which evaluation of the gradient takes place.

gradient

Boolean specifying if you require the density for each mixture group (TRUE) or the empirical measure (FALSE) in the numerator of npmle.gradient (see the description above).

average

Boolean that specify if npmle.gradient should return the individual components or the average.

Unused.

Value

residuals.moc returns an array of class residuals.moc and residuals with attributes type, post.weight and within. All these methods return their values invisibly.

Details

Posterior probabilities are the conditional probabilities of mixture groups given the subject response observations and are computed using the formula: $$\hat{\tau}_{i,k} = \frac{\hat{\pi}_k(z_i,x_i)\, \hat{h}_k( y_i | x_i)}{\sum_k \hat{\pi}_k(z_i, x_i)\, \hat{h}_k( y_i | x_i)}$$

Response residuals are simply the difference between the observed and expected values, $$response = y - expected$$

Deviance residuals are defined as properly scaled difference in the log likelihood at the observed and fitted value. $$deviance = \Bigl{\lbrace}2\cdot wt\cdot \log{\Bigl{(}\frac{\mathrm{density}(y,y,shape,extra)} {\mathrm{density}(y,mu,shape,extra)}\Bigr{)}}\Bigr{\rbrace}^{1/2} \cdot \mathrm{sign}(response)$$

The npmle.gradient function is primarily intended to compute the components which are used to define the mixture and gradient residuals in residuals.moc. Mixture residuals uses the empirical gradient components while gradient residuals uses the mixture gradient components defined in the description above. The average of the first form above which we call the gradient can be used to check some minimal requirement about a proposed solution given with parm: if it is a maximum likelihood (not necessarily a non-parametric maximum likelihood) the average should be \(0\). See Lindsay, B.G. (1983) for details about the use of the gradient function for finite mixture and non-parametric mixture and Lindsay, B.G. and Roeder, K. (1992) for residuals diagnostics specific to mixture models.

Globally weighted residuals are preferable to detect influential data, wrong number of groups and differences between groups. Rescaled weight residuals are more useful when plotted against some variables or variable index to detect misspecified regression function or density.

References

McLachlan, G. and Peel, D. (2000) Finite mixture models, Wiley-Interscience, New York.

Lindsay, B. G. and Roeder, K. (1992) Residual diagnostics for mixture models, Journal of the American Statistical Association, 87, pp. 785--794.

See Also

moc, plot.moc, print.moc, AIC.moc, plot.residuals.moc