[R] SEM raw moment matrix

John Fox jfox at mcmaster.ca
Sat Nov 24 16:12:52 CET 2012


Dear Maya,

I think that what you've done should work fine, though I'm not sure why you created your own UNIT variable rather than allowing sem() to generate the constant.

Best,
 John

On Sat, 24 Nov 2012 10:33:50 +0200
 Maya Abou Zeid <ma202 at aub.edu.lb> wrote:
> Dear John,
> 
> Many thanks for your response.
> I'd just still like to double check that I have indeed used the raw moment matrix method correctly in sem. In my model, some equations are in deviations form and have no intercept, while some have intercept.
> 
> 
> sem.QT.1 <- sem(mod.QT.1, data=QTrav, formula = ~ X1 + X2 + .... + UNIT -1, fixed.x=c('X1','X2',...,'UNIT'), raw=TRUE)
> 
> where UNIT is a variable equal to 1 which I appended to the dataset. I used UNIT multiplied by a constant in the model equations that require an intercept.
> 
> I mainly wanted to check if the above specification of formula, with -1 written after UNIT, is correct. The model runs fine.
> 
> Thank you,
> Maya
> 
> 
> -----Original Message-----
> From: John Fox [mailto:jfox at mcmaster.ca] 
> Sent: Friday, November 23, 2012 2:39 PM
> To: Maya Abou Zeid
> Cc: r-help at r-project.org
> Subject: Re: [R] SEM raw moment matrix
> 
> Dear Maya,
> 
> sem() computes the fit statistics that I know how to compute for a model fit to a raw moment matrix. If you know how to compute the others (and if they're defined), then you could do that youself using the object returned by sem().
> 
> I'm not sure why you want the likelihood under the model in addition to the model chisquare, but you can get the *log*-likelihood from logLik(your.model).
> 
> Finally, you don't have to compute the raw moment matrix in a separate step (if you in fact did that) if you have the original data -- you can use the data argument to sem().
> 
> I hope this helps,
>  John
> 
> ------------------------------------------------
> John Fox
> Sen. William McMaster Prof. of Social Statistics
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada
> http://socserv.mcmaster.ca/jfox/
> 	
> On Fri, 23 Nov 2012 00:33:51 +0200
>  Maya Abou Zeid <ma202 at aub.edu.lb> wrote:
> > Hello,
> > 
> > I estimated a model using SEM package in R, which was fit to a raw moment matrix, and includes an intercept term. The only goodness of fit statistics that are output are Model Chisquare, AIC, AICc, BIC, CAIC, and normalized residuals.
> > 
> > How can I get the other goodness of fit statistics, like adjusted goodness of fit, RMSEA, and R-squared? And how can I get the final value of the log-likelihood of the model?
> > 
> > Thanks,
> > Maya
> > 
> > 	[[alternative HTML version deleted]]
> > 
> > ______________________________________________
> > R-help at 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.




More information about the R-help mailing list