[R] Structural Equation Models(SEM)

Viechtbauer Wolfgang (STAT) Wolfgang.Viechtbauer at STAT.unimaas.nl
Wed Nov 25 19:03:40 CET 2009


The model you have specified there is not an ordinary factor analysis model. 

This may be closer to what you are thinking of:

model.RLIM <- specify.model()
   f1  ->  R,  laddR,  NA
   f1  ->  L,  laddL,  NA
   f1  ->  I,  laddI,  NA
   f1  ->  M,  laddM,  NA
   R  <->  R,  dR, NA
   L  <->  L,  dL, NA
   I  <->  I,  dI, NA
   M  <->  M,  dM, NA
   f1 <->  f1, NA, 1

sem.RLIM=sem(model.RLIM,tcv,101)

summary(sem.RLIM)

Note that the paths go from the latent factor to the manifest variables, not vice-versa.

Best,

--
Wolfgang Viechtbauer                        http://www.wvbauer.com/
Department of Methodology and Statistics    Tel: +31 (0)43 388-2277
School for Public Health and Primary Care   Office Location:
Maastricht University, P.O. Box 616         Room B2.01 (second floor)
6200 MD Maastricht, The Netherlands         Debyeplein 1 (Randwyck)
________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Ralf Finne [Ralf.Finne at novia.fi]
Sent: Wednesday, November 25, 2009 5:23 PM
To: r-help at r-project.org
Subject: [R] Structural Equation Models(SEM)

Hi R-colleagues.

In the sem-package
i have a problem to introduce hidden variables.
As a simple example I take an ordinary factor analysis.
The program:

cmat=c(0.14855886, 0.05774635, 0.08003300, 0.04900990,
      0.05774635, 0.18042029, 0.11213013, 0.03752475,
            0.08003300, 0.11213013, 0.24646337, 0.03609901,
      0.04900990, 0.03752475, 0.03609901, 0.31702970)
rn=c("R","L","I","M")
cn=c("R","L","I","M")

tcv=matrix(cmat,nrow=4,ncol=4,dimnames=list(rn,cn))

model.RLIM <- specify.model()
   R  ->  f1, laddR,  NA
   L  ->  f1, laddL,  NA
   I  ->  f1, laddI,  NA
   M  ->  f1, laddM,  NA
   R <->  R,  dR,NA
   L <->  L,  dL,NA
   I <->  I,  dI,NA
   M <->  M,  dM,NA
   f1 <->  f1,  df1,NA

sem.RLIM=sem(model.RLIM,tcv,101)

The output:
Error in dimnames(x) <- dn :
 length of 'dimnames' [2] not equal to array extent
In addition: Warning messages:
1: In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names = vars,  :
  singular Hessian: model is probably underidentified.

2: In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names = vars,  :
  refitting without aliased parameters.

I use R version 2.10.0 (2009-10-26) under Windows XP
sem_0.9-19  version.

Where did I make a mistake? Have anyone of  you knowledge
of any other package doing similar things like Confirmative Factor Analysis
Ralf Finne
Novia University of Applied Science
Vasa  Finland

______________________________________________
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.



More information about the R-help mailing list