Dear Mike and Colleagues,
My understanding is that moderator analysis at the 2nd stage of metaSEM approach using metaSEM::wls()
involves multi-group analysis.
Thus, as a user I have to subset
my data by categories of my moderator, and fit the same model syntax to each subset as shown below.
But at the end, how can I conclude whether I have a significant moderator or not? For example, should/can I do: anova(wls1, wls2)
and if one model is significantly different from another conclude that the moderator is significant? (I appreciate a demonstration.)
library(metaSEM) ## Sample sizes n1 <- 100 n2 <- 200 ## Variable labels vars <- c("y", "x1", "x2") ## Group 1 data and model R1 <- matrix(c(1.00, 0.22, 0.24, 0.22, 1.00, 0.30, 0.24, 0.30, 1.00), ncol=3, nrow=3, dimnames=list(vars, vars)) acov1 <- asyCov(R1, n1) model1 <- "y ~ b1a*x1 + b2a*x2 ## Variances of x1 and x2 are 1 x1 ~~ 1*x1 x2 ~~ 1*x2 ## x1 and x2 are correlated x1 ~~ ra*x2" RAM1 <- lavaan2RAM(model1, obs.variables=vars) wls1 <- wls(model="Group1", Cov=R1, aCov=acov1, n=n1, RAM=RAM1) ## Group 2 data and model R2 <- matrix(c(1.00, 0.33, 0.41, 0.33, 1.00, 0.35, 0.41, 0.35, 1.00), ncol=3, nrow=3, dimnames=list(vars, vars)) acov2 <- asyCov(R2, n2) model2 <- "y ~ b1b*x1 + b2b*x2 ## Variances of x1 and x2 are 1 x1 ~~ 1*x1 x2 ~~ 1*x2 ## x1 and x2 are correlated x1 ~~ rb*x2" RAM2 <- lavaan2RAM(model2, obs.variables=vars) wls2 <- wls(model="Group2", Cov=R2, aCov=acov2, n=n2, RAM=RAM2)