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 .
thanks for advance
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 Hamilton, Ontario, Canada L8S 4M4 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
hello john, (1) Do you intend nemploy and sales to be indicators of compcar? If so, the arrows are going in the wrong direction. ..yes, is lamx1 etc. correct for this part and lamy1 etc. for the latent y-variable ? (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. .....this is first an easy example with my data , but why you think it is nonsense that age and sexual status are indicators for a latent variable personalCharacteristics (...of course the scale's should be approriate ?) Many thanks for your comments ! christian -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._