[R] How can I index multiple linear models? (Without getting a warning.)
BSanders
adam at mycostech.com
Tue Feb 1 07:25:18 CET 2011
My code looks like this:
lin = NA
for(i in 1:15){
lin[i] = lm(reservesub[,3]~ reservesub[,i+3])
}
For which I'm given 15 warning messages which say :
"1: In lin[i] = lm(reservesub[, 3] ~ reservesub[, i + 3]) :
number of items to replace is not a multiple of replacement length"
I'm am able to generate the 15 different models and get the coefficients. I
am able to access
each coefficient, for example , the slope of the third model can be called
using lin[[3]][2], which is helpful, but none of the other objects that go
along with the linear model, like residuals, are accessible (for me.)
I feel like I'm missing something kind of fundamental here, but I can't put
my finger on it.
Thanks in advance.
Barry Sanders.
--
View this message in context: http://r.789695.n4.nabble.com/How-can-I-index-multiple-linear-models-Without-getting-a-warning-tp3250535p3250535.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list