[R] Problems bootstrapping multigroup SEM

Chad Danyluck c.danyluck at gmail.com
Wed Aug 27 18:22:00 CEST 2014


Hello,

I am having difficulty resolving an error I receive trying to bootstrap a
multigroup SEM. The error (below) indicates that the model called to
bootSem doesn't contain matrices. This is true, sort of, because I created
a list of two covariance matrices for the model to call. All of this syntax
works fine (a summary of "MAP.mg.sem" will produce parameter estimates,
goodness of fit indices, etc.), however, the bootSem function does not run.
Any ideas on a workaround?

MLM.MAP.Data$IAT.factor <- as.factor(IAT)
IAT.factor <- MLM.MAP.Data$IAT.factor
evaluative.MAP.data <- subset(data.frame(IAT.factor, exp.race,
meditation.experience, years.meditate, repeated.iat, repeated.ERN, age,
acceptance, awareness, FCz.GNG.150.incor, FCz.GNG.150.cor,
FCz.stereo.150.incor, FCz.stereo.150.cor, FCz.eval.150.incor,
FCz.eval.150.cor), IAT==2)
stereotype.MAP.data <- subset(data.frame(IAT.factor, exp.race,
meditation.experience, years.meditate, repeated.iat, repeated.ERN, age,
acceptance, awareness, FCz.GNG.150.incor, FCz.GNG.150.cor,
FCz.stereo.150.incor, FCz.stereo.150.cor, FCz.eval.150.incor,
FCz.eval.150.cor), IAT==1)

MAP.stereotype.cov <- cov(na.omit(stereotype.MAP.data[,-1]))
MAP.evaluative.cov <- cov(na.omit(evaluative.MAP.data[,-1]))
MAP.cov.list <- list(stereotype=MAP.stereotype.cov,
evaluative=MAP.evaluative.cov)

#### Specify your MSEM path model: Years Meditating, ERN, IAT####
MAP.msem.model <- specifyModel()
years.meditate -> repeated.ERN, path1
years.meditate -> repeated.iat, path2
repeated.ERN -> repeated.iat, path3
age -> repeated.iat, path4
years.meditate <-> years.meditate, var1
repeated.ERN <-> repeated.ERN, var2
age <-> age, var3
age <-> years.meditate, cov1
repeated.iat <-> repeated.iat, d1

MAP.mg.mod <- multigroupModel(MAP.msem.model, groups=c("stereotype",
"evaluative"))

MAP.mg.sem <- sem(MAP.mg.mod, MAP.cov.list, c(nrow(stereotype.MAP.data),
nrow(evaluative.MAP.data)), group="IAT.factor")

system.time(bootSem(MAP.mg.sem, R=100, MAP.cov.list))

Error in bootSem.msem(MAP.mg.sem.2, MAP.cov.list, R = 100) :
  the model object doesn't contain data matrices

-- 
Chad M. Danyluck
PhD Candidate, Psychology
University of Toronto
Lab: http://embodiedsocialcognition.com


“There is nothing either good or bad but thinking makes it so.” - William
Shakespeare

	[[alternative HTML version deleted]]



More information about the R-help mailing list