Learn R Programming

CLME (version 2.0-12)

clme_resids: Computes various types of residuals

Description

Computes several types of residuals for objects of class clme.

Usage

clme_resids(formula, data, gfix = NULL)

Arguments

formula

a formula expression. The constrained effect(s) must come before any unconstrained covariates on the right-hand side of the expression. The first ncon terms will be assumed to be constrained.

data

data frame containing the variables in the model.

gfix

optional vector of group levels for residual variances. Data should be sorted by this value.

Value

List containing the elements PA, SS, FM, cov.theta, xi, ssq, tsq. PA, SS, FM are defined above (for fixed-effects models, the residuals are only PA). Then cov.theta is the unconstrained covariance matrix of the fixed-effects coefficients, xi is the vector of random effect estimates, and ssq and tsq are unconstrained estimates of the variance components.

Details

For fixed-effects models \(Y = X\beta + \epsilon\), residuals are given as \(\hat{e} = Y - X\hat{\beta}\). For mixed-effects models \(Y = X\beta + + U\xi + \epsilon\), three types of residuals are available. \(PA = Y - X\hat{\beta}\)\ \(SS = U\hat{\xi}\)\ \(FM = Y - X\hat{\beta} - U\hat{\xi}\)

See Also

CLME-package clme

Examples

Run this code
# NOT RUN {
data( rat.blood )
cons <- list(order = "simple", decreasing = FALSE, node = 1 )

clme.out <- clme_resids(mcv ~ time + temp + sex + (1|id), data = rat.blood )
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab