Dear George, It's not entirely clear to me what you're trying to do, and where the loop comes in.
As has already been suggested, you can store the model specification in a file or files. Also, the "RAM" form of the model can be specified as a character matrix, a numeric matrix, or a "semmod" object. These are documented in ?sem. You could look at the internal structure of a "semmod" object produced by specifyEquations() or specifyModel() to see how it works. I hope that this helps, John ------------------------------------------------ John Fox, Professor McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ On Wed, 4 Jun 2014 15:45:44 +0100 George Parish <george_par...@hotmail.co.uk> wrote: > Dear all, > I am trying to create multiple SEM models in a loop - so that if I change the > data they can easily be re-created rather than re-creating each RAM model > line by line - therein lies my problem. > I have a dataframe set out as follows1 Duration -> RC1 > cov1 -0.2563002 MMSE -> RC1 cov2 -0.0309003 > RC1 -> Aggression npi1 0.2310004 RC1 -> > Apathy npi2 0.1043005 RC1 -> Disinhibition npi3 > 0.279800 ... > the specifyModel() and specifyEquations() methods need you to manually input > each line individually. Can I simply supply the SEM method with a matrix like > the one I have above? > Thanks,George > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.