Learn R Programming

corregp (version 2.0.2)

residuals.corregp: Extracting Residuals from Correspondence Regression

Description

Method to extract the residuals of a correspondence regression.

Usage

# S3 method for corregp
residuals(object, parm = "all", nf = NULL, ...)

# S3 method for corregp resid(object, parm = "all", nf = NULL, ...)

Arguments

object

The output of a call to corregp (i.e. an object of class "corregp").

parm

The parameter for which to extract the residuals. Can be "all", "both" (or abbreviations), "y" or "x" for the residuals of every cell in the data, but it can also be any vector of term names in X or level names in X. Defaults to "all".

nf

The number of dimensions to be retained in the reduced space. Defaults to all dimensions (no reduction).

...

Further arguments passed to or from other methods.

Value

A matrix or vector with the residuals for the parameters of interest, based on the selected number of dimensions.

Details

If all dimensions are retained, then the residuals will only be exactly zero to the observed counts if no conditioning factors were specified with the argument "part" in the corregp call. This is because the associations with the conditioning factors (in "part") are not taken into account.

See Also

coef.corregp, fitted.corregp.

Examples

Run this code
# NOT RUN {
data(HairEye)
haireye.crg <- corregp(Eye ~ Hair * Sex, data = HairEye, b = 3000)
residuals(haireye.crg, parm = c("Hair", "Sex"), nf = 2)
resid(haireye.crg, parm = c("Hair", "Sex"), nf = 2)
# }

Run the code above in your browser using DataLab