model_terms_clme {CLME} | R Documentation |
Create model matrices for clme
Description
Parses formulas to creates model matrices for clme
.
Usage
model_terms_clme(formula, data)
Arguments
formula |
a formula defining a linear fixed or mixed effects model. 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. |
Value
A list with the elements:
Y | response variable |
X1 | design matrix for constrained effect |
X2 | design matrix for covariates |
P1 | number of constrained coefficients |
U | matrix of random effects |
formula | the final formula call (automatically removes intercept) |
dframe | the dataframe containing the variables in the model |
REidx | an element to define random effect variance components |
REnames | an element to define random effect variance components |
Note
The first term on the right-hand side of the formula should be the fixed effect
with constrained coefficients. Random effects are represented with a vertical bar,
so for example the random effect U
would be included by
Y ~ X1 + (1|U)
.
The intercept is removed automatically. This is done to ensure that parameter estimates are of the means of interest, rather than being expressed as a mean with offsets.
See Also
Examples
data( rat.blood )
model_terms_clme( mcv ~ time + temp + sex + (1|id) , data = rat.blood )