Learn R Programming

lavaSearch2 (version 1.0.0)

glht: General Linear Hypothesis

Description

Test general linear hypotheses and across latent variable models.

Usage

# S3 method for mlf2
glht(model, linfct, ...)

glht2(model, linfct, adjust.residuals = TRUE, robust = FALSE, ...)

Arguments

model

a list of latent variable models.

linfct

a contrast matrix specifying the linear hypotheses to be tested.

...

arguments passed to glht, vcov, and lTest.

adjust.residuals

Small sample correction: should the leverage-adjusted residuals be used to compute the score? Otherwise the raw residuals will be used.

robust

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

Examples

Run this code
# NOT RUN {
library(multcomp)

## Simulate data
mSim <- lvm(c(Y1,Y2,Y3)~ beta * eta, E ~ 1)
latent(mSim) <- "eta"
set.seed(10)
n <- 1e2

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

## Fit separate models
ls.lvm <- list(Y1 = estimate(lvm(Y1~E), data = df.data),
               Y2 = estimate(lvm(Y2~E), data = df.data),
               Y3 = estimate(lvm(Y3~E), data = df.data))

## Create contrast matrix
C <- createContrast(ls.lvm, var.test = "E")

lvm.glht <- glht2(ls.lvm, linfct = C)
summary(lvm.glht) ## adjusted

summary(lvm.glht, test = univariate()) ## not adjusted
# }

Run the code above in your browser using DataLab