Learn R Programming

lavaSearch2 (version 2.0.3)

glht2: General Linear Hypothesis Testing With Small Sample Correction

Description

Test linear hypotheses on coefficients from a latent variable models with small sample corrections.

Usage

glht2(object, ...)

# S3 method for lvmfit glht2( object, linfct, rhs = NULL, robust = FALSE, cluster = NULL, ssc = lava.options()$ssc, df = lava.options()$df, ... )

# S3 method for lvmfit2 glht2(object, linfct, rhs = NULL, robust = FALSE, cluster = NULL, ...)

# S3 method for mmm glht2(object, linfct, rhs = 0, robust = FALSE, cluster = NULL, ...)

# S3 method for lvmfit2 glht(model, linfct, rhs = NULL, robust = FALSE, cluster = NULL, ...)

Value

A glht object.

Arguments

object, model

a lvmfit, lvmfit2, or mmm object.

...

[logical] arguments passed to lower level methods.

linfct

[matrix or vector of character] the linear hypotheses to be tested. Same as the argument par of createContrast.

rhs

[vector] the right hand side of the linear hypotheses to be tested.

robust

[logical] should robust standard error be used? Otherwise rescale the influence function with the standard error obtained from the information matrix.

cluster

[integer vector] the grouping variable relative to which the observations are iid.

ssc

[character] method used to correct the small sample bias of the variance coefficients: no correction ("none"/FALSE/NA), correct the first order bias in the residual variance ("residual"), or correct the first order bias in the estimated coefficients "cox"). Only relevant when using a lvmfit object.

df

[character] method used to estimate the degree of freedoms of the Wald statistic: Satterthwaite "satterthwaite". Otherwise ("none"/FALSE/NA) the degree of freedoms are set to Inf. Only relevant when using a lvmfit object.

Details

Whenever the argument linfct is not a matrix, it is passed to the function createContrast to generate the contrast matrix and, if not specified, rhs.

Since only one degree of freedom can be specify in a glht object and it must be an integer, the degree of freedom of the denominator of an F test simultaneously testing all hypotheses is retained, after rounding.

Argument rhs and null are equivalent. This redondance enable compatibility between lava::compare, compare2, multcomp::glht, and glht2.

See Also

createContrast to create contrast matrices.
estimate2 to pre-compute quantities for the small sample correction.

Examples

Run this code
library(multcomp)

## Simulate data
mSim <- lvm(c(Y1,Y2,Y3)~ beta * eta, Z1 ~ E, Z2 ~ E, Age[40:5]~1)
latent(mSim) <- "eta"
set.seed(10)
n <- 1e2

df.data <- lava::sim(mSim, n, latent = FALSE, p = c(beta = 1))

#### Inference on a single model ####
e.lvm <- estimate(lvm(Y1~E), data = df.data)
summary(glht2(e.lvm, linfct = c("Y1~E + Y1","Y1")))

#### Inference on separate models ####
## fit separate models
lvmX <- estimate(lvm(Z1 ~ E), data = df.data)
lvmY <- estimate(lvm(Z2 ~ E + Age), data = df.data)
lvmZ <- estimate(lvm(c(Y1,Y2,Y3) ~ eta, eta ~ E), 
                 data = df.data)

#### create mmm object #### 
e.mmm <- mmm(X = lvmX, Y = lvmY, Z = lvmZ)

#### create contrast matrix ####
resC <- createContrast(e.mmm, linfct = "E")

#### adjust for multiple comparisons ####
e.glht2 <- glht2(e.mmm, linfct = c(X="E"), df = FALSE)
summary(e.glht2)

Run the code above in your browser using DataLab