Skip to content

Structural Equation Model

5 messages · Chuck Cleland, Marcos Sanches, John Fox

#
Hello all!

 I want to estimate parameters in a MIMIC model. I have one latent
variable (ksi), four reflexive indicators (y1, y2, y3 and y4) and four
formative indicators (x1, x2, x3, x4). Is there a way to do it in R? I
know there is the SEM library, but it seems not to be possible to
specify formative indicators, that is, observed exogenous variables
which causes the latent variable. 

 Thanks,

Marcos
#
Dear Marcos,

I don't see why you can't specify a MIMIC model using sem(), though you
might have to supply your own start values. When I have a chance, but
possibly not today, I'll check.

Regards,
 John


--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
--------------------------------
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Marcos Sanches
Sent: Thursday, February 26, 2004 6:33 AM
To: r-help at stat.math.ethz.ch
Subject: [R] Structural Equation Model


	Hello all!

 I want to estimate parameters in a MIMIC model. I have one latent variable
(ksi), four reflexive indicators (y1, y2, y3 and y4) and four formative
indicators (x1, x2, x3, x4). Is there a way to do it in R? I know there is
the SEM library, but it seems not to be possible to specify formative
indicators, that is, observed exogenous variables which causes the latent
variable. 

 Thanks,

Marcos

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
#
Marcos Sanches wrote:
Marcos:
   A MIMIC model seems to work fine in sem().  Here is an example of a 
MIMIC model which also has 4 indicators of a single latent variable and 
4 covariates:

 > S.sch <- var(school)
 > S.sch[upper.tri(var(school))] <- 0

 > round(S.sch, 4)
         Y1      Y2      Y3      Y4      X1      X2      X3     X4
Y1  1.3586  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000 0.0000
Y2  1.0586  1.3815  0.0000  0.0000  0.0000  0.0000  0.0000 0.0000
Y3  0.6709  0.6937  1.8192  0.0000  0.0000  0.0000  0.0000 0.0000
Y4  1.0452  1.1185  0.6584  3.6370  0.0000  0.0000  0.0000 0.0000
X1  0.4891  0.4929  0.3406  0.5244  1.1984  0.0000  0.0000 0.0000
X2  0.0011  0.0246  0.0236  0.0545  0.0177  0.2500  0.0000 0.0000
X3 -0.7325 -0.8166 -0.4524 -0.8481 -0.8759 -0.0017  4.5451 0.0000
X4  0.0614  0.0644  0.0110  0.0781  0.1070 -0.0009 -0.3961 0.1605

 > # n = 5198

 > model.sch <- matrix(c(
+         'Eta1 ->    Y1',         NA,  1,
+         'Eta1 ->    Y2', 'lambda21', NA,
+         'Eta1 ->    Y3', 'lambda31', NA,
+         'Eta1 ->    Y4', 'lambda41', NA,
+         'X1 ->    Eta1',  'gamma11', NA,
+         'X2 ->    Eta1',  'gamma12', NA,
+         'X3 ->    Eta1',  'gamma13', NA,
+         'X4 ->    Eta1',  'gamma14', NA,
+         'Eta1 <-> Eta1',     'psi1', NA,
+         'Y1 <->     Y1',   'theta1', NA,
+         'Y2 <->     Y2',   'theta2', NA,
+         'Y3 <->     Y3',   'theta3', NA,
+         'Y4 <->     Y4',   'theta4', NA,
+         'X1 <->     X1',    'phi11', NA,
+         'X2 <->     X2',    'phi22', NA,
+         'X3 <->     X3',    'phi33', NA,
+         'X4 <->     X4',    'phi44', NA,
+         'X1 <->     X2',    'phi12', NA,
+         'X1 <->     X3',    'phi13', NA,
+         'X1 <->     X4',    'phi14', NA,
+         'X2 <->     X3',    'phi23', NA,
+         'X2 <->     X4',    'phi24', NA,
+         'X3 <->     X4',    'phi34', NA), ncol=3, byrow=TRUE)

 > obs.vars.sch <- c('Y1', 'Y2', 'Y3', 'Y4', 'X1', 'X2', 'X3', 'X4')

 > sem.sch <- sem(model.sch, S.sch, 5198)

 > summary(sem.sch)

  Model Chisquare =  77.445   Df =  14 Pr(>Chisq) = 8.4002e-11
  Goodness-of-fit index =  0.99628
  Adjusted goodness-of-fit index =  0.99044
  RMSEA index =  0.029530   90 % CI: (0.0011724, 0.0011724)
  BIC =  -71.451

  Normalized Residuals
      Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
