time_model | R Documentation |
Fit a mixed model regression with "cubic slope", "linear splines" or "cubic splines" as fixed and random effects.
time_model(
x,
y,
cov = NULL,
data,
method = c("cubic_slope", "linear_splines", "cubic_splines"),
knots = list(cubic_slope = NULL, linear_splines = c(0.75, 5.5, 11), cubic_splines =
c(1, 8, 12))[[method]],
use_car1 = FALSE,
id_var = "ID",
quiet = FALSE
)
x |
A length one character vector with the main covariate name (i.e., right-hand side). |
y |
A length one character vector with the variable name to be explained (i.e., left-hand side). |
cov |
A vector of addtional/optional covariates names to included in the fixed effect part of the linear mixed-effects models. |
data |
A data.frame containing the variables named in |
method |
The type of model, i.e., one of |
knots |
The knots defining the splines for |
use_car1 |
A logical indicating whether to use continuous auto-correlation, i.e., CAR(1) as correlation structure. |
id_var |
A string indicating the name of the variable to be used as the individual identifier. |
quiet |
A logical indicating whether to suppress the output. |
An object of class "lme" representing the linear mixed-effects model fit.
data("bmigrowth")
ls_mod <- time_model(
x = "age",
y = "log(bmi)",
cov = NULL,
data = bmigrowth[bmigrowth[["sex"]] == 0, ],
method = "linear_splines"
)
sres <- as.data.frame(summary(ls_mod)[["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.