I found that it was easiest to just pull out the parts I want with an
"apply" loop.
Here I am regressing a bunch of equity returns on some index returns and
just keeping the coefficients:
EqCoefQ1 = apply(retEqQ1,2,
function(x) summary(lm(x~retIndexQ1))$coefficients)
On Tue, Jul 21, 2009
My guess is that you did not define the list correcly before making
any assignments to it. Try something like
> myResults <- vector("list", 16)
and then your code
> myResults[1] <- lm(...)
> myResults[2] <- lm(...)
> myResults[3] <- lm(...)
...
> myResults[15] <- lm(...)
> myResults[16] <- lm(
..@imail.org
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Idgarad
> Sent: Tuesday, July 21, 2009 10:28 AM
> To: r-help@r-project.org
> Subject: [R] list of lm() results
>
> How can I ge
On Jul 21, 2009, at 12:27 PM, Idgarad wrote:
How can I get the results of lm() into a list so I can loop through
the results?
e.g.
myResults[1] <- lm(...)
myResults[2] <- lm(...)
myResults[3] <- lm(...)
...
myResults[15] <- lm(...)
myResults[16] <- lm(...)
so far every attempt I've tried d
You could look at ?lmList in package lme ...
>>> Idgarad 21/07/2009 17:27:52 >>>
How can I get the results of lm() into a list so I can loop through the
results?
e.g.
myResults[1] <- lm(...)
myResults[2] <- lm(...)
myResults[3] <- lm(...)
...
myResults[15] <- lm(...)
myResults[16] <- lm(...)
How can I get the results of lm() into a list so I can loop through the results?
e.g.
myResults[1] <- lm(...)
myResults[2] <- lm(...)
myResults[3] <- lm(...)
...
myResults[15] <- lm(...)
myResults[16] <- lm(...)
so far every attempt I've tried doesn't work throwing a "number of
items to replace
6 matches
Mail list logo