[R] "save scores" from sem

John Fox jfox at mcmaster.ca
Mon Mar 18 15:36:08 CET 2013


Dear Marko,

I can't quite tell whether this is an original question (as suggested by no "Re:" in the subject field and no text from an earlier message) or an answer to a question already posed (as suggested by the phrasing of the message); if the latter, I apologize for missing the original question.

In any event, see the fscore() function in the sem package (?fscore) for computation of factor scores.

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 Mon, 18 Mar 2013 13:21:48 +0100
 marKo <mtoncic at ffri.hr> wrote:
> I'm not aware of any routine that those the job, although I think that it could be relatively easily done by multiplication the manifest variable vector with the estimates for the specific effect.
> To make an example:
> 
> v1; v2; v3; v4 are manifest variables that loads on one y latent variablein a data frame called "A"
> the code for the model should be like:
> model <-specifymodel(
> y -> v1, lam1, NA
> y -> v2, lam2, NA
> y -> v3, lam3, NA
> y -> v4, lam4, NA
> 
> After fitting the model with sem
> 
> model.sem <- sem(model, data=A)
> 
> you should be able to compute the y variable like:
> attach(data)
> data$y<-v1*lam1+v2*lam2+v3*lam3+v4*lam4 #change the loading name with the actual loading (number) or extract them from the objectiveML object (they are located in model.sem[[15]])
> 
> Note that those loadings are unstandardized and that the resulting variable will not be standardized.
> 
> Hope it helps
> 
> Regards,
> 
> Marko
> 
> 
> 
> --
> Marko Ton?i?
> Assistant Researcher
> University of Rijeka
> Faculty of Humanities and Social Sciences
> Department of Psychology
> Sveu?ilišna Avenija 4, 51000 Rijeka, Croatia
> 
> ______________________________________________
> 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