rbind.Wald_lmm: Combine Wald Tests From Linear Mixed Models

View source: R/rbind.R

rbind.Wald_lmmR Documentation

Combine Wald Tests From Linear Mixed Models

Description

Combine linear hypothesis tests from possibly different linear mixed models.

Usage

## S3 method for class 'Wald_lmm'
rbind(
  model,
  ...,
  effects = NULL,
  rhs = NULL,
  univariate = TRUE,
  multivariate = TRUE,
  name = NULL,
  name.short = TRUE,
  sep = ": "
)

Arguments

model

a Wald_lmm object (output of anova applied to a lmm object)

...

possibly other Wald_lmm objects

effects

[character or numeric matrix] how to combine the left-hand side of the hypotheses. By default identity matrix but can also be "Dunnett", "Tukey", or "Sequen" (see function multcomp::contrMat from the multcomp package).

rhs

[numeric vector] the right hand side of the hypothesis. Should have the same length as the number of row of argument effects.

univariate

[logical] Should an estimate, standard error, confidence interval, and p-value be output for each hypothesis?

multivariate

[logical] Should all hypotheses be simultaneously tested using a multivariate Wald test?

name

[character vector or NULL] character used to identify each model in the output. By default, use the name of the outcome of the model.

name.short

[logical] use short names for the output coefficients, e.g., omit the regression variable name when the same regression variable is used in all models.

sep

[character] character used to separate the name/outcome and the covariate when identifying the linear hypotheses.

Details

In presence of measurements from the same cluster across several models, the influence function is used to estimate the covariance between the model parameters. This is why the (robust) standard errors may not match the (model-based) standard error from the linear mixed Setting the argument robust to FALSE when calling anova.lmm will rescale the (robust) standard errors to mimic the original model-based standard errors.

Examples

## simulate data
set.seed(10)
dL <- sampleRem(1e2, n.times = 3, format = "long")

## estimate mixed models
e.lmm1 <- lmm(Y ~ X1+X2+X3, repetition = ~visit|id, data = dL,
              structure = "CS", df = FALSE)
e.lmm2 <- lmm(Y ~ X1+X8+X9, repetition = ~visit|id, data = dL,
              structure = "CS", df = FALSE)


## combine null hypotheses
## - model-based standard errors
AAA <- anova(e.lmm1, effect = c("X1|X2,X3"="X1=0","X2|X1,X3"="X2=0"), simplify = FALSE)
BBB <- anova(e.lmm2, effect = c("X1|X8,X9"="X1=0"), simplify = FALSE)
ZZZ <- rbind(AAA,BBB)
summary(ZZZ) ## adjusted for multiple testing
rbind(model.tables(e.lmm1)[2:3,], model.tables(e.lmm2)[2,,drop=FALSE])

## select null hypotheses & combine (model-based like standard errors)
AA <- anova(e.lmm1, effect = c("X1|X2,X3"="X1=0","X2|X1,X3"="X2=0"),
             robust = TRUE, simplify = FALSE)
BB <- anova(e.lmm2, effect = c("X1|X8,X9"="X1=0"),
             robust = TRUE, simplify = FALSE)
ZZ <- rbind(AA,BB)
summary(ZZ)  ## adjusted for multiple testing
rbind(model.tables(e.lmm1, robust = TRUE)[2:3,],
      model.tables(e.lmm2, robust = TRUE)[2,,drop=FALSE])

bozenne/repeated documentation built on July 16, 2025, 11:16 p.m.