# [R] sem (lisrel) - starting problems

chr.schulz@email.de chr.schulz at email.de
Tue Oct 8 17:06:18 CEST 2002

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)

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" ?

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

christian

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)

observed variables:
[1] "1:nemploy" "2:sales"   "3:sex"     "4:age"     "5:loyalty"

latent variables:
[1] "6:compcar"      "7:personcar"    "8:satisfaction"

parameters:
[1] "1:lamx11" "2:lamx21" "3:lamx12" "4:lamx22" "5:lamy1"  "6:beta"
[7] "7:gam1"   "8:gam2"

RAM:
heads to from parameter start
[1,]     1  6    1         1    NA
[2,]     1  6    2         2    NA
[3,]     1  7    3         3    NA
[4,]     1  7    4         4    NA
[5,]     1  8    5         5     1
[6,]     2  7    6         6    NA
[7,]     1  5    6         7    NA
[8,]     1  5    7         8    NA
Error in solve.default(C[ind, ind]) : singular matrix `a' in solve

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