residuals.moc {moc}R Documentation

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

1/n Sum_i { h_k(y[i] | x[i] ) / Sum_k p_k(z[i],x[i]) h_k( y[i] | x[i]) - 1}

or the empirical mixture gradient which is

1/n Sum_i { dF(y[i]) / Sum_k p_k(z[i],x[i]) h_k( y[i] | x[i]) - 1}

where dF() is the empirical measure.

Usage


post(object, ...)
   
## S3 method for class 'moc':
post(object, ...)

## S3 method for class '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.

Details

Posterior probabilities are the conditional probabilities of mixture groups given the subject response observations and are computed using the formula:

post[i,k] = p_k( z[i], x[i]) h_k( y[i] | x[i]) / Sum_k (p_k(z[i], x[i]) 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 = sqrt(2*wt*(log(density(y,y,shape,extra)/density(y,mu,shape,extra)))) * 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.

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.

Author(s)

Bernard Boulerice <Bernard.Boulerice@sympatico.ca>

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


[Package moc version 1.0.5.1 Index]