-3.82e+00 -4.27e-02  1.44e-05  6.41e-02  5.52e-01  2.74e+00

  Parameter Estimates
             Estimate Std Error   z value   Pr(>|z|)
lambda21  1.05267671 0.0156238  67.37643 0.00000000   Y2 <--- Eta1
lambda31  0.65931621 0.0184649  35.70637 0.00000000   Y3 <--- Eta1
lambda41  1.04965996 0.0257337  40.78937 0.00000000   Y4 <--- Eta1
gamma11   0.32691518 0.0134334  24.33606 0.00000000   Eta1 <--- X1
gamma12   0.04487985 0.0263389   1.70394 0.08839245   Eta1 <--- X2
gamma13  -0.11473656 0.0073527 -15.60472 0.00000000   Eta1 <--- X3
gamma14  -0.12574905 0.0371760  -3.38253 0.00071822   Eta1 <--- X4
psi1      0.76836697 0.0218450  35.17364 0.00000000 Eta1 <--> Eta1
theta1    0.35328543 0.0131454  26.87518 0.00000000     Y1 <--> Y1
theta2    0.26742302 0.0133470  20.03617 0.00000000     Y2 <--> Y2
theta3    1.38220283 0.0282621  48.90661 0.00000000     Y3 <--> Y3
theta4    2.52933440 0.0525526  48.12959 0.00000000     Y4 <--> Y4
phi11     1.19841396 0.0235177  50.95794 0.00000000     X1 <--> X1
phi22     0.24998279 0.0049079  50.93426 0.00000000     X2 <--> X2
phi33     4.54509222 0.0891715  50.97021 0.00000000     X3 <--> X3
phi44     0.16053813 0.0031543  50.89539 0.00000000     X4 <--> X4
phi12     0.01769075 0.0075963   2.32886 0.01986650     X2 <--> X1
phi13    -0.87588544 0.0345801 -25.32916 0.00000000     X3 <--> X1
phi14     0.10701444 0.0062625  17.08800 0.00000000     X4 <--> X1
phi23    -0.00173226 0.0147860  -0.11716 0.90673658     X3 <--> X2
phi24    -0.00087825 0.0027789  -0.31604 0.75197217     X4 <--> X2
phi34    -0.39612152 0.0130628 -30.32432 0.00000000     X4 <--> X3

  Iterations =  24

   This example was taken from

http://statmodel.com/mplus/examples/continuous/cont2.html

and the results agree fairly closely.  However, there does seem to be a 
problem with the RMSEA 90% confidence interval above.  Thanks to John 
Fox for providing this package.

hope it helps,

Chuck Cleland
#
Thanks Chuck and John,

I guess the problem is that I was specifying the error terms in the
'ram' matrix. I am not familiarized with this type of model
specification as I am used to work with AMOS. Now I think it will work!

 Thanks very much!

Marcos




-----Mensagem original-----
De: Chuck Cleland [mailto:ccleland at optonline.net] 
Enviada em: quinta-feira, 26 de fevereiro de 2004 10:10
Para: marcos.sanches at ipsos-opinion.com.br
Cc: r-help at stat.math.ethz.ch; John Fox
Assunto: Re: [R] Structural Equation Model
Marcos Sanches wrote:
Marcos:
   A MIMIC model seems to work fine in sem().  Here is an example of a 
MIMIC model which also has 4 indicators of a single latent variable and 
4 covariates:

 > S.sch <- var(school)
 > S.sch[upper.tri(var(school))] <- 0

 > round(S.sch, 4)
         Y1      Y2      Y3      Y4      X1      X2      X3     X4
