Dear Maya,
You and I corresponded about this problem yesterday, so I'll respond on the
r-help list only briefly:
On Tue, 23 Oct 2012 23:12:23 +0300
Maya Abou Zeid <ma202 at aub.edu.lb> wrote:> Hello,
>
> I am using the SEM package in R to fit a multigroup latent variable model
and ran into some difficulties. I have 2 questions:
>
>
> 1. First, I am getting the following error message and wondering what
to do to fix it:
>
> Error in solve.default((N[g] - 1) * robustVcov(mod.g, adj.obj =
adj.objects[[g]])) :
>
> system is computationally singular: reciprocal condition number =
4.52055e-23
It's not really possible to try to locate the source of the problem without
the data. You could try several things to get a proper solution, as mentioned in
?sem, and you might try suppressing the computation of the robust coefficient
covariance matrix, which is where the problem surfaces.
>
>
>
> 2. Second, I want to specify different models for two groups (Drivers
vs. Nondrivers), but I want only 1 parameter to be different, while everything
else remains the same. Should I just create two files with the model equations?
But then how do I use these 2 files as an input to the multigroupModel or sem
functions? I tried the following but got the error message {Error in model[, 2]
: incorrect number of dimensions}. Here is a sample of the code:
>
>
> mod.QT.1 <- specifyEquations(...) # model equations for category 1
>
> mod.QT.2 <- specifyEquations(...) # model equations for category 2
>
> Lst.model <- list(mod.QT.1, mod.QT.2)
>
>
>
> mod.mg <- multigroupModel(Lst.model, groups=c("Driver",
"Nondriver"))
>
>
>
> sem.QT <- sem(mod.mg, data=QTrav, group="Driver_Class1",
formula = ~ ..., fixed.x=c(...))
multigroupModel() doesn't take a list of models as an argument but rather
arbitrarily named iniital arguments, one for each group. See ?multigroupModel
for (some) more information.
>
> Are there any sample codes for multigroup modeling using the SEM package
that I can look at?
There are a couple of examples in ?sem, but I know you've already seen them.
These are given in a little more detail in
<http://socserv.socsci.mcmaster.ca/jfox/Books/Companion/appendix/Appendix-SEMs.pdf>.
Best,
John
------------------------------------------------
John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/
>
> Thanks in advance,
> Maya
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.