Dear Chad,

It's possible that I don't understand properly what you've done, but it appears 
as if you're passing to bootSem() the covariance matrices for the observed data 
rather than the case-by-variable data sets themselves. That's also what you say 
you're doing, and it's what the error message says. 

Moreover, if you look at the documentation in ?bootSem, you'll is that the Cov 
argument isn't a covariance matrix, but "a function to compute the input 
covariance or moment matrix; the default is cov. Use cor if the model is fit to 
the correlation matrix. The function hetcor in the polycor package will compute 
product-moment, polychoric, and polyserial correlations among mixed continuous 
and ordinal variables (see the first example below for an illustration)."

So what is there to bootstrap if bootSem() doesn't have access to the original 
data sets? I suppose that one could do a parametric bootstrap of some sort, but 
that's not what bootSem() does -- in implements a nonoparametric bootstrap, 
which requires the original data.

I hope this helps,
 John

-----------------------------------------------
John Fox, Professor
McMaster University
Hamilton, Ontario, Canada
http://socserv.socsci.mcmaster.ca/jfox/



> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Chad Danyluck
> Sent: Wednesday, August 27, 2014 12:22 PM
> To: r-help@r-project.org
> Subject: [R] Problems bootstrapping multigroup SEM
> 
> 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]]
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to