Y1  1.3586  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000 0.0000 Y2
1.0586  1.3815  0.0000  0.0000  0.0000  0.0000  0.0000 0.0000 Y3  0.6709
0.6937  1.8192  0.0000  0.0000  0.0000  0.0000 0.0000 Y4  1.0452  1.1185
0.6584  3.6370  0.0000  0.0000  0.0000 0.0000 X1  0.4891  0.4929  0.3406
0.5244  1.1984  0.0000  0.0000 0.0000 X2  0.0011  0.0246  0.0236  0.0545
0.0177  0.2500  0.0000 0.0000 X3 -0.7325 -0.8166 -0.4524 -0.8481 -0.8759
-0.0017  4.5451 0.0000 X4  0.0614  0.0644  0.0110  0.0781  0.1070
-0.0009 -0.3961 0.1605

 > # n = 5198

 > model.sch <- matrix(c(
+         'Eta1 ->    Y1',         NA,  1,
+         'Eta1 ->    Y2', 'lambda21', NA,
+         'Eta1 ->    Y3', 'lambda31', NA,
+         'Eta1 ->    Y4', 'lambda41', NA,
+         'X1 ->    Eta1',  'gamma11', NA,
+         'X2 ->    Eta1',  'gamma12', NA,
+         'X3 ->    Eta1',  'gamma13', NA,
+         'X4 ->    Eta1',  'gamma14', NA,
+         'Eta1 <-> Eta1',     'psi1', NA,
+         'Y1 <->     Y1',   'theta1', NA,
+         'Y2 <->     Y2',   'theta2', NA,
+         'Y3 <->     Y3',   'theta3', NA,
+         'Y4 <->     Y4',   'theta4', NA,
+         'X1 <->     X1',    'phi11', NA,
+         'X2 <->     X2',    'phi22', NA,
+         'X3 <->     X3',    'phi33', NA,
+         'X4 <->     X4',    'phi44', NA,
+         'X1 <->     X2',    'phi12', NA,
+         'X1 <->     X3',    'phi13', NA,
+         'X1 <->     X4',    'phi14', NA,
+         'X2 <->     X3',    'phi23', NA,
+         'X2 <->     X4',    'phi24', NA,
+         'X3 <->     X4',    'phi34', NA), ncol=3, byrow=TRUE)

 > obs.vars.sch <- c('Y1', 'Y2', 'Y3', 'Y4', 'X1', 'X2', 'X3', 'X4')

 > sem.sch <- sem(model.sch, S.sch, 5198)

 > summary(sem.sch)

  Model Chisquare =  77.445   Df =  14 Pr(>Chisq) = 8.4002e-11
  Goodness-of-fit index =  0.99628
  Adjusted goodness-of-fit index =  0.99044
  RMSEA index =  0.029530   90 % CI: (0.0011724, 0.0011724)
  BIC =  -71.451

  Normalized Residuals
      Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
-3.82e+00 -4.27e-02  1.44e-05  6.41e-02  5.52e-01  2.74e+00

  Parameter Estimates
             Estimate Std Error   z value   Pr(>|z|)
