Re: [R] Question on Chi-square of null model in sem package
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Guo Wei-Wei Sent: Monday, September 04, 2006 12:34 AM To: r-help@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.364 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@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. __ R-help@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.
Re: [R] Question on Chi-square of null model in sem package
Dear Pref. Fox Sorry, I didn't receive your reply. I try the new sem package. It's great. The following is the results that I got. The fit indices are fine. Model Chisquare = 208 Df = 98 Pr(Chisq) = 6.6e-10 Chisquare (null model) = 1741 Df = 120 Goodness-of-fit index = 0.9 Adjusted goodness-of-fit index = 0.87 RMSEA index = 0.066 90 % CI: (0.054, 0.079) Bentler-Bonnett NFI = 0.88 Tucker-Lewis NNFI = 0.92 Bentler CFI = 0.93 BIC = -336 Thank you very much. You help me out so many problems. Best wishes, Wei-Wei 2006/9/4, John Fox [EMAIL PROTECTED]: 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 __ R-help@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.
[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.364 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@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.