Computes several types of residuals for objects of class `clme`

.

1 | ```
clme_resids(formula, data, gfix = NULL, ncon = 1)
``` |

`formula` |
a formula expression. The constrained effect(s) must come before any unconstrained covariates on the right-hand side of the expression. The first |

`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. |

`ncon` |
the number of variables in |

For fixed-effects models *Y = X*b + e*, residuals are given as * ehat = Y - X*betahat*.
For mixed-effects models *Y = X*b + U*xi + e*, three types of residuals are available.
* PA = Y - X*betahat*\
* SS = U*xihat*\
* FM = Y - X*betahat - U*xihat*

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.

There are few error catches in these functions. If only the EM estimates are desired,
users are recommended to run `clme`

setting `nsim=0`

.

By default, homogeneous variances are assumed for the residuals and (if included)
random effects. Heterogeneity can be induced using the arguments `Nks`

and `Qs`

,
which refer to the vectors *(n1, n2 ,... , nk)* and
*(c1, c2 ,... , cq)*, respectively. See
`CLME-package`

for further explanation the model and these values.

See `w.stat`

and `lrt.stat`

for more details on using custom
test statistics.

`CLME-package`

`clme`

1 2 3 4 5 6 7 |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.