lambda21  1.05267671 0.0156238  67.37643 0.00000000   Y2 <--- Eta1
lambda31  0.65931621 0.0184649  35.70637 0.00000000   Y3 <--- Eta1
lambda41  1.04965996 0.0257337  40.78937 0.00000000   Y4 <--- Eta1
gamma11   0.32691518 0.0134334  24.33606 0.00000000   Eta1 <--- X1
gamma12   0.04487985 0.0263389   1.70394 0.08839245   Eta1 <--- X2
gamma13  -0.11473656 0.0073527 -15.60472 0.00000000   Eta1 <--- X3
gamma14  -0.12574905 0.0371760  -3.38253 0.00071822   Eta1 <--- X4
psi1      0.76836697 0.0218450  35.17364 0.00000000 Eta1 <--> Eta1
theta1    0.35328543 0.0131454  26.87518 0.00000000     Y1 <--> Y1
theta2    0.26742302 0.0133470  20.03617 0.00000000     Y2 <--> Y2
theta3    1.38220283 0.0282621  48.90661 0.00000000     Y3 <--> Y3
theta4    2.52933440 0.0525526  48.12959 0.00000000     Y4 <--> Y4
phi11     1.19841396 0.0235177  50.95794 0.00000000     X1 <--> X1
phi22     0.24998279 0.0049079  50.93426 0.00000000     X2 <--> X2
phi33     4.54509222 0.0891715  50.97021 0.00000000     X3 <--> X3
phi44     0.16053813 0.0031543  50.89539 0.00000000     X4 <--> X4
phi12     0.01769075 0.0075963   2.32886 0.01986650     X2 <--> X1
phi13    -0.87588544 0.0345801 -25.32916 0.00000000     X3 <--> X1
phi14     0.10701444 0.0062625  17.08800 0.00000000     X4 <--> X1
phi23    -0.00173226 0.0147860  -0.11716 0.90673658     X3 <--> X2
phi24    -0.00087825 0.0027789  -0.31604 0.75197217     X4 <--> X2
phi34    -0.39612152 0.0130628 -30.32432 0.00000000     X4 <--> X3

  Iterations =  24

   This example was taken from

http://statmodel.com/mplus/examples/continuous/cont2.html

and the results agree fairly closely.  However, there does seem to be a 
problem with the RMSEA 90% confidence interval above.  Thanks to John 
Fox for providing this package.

hope it helps,

Chuck Cleland
#
Dear Chuck,

Thanks for saving me the trouble of checking this out. When I have a chance,
I'll take a look at what's going on with the RMSEA confidence interval.
Though it's been awhile, I recall checking this against several examples;
obviously something is wrong here.

Thanks again,
 John 


--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
--------------------------------
-----Original Message-----
From: Chuck Cleland [mailto:ccleland at optonline.net] 
Sent: Thursday, February 26, 2004 8:10 AM
To: marcos.sanches at ipsos-opinion.com.br
Cc: r-help at stat.math.ethz.ch; John Fox
Subject: Re: [R] Structural Equation Model
Marcos Sanches wrote:
Marcos:
   A MIMIC model seems to work fine in sem().  Here is an example of a MIMIC
model which also has 4 indicators of a single latent variable and
4 covariates:

 > S.sch <- var(school)
 > S.sch[upper.tri(var(school))] <- 0

 > round(S.sch, 4)
         Y1      Y2      Y3      Y4      X1      X2      X3     X4
Y1  1.3586  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000 0.0000
Y2  1.0586  1.3815  0.0000  0.0000  0.0000  0.0000  0.0000 0.0000
Y3  0.6709  0.6937  1.8192  0.0000  0.0000  0.0000  0.0000 0.0000
Y4  1.0452  1.1185  0.6584  3.6370  0.0000  0.0000  0.0000 0.0000
X1  0.4891  0.4929  0.3406  0.5244  1.1984  0.0000  0.0000 0.0000
X2  0.0011  0.0246  0.0236  0.0545  0.0177  0.2500  0.0000 0.0000
X3 -0.7325 -0.8166 -0.4524 -0.8481 -0.8759 -0.0017  4.5451 0.0000
X4  0.0614  0.0644  0.0110  0.0781  0.1070 -0.0009 -0.3961 0.1605

 > # n = 5198

 > model.sch <- matrix(c(
+         'Eta1 ->    Y1',         NA,  1,
+         'Eta1 ->    Y2', 'lambda21', NA,
+         'Eta1 ->    Y3', 'lambda31', NA,
+         'Eta1 ->    Y4', 'lambda41', NA,
+         'X1 ->    Eta1',  'gamma11', NA,
+         'X2 ->    Eta1',  'gamma12', NA,
+         'X3 ->    Eta1',  'gamma13', NA,
+         'X4 ->    Eta1',  'gamma14', NA,
+         'Eta1 <-> Eta1',     'psi1', NA,
+         'Y1 <->     Y1',   'theta1', NA,
+         'Y2 <->     Y2',   'theta2', NA,
+         'Y3 <->     Y3',   'theta3', NA,
+         'Y4 <->     Y4',   'theta4', NA,
+         'X1 <->     X1',    'phi11', NA,
+         'X2 <->     X2',    'phi22', NA,
+         'X3 <->     X3',    'phi33', NA,
+         'X4 <->     X4',    'phi44', NA,
+         'X1 <->     X2',    'phi12', NA,
+         'X1 <->     X3',    'phi13', NA,
+         'X1 <->     X4',    'phi14', NA,
+         'X2 <->     X3',    'phi23', NA,
+         'X2 <->     X4',    'phi24', NA,
+         'X3 <->     X4',    'phi34', NA), ncol=3, byrow=TRUE)

 > obs.vars.sch <- c('Y1', 'Y2', 'Y3', 'Y4', 'X1', 'X2', 'X3', 'X4')

 > sem.sch <- sem(model.sch, S.sch, 5198)

 > summary(sem.sch)

  Model Chisquare =  77.445   Df =  14 Pr(>Chisq) = 8.4002e-11
  Goodness-of-fit index =  0.99628
  Adjusted goodness-of-fit index =  0.99044
  RMSEA index =  0.029530   90 % CI: (0.0011724, 0.0011724)
  BIC =  -71.451

  Normalized Residuals
      Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
