[R] Running different Regressions using for loops

Gerrit Eichner Gerrit.Eichner at math.uni-giessen.de
Fri Sep 28 11:36:20 CEST 2012


Hello, Krunal,

try

> summ.list[[2]]$coefficients[2]

Note the double square brackets (as summ.list is a list)!

Hth,

Gerrit


On Fri, 28 Sep 2012, Krunal Nanavati wrote:

> Hi Rui,
>
> Excellent!!  This is what I was looking for. Thanks for the help.
>
> So, now I have stored the result of the 10 regressions in      "summ.list
> <- lapply(lm.list2, summary)"
>
> And now once I enter        " sum.list "....it gives me the output for all
> the 10 regressions...
>
> I wanted to access a beta coefficient of one of the regressions....say
> "Price2+Media1+Trend+Seasonality"...the result of which is stored in     "
> sum.list[2] "
>
> I entered the below statement for accessing the Beta coefficient for
> Price2...
>
>> summ.list[2]$coefficients[2]
> NULL
>
> But this is giving me " NULL " as the output...
>
> What I am looking for, is to access a beta value of a particular variable
> from a particular regression output and use it for further analysis.
>

<<<snip>>>




More information about the R-help mailing list