Open marklhc opened 1 year ago
It works when specifying meanstructure = TRUE
from start:
library(R2spa)
library(lavaan)
#> This is lavaan 0.6-15
#> lavaan is FREE software! Please report any bugs.
model <- "
# latent variable definitions
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + y2 + y3 + y4
dem65 =~ y5 + y6 + y7 + y8
# regressions
dem60 ~ ind60
dem65 ~ ind60 + dem60
# # residual correlations
# y1 ~~ y5
# y2 ~~ y4 + y6
# y3 ~~ y7
# y4 ~~ y8
# y6 ~~ y8
"
fs_dat_ind60 <- get_fs(
data = PoliticalDemocracy,
model = "ind60 =~ x1 + x2 + x3"
)
fs_dat_dem60 <- get_fs(
data = PoliticalDemocracy,
model = "dem60 =~ y1 + y2 + y3 + y4"
)
fs_dat_dem65 <- get_fs(
data = PoliticalDemocracy,
model = "dem65 =~ y5 + y6 + y7 + y8"
)
fs_dat <- cbind(fs_dat_ind60, fs_dat_dem60, fs_dat_dem65)
tspa_fit_2 <- tspa(
model = "dem60 ~ ind60
dem65 ~ ind60 + dem60",
data = fs_dat,
se = list(
ind60 = 0.1213615, dem60 = 0.6756472,
dem65 = 0.5724405
),
meanstructure = TRUE
)
Created on 2023-06-30 with reprex v2.0.2