-3.82e+00 -4.27e-02  1.44e-05  6.41e-02  5.52e-01  2.74e+00

  Parameter Estimates
             Estimate Std Error   z value   Pr(>|z|)
lambda21  1.05267671 0.0156238  67.37643 0.00000000   Y2 <--- Eta1
lambda31  0.65931621 0.0184649  35.70637 0.00000000   Y3 <--- Eta1
lambda41  1.04965996 0.0257337  40.78937 0.00000000   Y4 <--- Eta1
gamma11   0.32691518 0.0134334  24.33606 0.00000000   Eta1 <--- X1
gamma12   0.04487985 0.0263389   1.70394 0.08839245   Eta1 <--- X2
gamma13  -0.11473656 0.0073527 -15.60472 0.00000000   Eta1 <--- X3
gamma14  -0.12574905 0.0371760  -3.38253 0.00071822   Eta1 <--- X4
psi1      0.76836697 0.0218450  35.17364 0.00000000 Eta1 <--> Eta1
theta1    0.35328543 0.0131454  26.87518 0.00000000     Y1 <--> Y1
theta2    0.26742302 0.0133470  20.03617 0.00000000     Y2 <--> Y2
theta3    1.38220283 0.0282621  48.90661 0.00000000     Y3 <--> Y3
theta4    2.52933440 0.0525526  48.12959 0.00000000     Y4 <--> Y4
phi11     1.19841396 0.0235177  50.95794 0.00000000     X1 <--> X1
phi22     0.24998279 0.0049079  50.93426 0.00000000     X2 <--> X2
phi33     4.54509222 0.0891715  50.97021 0.00000000     X3 <--> X3
phi44     0.16053813 0.0031543  50.89539 0.00000000     X4 <--> X4
phi12     0.01769075 0.0075963   2.32886 0.01986650     X2 <--> X1
phi13    -0.87588544 0.0345801 -25.32916 0.00000000     X3 <--> X1
phi14     0.10701444 0.0062625  17.08800 0.00000000     X4 <--> X1
phi23    -0.00173226 0.0147860  -0.11716 0.90673658     X3 <--> X2
phi24    -0.00087825 0.0027789  -0.31604 0.75197217     X4 <--> X2
phi34    -0.39612152 0.0130628 -30.32432 0.00000000     X4 <--> X3

  Iterations =  24

   This example was taken from

http://statmodel.com/mplus/examples/continuous/cont2.html

and the results agree fairly closely.  However, there does seem to be a
problem with the RMSEA 90% confidence interval above.  Thanks to John Fox
for providing this package.

hope it helps,

Chuck Cleland

--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894