# [R] sem (lisrel) - starting problems

John Fox jfox at mcmaster.ca
Tue Oct 8 20:35:44 CEST 2002

```Dear Christian,

At 05:06 PM 10/8/2002 +0200, chr.schulz at email.de wrote:
>Hi,
>
>(1.)
>How is it possible to get  automatic a "lower triangle of correlation
>matrix" ?
>
>h.cor <- cor(dat,use="pairwise.complete.obs")
>zz <- lower.tri(h.cor,diag=T)
>### that's not what i wish and "wrong" ?
>results <- matrix(unlist(h.cor[upper.tri(h.cor,diag=T)]))
>results <- matrix(unlist(h.cor[upper.tri(h.cor,diag=T)]),5)

You can use the full correlation matrix for sem -- you don't need to make
the matrix lower triangular; sem accepts a triangular correlation matrix to
make it easier to input correlation matrices directly.

>Must i take the lowest Frequency for the n value in SEM,because n is
>different if
>i have NA's in data and use "pairwise.complete.obs" ?

There's no correct answer to this question. A pairwise-present correlation
matrix may not even be positive definite.

>(2.)
>I'm little confused about the notation for the parameters
>
>compcar and personcar are the independent latent variable mesurementModel
>satisfaction is the unobserved dependend var. what is measure with loyalty
>and i assume here is no error and fix it by 1 .
>
>
>
>h.semModel <- matrix(c(
>+                                    'nemploy -> compcar','lamx11', NA,
>+                                    'sales -> compcar','lamx21', NA,
>+                                    'sex -> personcar','lamx12', NA,
>+                                    'age -> personcar','lamx22',NA,
>+                                    'loyalty -> satisfaction','lamy1',1,
>+                                    'compcar <-> personcar','beta',NA,
>+                                    'compcar -> loyalty','gam1',NA,
>+                                    'personcar -> loyalty','gam2',NA),
>+                                   ncol=3, byrow=TRUE)
>\$
>\$
>\$
>\$      sem.h <- sem(h.semModel,h.sem, 2802,debug=T)

Yes, I can see that this is confused. It's hard to know what the correct
input should be without knowing some more about the model you want to fit,
but maybe the following will help:

(1) Do you intend nemploy and sales to be indicators of compcar? If so, the
arrows are going in the wrong direction.

(2) A similar comment applies to sex and age as indicators of personcar,
but it's hard to imagine that such a specification would make sense.

(3) Note that you require an identifying constraint for the latent
variables, such as setting one of the lambdas for each to 1. Alternatively,
you could set the variance of each of these latent variables to 1.

(4) As things stand, you've specified no variance parameters for the
exogenous latent variables and no error-variance parameter for the
endogenous variable loyalty.

Regards,
John

-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------

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

```