[R] Organize regression output

Bert Gunter bgunter.4567 at gmail.com
Sat Dec 10 12:57:21 CET 2016


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
programming skills. There are many good ones on the Web. That would
probably be a better long term strategy for you than posting basic
questions here.

Cheers,
Bert




Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Dec 9, 2016 at 11:32 PM, francesca Pancotto
<francesca.pancotto at gmail.com> wrote:
> 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]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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