mlmm | R Documentation |
Fit several linear mixed models, extract relevant coefficients, and combine them into a single table.
mlmm(
...,
data,
by,
contrast.rbind = NULL,
effects = NULL,
robust = FALSE,
df = TRUE,
ci = TRUE,
name.short = c(TRUE, TRUE),
transform.sigma = NULL,
transform.k = NULL,
transform.rho = NULL,
transform.names = TRUE,
trace = TRUE
)
... |
arguments passed to |
data |
[data.frame] dataset (in the long format) containing the observations. |
by |
[character] variable used to split the dataset. On each split a seperate linear mixed model is fit. |
contrast.rbind |
[character or numeric matrix] Contrast to be be applied to compare the groups.
Argument passed to the argument |
effects |
[character or numeric matrix] Linear combinations of coefficients relative to which Wald test should be computed.
Argument passed to |
robust |
[logical] Should robust standard errors (aka sandwich estimator) be output instead of the model-based standard errors.
Argument passed to |
df |
[logical] Should the degree of freedom be computed using a Satterthwaite approximation?
Argument passed to |
ci |
[logical] Should a confidence interval be output for each hypothesis?
Argument passed to |
name.short |
[logical vector of length 2] use short names for the output coefficients: omit the name of the by variable, omit the regression variable name when the same regression variable is used in all models. |
transform.sigma, transform.k, transform.rho, transform.names |
[character] transformation used on certain type of parameters. |
trace |
[interger, >0] Show the progress of the execution of the function. |
Grouping variable in argument repetition: when numeric, it will be converted into a factor variable, possibly adding a leading 0 to preserve the ordering.
This transformation may cause inconsistency when combining results between different lmm
object.
This is why the grouping variable should preferably be of type character or factor.
confint.mlmm
for a data.frame containing estimates with their uncertainty.
summary.mlmm
for a summary of the model and estimates.
autoplot.Wald_lmm
for a graphical display.
#### univariate regression ####
if(require(lava) && require(multcomp)){
set.seed(10)
d1 <- cbind(sim(lvm(Y~0.5*X1), 25), group = "A")
d2 <- cbind(sim(lvm(Y~0.1*X1), 100), group = "B")
d3 <- cbind(sim(lvm(Y~0.01*X1), 1000), group = "C")
d1$id <- 1:NROW(d1)
d2$id <- 1:NROW(d2)
d3$id <- 1:NROW(d3)
d <- rbind(d1,d2,d3)
e.mlmm <- mlmm(Y~X1, data = d, by = "group", effects = "X1=0")
summary(e.mlmm)
summary(e.mlmm, method = "single-step")
summary(e.mlmm, method = "single-step2")
## re-work contrast
summary(anova(e.mlmm, effects = mcp(X1 = "Dunnett")), method = "none")
## summary(mlmm(Y~X1, data = d, by = "group", effects = mcp(X1="Dunnett")))
}
#### multivariate regression ####
set.seed(10)
dL <- sampleRem(250, n.times = 3, format = "long")
e.mlmm <- mlmm(Y~X1+X2+X6, repetition = ~visit|id, data = dL,
by = "X4", structure = "CS")
summary(e.mlmm)
e.mlmmX1 <- mlmm(Y~X1+X2+X6, repetition = ~visit|id, data = dL,
by = "X4", effects = "X1=0", structure = "CS")
summary(e.mlmmX1)
summary(e.mlmmX1, method = "single-step")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.