Hi Francesca,
I'm not sure what you are doing here, but try this:
regnames<-paste("r",letters[1:8],sep="")
for(i in 1:8) {
response<-rnorm(20)
coef1<-rnorm(20)
coef2<-rnorm(20)
age<-sample(20:50,20)
gender<-sample(c("M","F"),20,TRUE)
assign(regnames[i],lm(response~coef1+coef2+age+gender))
}
Francesca:
It is hard to know what you might mean by "organize the results in an
efficient way." Some would say that a list of models already does this
for you.
The task you described is fairly simple, so I believe you would
benefit by going through an R tutorial or two to improve your R
programm
Dear Francesca
i usually do this by collecting the models into a list not a vector
model <- list(ra = ra, rb = rb, and so on
and then I use lapply or sapply to process the model
lapply(mode, function(x) coef(x)[1])
or something like that, not tested
On 10/12/2016 07:32, francesca Pancotto wr
Dear Contributors
I would like to ask some help concerning the automatization process of an
analysis, that sounds hard to my knowledge.
I have a list of regression models.
I call them models=c(ra,rb,rc,rd,re,rf,rg,rh)
I can access the output of each of them using for example, for the first
ra$
4 matches
Mail list logo