[R] Help with SEM package - model significance
John Fox
jfox at mcmaster.ca
Mon Jun 16 13:40:06 CEST 2014
Dear Bernardo,
The df for the LR chisquare over-identification test come not from the number of observations, but from the difference between the number of observable variances and covariances, on the one hand, and free parameters to estimate, on the other. In your case, these numbers are equal, and so df = 0. The LR chisquare for a just-identified model is also necessarily 0: the model perfectly reproduces the covariational structure of the observed variables.
R (and most statistical software) by default writes very small and very large numbers in scientific format. In your case, -2.873188e-13 = -2.87*10^-13, that is, 0 within rounding error. You can change the way numbers are printed with the R scipen option.
Some other observations:
(1) Your model is recursive and has no latent variables; you would get the same estimates from OLS regression using lm().
(2) For quite some time now, the sem package has included specifyEquations() as a more convenient way of specifying a model, in preference to specifyModel(). See ?specifyEquations.
(3) You don't have to specify the error variances directly; specifyEquations(), or specifyModel(), will supply them.
I hope this helps,
John
------------------------------------------------
John Fox, Professor
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/
On Sun, 15 Jun 2014 20:15:31 -0700 (PDT)
Bernardo Santos <bernardo_brandaum at yahoo.com.br> wrote:
> Dear all,
>
> I used "sem" function from the package SEM to fit a model. However, I cannot say if the model is correspondent to the data or not (chisquare test).
> I used the commands:
>
> model1 <- specifyModel()
> estadio -> compflora, a1, NA
> estadio -> compfauna, a2, NA
> estadio -> interacoesobs, a3, NA
> compflora -> compfauna, b1, NA
> compflora -> interacoesobs, b2, NA
> compfauna -> interacoesobs, c1, NA
> estadio <-> estadio, e1, NA
> compflora <-> compflora, e2, NA
> compfauna <-> compfauna, e3, NA
> interacoesobs <-> interacoesobs, e4, NA
>
> sem1 <- sem(model1, cov.matrix, length(samples))
> summary(sem1)
>
> and I got the result:
>
> Model Chisquare = -2.873188e-13 Df = 0 Pr(>Chisq) = NA AIC = 20 BIC = -2.873188e-13 Normalized Residuals Min. 1st Qu. Median Mean 3rd Qu. Max.
> 0.000e+00 0.000e+00 2.957e-16 3.193e-16 5.044e-16 8.141e-16 R-square for Endogenous Variables compflora compfauna interacoesobs 0.0657 0.1056 0.2319 Parameter Estimates Estimate Std Error z value Pr(>|z|)
> a1 3.027344e-01 1.665395e-01 1.81779316 6.909575e-02 compflora <--- estadio
> a2 2.189427e-01 1.767404e-01 1.23878105 2.154266e-01 compfauna <--- estadio
> a3 7.314192e-03 1.063613e-01 0.06876742 9.451748e-01 interacoesobs <--- estadio
> b1 2.422906e-01 1.496290e-01 1.61927587 1.053879e-01 compfauna <--- compflora
> b2 3.029933e-01 9.104901e-02 3.32780446 8.753328e-04 interacoesobs <--- compflora
> c1 4.863368e-02 8.638177e-02 0.56300857 5.734290e-01 interacoesobs <--- compfauna
> e1 6.918133e+04 1.427102e+04 4.84767986 1.249138e-06 estadio <--> estadio
> e2 9.018230e+04 1.860319e+04 4.84767986 1.249138e-06 compflora <--> compflora
> e3 9.489661e+04 1.957568e+04 4.84767986 1.249138e-06 compfauna <--> compfauna
> e4 3.328072e+04 6.865289e+03 4.84767986 1.249138e-06 interacoesobs <--> interacoesobs Iterations = 0
>
> I understand the results, but I do not know how to interpret the first line that tells me about the model:
> Model Chisquare = -2.873188e-13 Df = 0 Pr(>Chisq) = NA
>
> How can DF be zero, if the number of observations I used in sem funcition was 48 and I have only 4 variables? What is the p value?
>
> Thanks in advance.
> Bernardo Niebuhr
> [[alternative HTML version deleted]]
>
More information about the R-help
mailing list