Skip to content

Structural equation models with R

4 messages · André Tavares?==?ISO-8859-1?Q?Corrêa Dias, John Fox

#
Hello useRs,
I`m running structural equation models with R, but for one of my models the 
below error message apears. I`m trying to change startvalues but without 
success. The manual for sem package did not help me. Does anyone knows how to 
change startvalues for iteration in sem package? Or it can be another problem 
with the model?

Error in startvalues(S, ram, debug = debug, tol = start.tol) : 
subscript out of bounds

The model (with three latent variables: 'reg','folha','solo'))

model.com=matrix(c(
'ridos>dendos',	'a1',	NA,
'ridos>reg',	'a2',	NA,
'ridos>folha',	'a3',	NA,
'ridos>solo',	'a4',	NA,
'ridos>raiz',	'a5',	NA,
'dendos>litter',	'a6',	NA,
'dendos>reg',	'a7',	NA,
'litter>reg',	'a8',	NA,
'folha>reg',	'a9',	NA,
'solo>reg',		'a10',	NA,
'raiz>reg',		'a11',	NA,
'raiz>solo',	'a12',	NA,
'folha>solo',	'a13',	NA,
'reg>denjov',	'l1',	NA,
'reg>riqjov',	'l2',	NA,
'folha>nfolha',	'l3',	NA,
'folha>pfolha',	'l4',	NA,
'solo>nsolo',	'l5',	NA,
'solo>psolo',	'l6',	NA,
'riqjov<>riqjov',	'e1',	NA,
'denjov<>denjov',	'e2',	NA,
'litter<>litter',	'e3',	NA,
'riqdos<>riqdos',	'e4',	NA,
'dendos<>dendos',	'e5',	NA,
'raiz<>raiz',	'e6',	NA,
'nsolo<>nsolo',	'e7',	NA,
'psolo<>psolo',	'e8',	NA,
'nfolha<>nfolha',	'e9', NA,
'pfolha<>pfolha',	'e10',	NA,
'reg<>reg',		NA,	1,
'solo<>solo',	NA,	1,
'folha<>folha',	NA,	1),
ncol=3, byrow=TRUE)

obs.vars.com=c('riqjov','denjov','litter','riqdos','dendos','raiz',
'nsolo','psolo','nfolha','pfolha')

sem.com=sem(model.com,S.com,30,obs.vars.com)

-------------------------------
Andr? Tavares Corr?a Dias
Laborat?rio de Ecologia Vegetal
Departamento de Ecologia - IB
Universidade Federal do Rio de Janeiro
Ilha do Fund?o, CCS
Rio de Janeiro, RJ. Brasil
CEP 21941-590    CP 68020
Tel. (21)2562-6377
#
Dear Andre,

Is one of the observed variables named "ridos" or "riqdos"?

I hope this helps,
 John

--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
--------------------------------
#
Dear John,
Thanks very much! I don?t know how I didn?t see this before. I checked a 
thousand of times....
There is one more thing that I can not understand. What are the possible 
reasons for problems on calculation of confidence interval for RMSEA? For the 
same model I sent before (after correction of the variable name) the lower CI 
output was NA:

Model Chisquare =  10.824   Df =  13 Pr(>Chisq) = 0.62558
 Goodness-of-fit index =  0.91656
 Adjusted goodness-of-fit index =  0.76895
 RMSEA index =  0   90 % CI: (NA, 0.15652)
 BIC =  -60.425

I have other models with the same behavior, even when the estimative of RMSEA 
is different from zero.

Model Chisquare =  15.165   Df =  14 Pr(>Chisq) = 0.367
 Goodness-of-fit index =  0.89038
 Adjusted goodness-of-fit index =  0.71811
 RMSEA index =  0.053558   90 % CI: (NA, 0.19141)
 BIC =  -61.564

Thanks and all the best.
Andr?

-------------------------------
Andr? Tavares Corr?a Dias
Laborat?rio de Ecologia Vegetal
Departamento de Ecologia - IB
Universidade Federal do Rio de Janeiro
Ilha do Fund?o, CCS
Rio de Janeiro, RJ. Brasil
CEP 21941-590    CP 68020
Tel. (21)2562-6377
#
Dear Andre,
(Recall that there was a typo in Andre's model specification.)
The method used to get the confidence interval (from Browne and Du Toit,
Multivariate Behavioral Research, 1992, 27:269-300) can produce a lower
bound above the RMSEA estimate or an upper bound below the estimate; when
this happens, the bound is set to NA. One of the nice things about R is that
you can look at the code for a function -- in this case, summary.sem() -- to
see exactly what it does. Take a look at how RMSEA.L and RMSEA.U are
computed.

Regards,
 John