[R-sig-ME] Request help translating LISREL code to R?

peter dalgaard pdalgd at gmail.com
Mon Jun 13 10:29:11 CEST 2011


On Jun 10, 2011, at 16:41 , Paul Johnson wrote:

> Hello again. I'm back, begging for help again.
> 
> I'm auditing a workshop on hierarchical models for psychologists and
> they are using LISREL to estimate these models.  I volunteered to
> translate the examples into R (either lme4 or nlme, as the case
> requires).  Many of the examples are easily translate (some easy ones
> pasted in at the end).
> [....]
>        LEVEL 2 CORRELATION MATRIX
> 
>              intcept   GRADE_C     CONS1     CONS3     CONS4     CONS5
> intcept       1.0000
> GRADE_C       0.6186    1.0000
> CONS1         0.0000    0.0000    1.0000
> CONS3         0.0000    0.0000    0.0391    1.0000
> CONS4         0.0000    0.0000    0.0000    0.0391    1.0000
> CONS5         0.0000    0.0000    0.0000    0.0000    0.0391    1.0000
> CONS6         0.0000    0.0000    0.0000    0.0000    0.0000    0.0391
> 
> 
> I'm trying to estimate that with lme.  (In their examples where lmer
> can be used, this is easier for me).
> 
> In case you want the data, I uploaded it in spss format:
> 
> http://pj.freefaculty.org/R/simchild.sav
> 
> Here's how I'm getting started:
> 
> library(foreign)
> dat <- read.spss("simchild.sav", to.data.frame=T)
> oldnames <- colnames(dat)
> colnames(dat) <-  tolower(oldnames)
> 
> ## does not work-estimates not remotely same as LISREL
> ## library(nlme)
> ## mod7lme <- lme(closedad ~  grade_c, data=dat, random= ~ 1 + grade_c
> | id,  correlation = corAR1(0.8, form= ~ 1 | id ))
> ## summary(mod7lme)

Hm, this is way outside my competences (I _heard_ about LISREL in the 1980s...), but a banded matrix and corAR1? AR1 gives exponentially decaying correlations, it is MA1 that has a band matrix.

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com




More information about the R-sig-mixed-models mailing list