[R] sem: incorrect parameter estimates

Baxter Rogers rogers at mr.radiology.wisc.edu
Thu Jul 18 05:57:03 CEST 2002


Hello.

I am getting results from sem that are not correct (that's assuming
that the results from my AMOS 4.0 software are correct).  sem does not
vary some of the parameters substantially from their starting values,
and the final estimates of those parameters as well as the model
chisquare value are incorrect.  I've attached some code that
replicates the problem.  The parameters in question are the residual
variances of the endogenous variables B and C.

A couple of things: the coefficents for the one-headed paths are on a
much different scale than those for the two-headed paths (1e-1 vs
1e6).  I had to supply starting values, because the automatic ones
were not reasonable (1e19) and caused a "singular matrix" error.  Is
this possibly just a numerical issue?

Thanks for any help!

Baxter Rogers




======= begin R code =======

# 071702 Baxter P. Rogers (rogers at mr.radiology.wisc.edu)
#
# Self-contained demonstration of the sem package's failure to modify
# covariances from their starting values.  (This happens for numerical
# or analytic gradient calculation.)  Starting values are supplied
# because the default ones cause a "singular matrix" error.

# covariance matrix
p.cov <- matrix(c( 6330357, 3398673, 3547333, 4764233,
                   3398673, 2618468, 2194462, 2626567,
                   3547333, 2194462, 3128874, 2869895,
                   4764233, 2626567, 2869895, 5171829
                  ), ncol=4, byrow=T)
rownames(p.cov) <- colnames(p.cov) <- c('A','B','C','D')

# RAM specification
p.ram <- matrix(c( 'A->B', 'p1', 0.2,
                   'B->C', 'p2', 0.2,
                   'B<>B', 'p3', 1e6,
                   'D->B', 'p4', 0.2,
                   'C<>C', 'p5', 1e6
                  ), ncol=3, byrow=T)

p.sem <- sem(p.ram, p.cov, 293, fixed.x=c('A','D'), debug=T,
analytic.gradient=F)

print(summary(p.sem))

cat('\n\nFinal parameter values:\n')
print(p.sem$coeff,digits=2)

cat('\nExpected final values (from AMOS software):\n')
cat('5.0e-01 8.4e-01 7.9e+05 4.3e-02 1.3e+06\n\n')

cat('\n\nThe chisquare value from the AMOS fit is 69.7.\n')

====== end R code =======


--
Baxter Rogers (rogers at mr.radiology.wisc.edu)
UW Madison Medical Physics Department, fMRI
Madison, Wisconsin, USA
http://zoot.radiology.wisc.edu/~rogers/


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list