egg_model | R Documentation |
Fit a cubic splines mixed model regression
with three splines parametrisation as random effect.
This function is a specific version of time_model()
.
egg_model(
formula,
data,
id_var,
random_complexity = "auto",
use_car1 = FALSE,
knots = c(1, 8, 12),
quiet = FALSE
)
formula |
An object of class "formula": a symbolic description of the model to be fitted with, time component as the first term in the right-hand side. |
data |
A data.frame containing the variables defined in formula. |
id_var |
A string indicating the name of the variable to be used as the individual identifier. |
random_complexity |
A numeric (1-3) indicating the complexity of the random effect term.
Default, |
use_car1 |
A logical indicating whether to use continuous auto-correlation, i.e., CAR(1) as correlation structure. |
knots |
The knots defining the splines. |
quiet |
A logical indicating whether to suppress the output. |
An object of class "lme" representing the linear mixed-effects model fit.
data("bmigrowth")
res <- egg_model(
formula = log(bmi) ~ age,
data = bmigrowth[bmigrowth[["sex"]] == 0, ],
id_var = "ID",
random_complexity = 1
)
sres <- as.data.frame(summary(res)[["tTable"]])
rownames(sres) <- sub("gsp\\(.*\\)\\)", "gsp(...)", rownames(sres))
sres
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.