Learn R Programming

sirt (version 4.1-15)

lsem.test: Test a Local Structural Equation Model Based on Bootstrap

Description

Performs global and parameter tests for a fitted local structural equation model. The LSEM must have been fitted and bootstrap estimates of the LSEM model must be available for statistical inference. The hypothesis of a constant parameter is tested by means of a Wald test. Moreover, regression functions can be specified and tested if these are specified in the argument models.

Usage

lsem.test(mod, bmod, models=NULL)

Value

List with following entries

wald_test_global

Global Wald test for model parameters

test_models

Output for fitted regression models

parameters

Original model parameters after fitting (i.e., smoothing) a particular parameter using a regression model specified in models.

parameters_boot

Bootstrapped model parameters after fitting (i.e., smoothing) a particular parameter using a regression model specified in models.

Arguments

mod

Fitted LSEM object

bmod

Fitted LSEM bootstrap object. The argument bmod can also be missing.

models

List of model formulas for named LSEM model parameters

See Also

See also lsem.estimate for estimating LSEM models and lsem.bootstrap for bootstrapping LSEM models.

Examples

Run this code
if (FALSE) {
#############################################################################
# EXAMPLE 1: data.lsem01 | Age differentiation and tested models
#############################################################################

data(data.lsem01, package="sirt")
dat <- data.lsem01

# specify lavaan model
lavmodel <- "
        F=~ v1+v2+v3+v4+v5
        F ~~ 1*F
    "

# define grid of moderator variable age
moderator.grid <- seq(4,23,1)

#-- estimate LSEM with bandwidth 2
mod <- sirt::lsem.estimate( dat, moderator="age", moderator.grid=moderator.grid,
               lavmodel=lavmodel, h=2, std.lv=TRUE)
summary(mod1)

#-- bootstrap model
bmod <- sirt::lsem.bootstrap(mod, R=200)

#-- test models
models <- list( "F=~v1"=y ~ m + I(m^2),
                "F=~v2"=y ~ I( splines::bs(m, df=4) ) )
tmod <- sirt::lsem.test(mod=mod, bmod=bmod, models=models)
str(tmod)
sirt::print_digits(wald_test_global, 3)
sirt::print_digits(test_models, 3)
}

Run the code above in your browser using DataLab