ibrary(semTools)
library(lavaan)
library(Amelia)
library(mice)
r2 <- r[,c("TraditionAndConformity", "Relatedness", "AgencyAndSelfDirectedness", "SelfDirectionActionC", "ConformityRulesC", "AutoRelEthno", "Heteroetno", "SeparatenessEtno", "IOSTOTAL", "dispototal")]
simpleMediation <- '
Heteroetno ~ b * TraditionAndConformity + c * dispototal
TraditionAndConformity ~ a * dispototal
indirect := a * b
total := c + (a * b)
TraditionAndConformity ~~1*TraditionAndConformity
Heteroetno ~~ Heteroetno
dispototal ~~ dispototal
'
require(lavaan)
fit <- sem.mi(model = simpleMediation, data = r2, m = 40, miPackage = "Amelia", seed = 12345)
show(fit)
summary(fit, se = TRUE, ci = TRUE, level = 0.95,
standardized = TRUE, rsquare = FALSE, fmi = FALSE, header = TRUE,
scale.W = TRUE, asymptotic = FALSE, add.attributes = TRUE)
coef(fit, type = "free", labels = TRUE)
vcov(fit, type = c("pooled", "between", "within",
"ariv"), scale.W = FALSE)
anova(fit, h1 = NULL, test = c("D2"),
pool.robust = F, scale.W = FALSE, asymptotic = F,
constraints = NULL, indices = TRUE, baseline.model = NULL,
method = "default", A.method = "delta", scaled.shifted = TRUE,
H1 = TRUE, type = "Chisq")