You should also need coefficients for your error terms.

On Jul 21, 2009, at 12:36 AM, Stein, Luba (AIM SE) wrote:

Hello Jarrett,

Thank you very much indeed for your help. I could solve my problem and you were right that I had to choose the connections in the model right.
Thus the entry
model <- specify.model()
Z -> M, z1, NA
Z -> USM, z2, NA
Z -> R, z3, 1
M <-> M
USM <-> USM
R <-> R
Z <-> Z

works and gave me moreover a really good fit.

So thank you for your support once again.

Best wishes,
Luba







-----Urspr?ngliche Nachricht-----
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] Im Auftrag von Stein, Luba (AIM SE)
Gesendet: Dienstag, 21. Juli 2009 09:13
An: Jarrett Byrnes
Cc: r-help@r-project.org
Betreff: Re: [R] Another SEM question

Hello,

Perhaps this is a good point. I use the Eclipse platform. The problem was that when I first used the structure Z -> M, z1, NA the compiler took only the value Z ->M. Thus I erased it totally.
Maybe it is really an Eclipse problem.

Do you know how to solve this difficulty?

Thanks for all your support,
Luba






-----Urspr?ngliche Nachricht-----
Von: Jarrett Byrnes [mailto:byr...@msi.ucsb.edu]
Gesendet: Dienstag, 21. Juli 2009 09:01
An: Stein, Luba (AIM SE)
Cc: r-help@r-project.org
Betreff: Re: AW: [R] Another SEM question

Ah, the larger problem is in how you specify your model.  You provide
no parameter names, nor starting estimates (even an NA).  See the sem
help file for an example.  Basically, it must look something like as
follows


model <- specify.model()
Z -> M, zm, NA
Z -> I, zi, NA

etc.


On Jul 20, 2009, at 11:37 PM, Stein, Luba (AIM SE) wrote:


Hi,


            [,1]          [,2]          [,3]
[1,]  4.820719e-03 -5.558801e-05 -5.718939e-05
[2,] -5.558801e-05  4.763194e-06 -7.661872e-06
[3,] -5.718939e-05 -7.661872e-06  1.662150e-03

This is mod.cov. It is the covariance matrix of (R, I, M).
R, I and M are vectors of length 109 which are contained in the file
data4.csv.

As far as I understood the package sem. I consider R, I and M as the
external veriables and Z as the latent variable which I will receive
as an result after calculating the estimated errors and parameters.
This is what atually is missing in the output.
Moreover, the output provides the information about the quality of
the fitted model. I have to admit that this model does not fit quite
well.
Nevertheless, it should provide the estimated errors like it does
just for the first variable Z ->M.

Thanks a lot for your help,
Luba


-----Urspr?ngliche Nachricht-----
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] Im Auftrag von Jarrett Byrnes
Gesendet: Dienstag, 21. Juli 2009 08:19
An: Stein, Luba (AIM SE)
Cc: r-help@r-project.org
Betreff: Re: [R] Another SEM question

You don't appear to be defining Z here.

Might that be the problem?

Or, I, M, and R may not be defined either.  It is unclear.  What does
mod.cov look like?

On Jul 20, 2009, at 11:11 PM, Stein, Luba (AIM SE) wrote:

Thank you for your advice. So I am sending the whole code

data.dir <- file.path(home.dir, "Data")
file     <- file.path(data.dir, "data4.csv")

SEM <- read.csv(file)
print(SEM)

library(sem)
SEM1 <- as.matrix(cbind(SEM$R1, SEM$I1, SEM$M1))
print(SEM1)
mod.cov <- cov(SEM1)
print(mod.cov)

I <- SEM$I1
M <- SEM$M1
R <- SEM$R1

model <- specify.model()
Z -> M
Z -> I
Z -> R
M <-> M
I <-> I
R <-> R
Z <-> Z

sem.mod <- sem(model, mod.cov, N=109)
summary(sem.mod)



All vectors have a length of 109.


Thank you for your help once again.

Best wishes,
Luba



-----Urspr?ngliche Nachricht-----
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] Im Auftrag von Jarrett Byrnes
Gesendet: Montag, 20. Juli 2009 18:25
An: Stein, Luba (AIM SE)
Cc: r-help@r-project.org
Betreff: Re: [R] Another SEM question

Luba,

If you could provide the code you ran, perhaps the listserv can be of
help.

On Jul 20, 2009, at 7:55 AM, Stein, Luba (AIM SE) wrote:

Hello,

I use the function sem the following way
sem.mod <- sem(model, mod.cov, N=109) where the variables are
modelled:

Z -> M
Z -> I
Z -> R
M <-> M
I <-> I
R <-> R
Z <-> Z

The output is
...

Normalized Residuals
Min. 1st Qu. Median Mean 3rd Qu. Max.
-7.3300 -0.2750 -0.2670 -0.1290 -0.0369 9.0300

Parameter Estimates
Estimate Std Error z value Pr(>|z|)
0.0021625 0.00017037 12.693 0 M <--- Z

Iterations = 13


In "Structural Equation Modeling With the sem Package in R" by John
Fox is stated that there should be an output for each external
variable.

Where is my fault, that I receive the output only for the first
variable?


Thanks for your help,
Luba





        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to