Demo.twolevel {lavaan}R Documentation

Demo dataset for a illustrating a multilevel CFA.

Description

A toy dataset containing measures on 6 items (y1-y6), 3 within-level covariates (x1-x3) and 2 between-level covariates (w1-w2). The data is clustered (200 clusters of size 5, 10, 15 and 20), and the cluster variable is “cluster”.

Usage

data(Demo.twolevel)

Format

A data frame of 2500 observations of 12 variables. clusters.

y1

item 1

y2

item 2

y3

item 3

y4

item 4

y5

item 5

y6

item 6

x1

within-level covariate 1

x2

within-level covariate 2

x3

within-level covariate 3

w1

between-level covariate 1

w2

between-level covariate 2

cluster

cluster variable

Examples

head(Demo.twolevel)

model <- '
    level: 1
        fw =~ y1 + y2 + y3
        fw ~ x1 + x2 + x3
    level: 2
        fb =~ y1 + y2 + y3
        fb ~ w1 + w2
'
fit <- sem(model, data = Demo.twolevel, cluster = "cluster")
summary(fit)

[Package lavaan version 0.6-18 Index]