Dear Wei-Wei,
As I explained to you in private email yesterday (perhaps you didn't receive
my reply?), the problem that you point out is due to a bug in the sem
function that I fixed some time ago and then inadvertently reintroduced.
Yesterday, I sent a corrected version of the sem package (0.9-5) to CRAN;
the source package is there now and I'm sure that the compiled Windows
package will appear in due course.
Thank you once more for bringing the problem to my attention.
John
--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox
--------------------------------
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Guo Wei-Wei
> Sent: Monday, September 04, 2006 12:34 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Question on Chi-square of null model in sem package
>
> Dear all,
>
> I met a problem while doing SEM by sem package. I got a
> negative chi-square of null model. Because the theoretical
> value of chi-square cannot be negative, I checked the source
> code of sem.R in sem package and I found the Chi-square of
> null model was computed by the following
> expression:
>
> result$chisqNull <- (N - 1) * (sum(diag(S %*% diag(1/diag(S)))) +
> log(prod(diag(S))))
>
> I think the reason for negative Chi-square is the too small value of
> prod(diag(S)) of my data. I'm working on a data.frame named
> emc.data from a sample of a 16-item questioinnaire. The
> variance of items are
>
> > diag(cov(emc.data))
> EMC1 EMC2 EMC3 EMC4 EMC5 EMC6
> EMC7 EMC8
> 0.3622224 0.2350041 0.2488009 0.2901653 0.3195399 0.3107343
> 0.3436622 0.2345912
> EMC9 EMC10 EMC11 EMC12 EMC13 EMC14
> EMC15 EMC16
> 0.2621680 0.3230400 0.4039245 0.3803105 0.2773370 0.4348342
> 0.2757216 0.3405252
>
> The fit indices of RMSEA and GFI are good, so I think the
> problem might be solve by another way for computing the
> Chi-square of null model. I'm not well trained in maths, so I
> come for help. Any advise is appreciated.
>
> Best wishes,
> Wei-Wei
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.