[R] Organize regression output
francesca Pancotto
francesca.pancotto at gmail.com
Sat Dec 10 08:32:48 CET 2016
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$coefficients
and i obtain
(Intercept) coeff1 coeff2 age gender
0.62003033 0.00350807 -0.03817848 -0.01513533 -0.18668972
and I know that ra$coefficients[1] would give me the intercept of this model.
What i need to do is to collect the coefficients of each regression in models, and calculate and place in a table, the following simple summation:
ra rb rc ...
intercept intercept intercept
intercept+coeff1 intercept+coeff1 intercept+coeff1
intercept+coeff2 intercept+coeff2 intercept+coeff2
intercept+coeff1+coeff2 intercept+coeff1+coeff2 intercept+coeff1+coeff2
The calculations are trivial(I know how to do it in steps) but what is difficult for me is to invent a procedure that organizes the data in an efficient way.
I tried some step , starting with collecting the coefficients but i think I am going the wrong way
calcolati <- list()
for (i in c(ra,rb,rc,rd,re,rf,rg,rh))
{
calcolati[[i]] <- i$coefficients[1]
}
Thanks for any help you can provide.
f.
----------------------------------
Francesca Pancotto
Web: https://sites.google.com/site/francescapancotto/ <https://sites.google.com/site/francescapancotto/>
Energie:
http://www.energie.unimore.it/ <http://www.energie.unimore.it/>
----------------------------------
[[alternative HTML version deleted]]
More information about the R-help
mailing list