mixreg (version 0.0-6)

residMix: Calculate the residuals of a mixture of linear regressions.

Description

Calculates the residuals from each component of the mixture and the matrix of probabilities that each observation was generated by each component.

Usage

residMix(object, x, y, std=FALSE)

Arguments

object

List describing the fitted mixture of regressions as returned by mixreg.

x

The matrix of predictors to which the mixture has been fitted. If there is only one predictor then x may be a vector.

y

The vector of observed values to which the mixture has been fitted.

std

Logical argument; if TRUE then the residuals are standardized (by dividing them by their estimated standard deviation).

Value

A list (of class "mresid") with components

resid

The residuals of the model in a matrix. The k-th column of this matrix is the vector of residuals from the k-th component of the model.

gamma

The matrix of probabilities that each observation was generated by each component

x

The x argument of the call to residMix

y

The y argument of the call to residMix

Details

The calculation of the estimated standard deviations of the residuals is a little bit complicated since each component of the model is fitted using weighted regression in a setting in which the weights are NOT the reciprocals of error variances. See the reference below for more detail.

References

Turner, T. R. (2000) Estimating the rate of spread of a viral infection of potato plants via mixtures of regressions. Appl. Statist. vol. 49, Part 3, pp. 371 -- 384.

See Also

bootcomp, cband, covmix, mixreg, plot.cband, plot.mresid, qqMix

Examples

Run this code
# NOT RUN {
#See \link{mixreg} for examples.
# }

Run the code above in your browser using DataCamp Workspace