Skip to content
Prev 165108 / 398503 Next

Noobie question, regression across levels

AllenL wrote:
Potentially slightly confusing to have the same name within the lmfun
function ... I probably would
have written this as

lmfun<-function(dat) {lm(ritFinal~BioFinal+YearFinal,data=dat)}  

but the results would be identical.
lmList (not coef.List) should be a list of lm objects, coef.List is a list
of vectors.
I actually think your confusion is simpler/more fundamental.  If you want
the
first element within the first element of coef.List you actually need
coef.List[[1]][1],
not coef.List[1][1] ... 
You should also consider sapply instead of lapply above, that will give you
a matrix of coefficients (which may be easier to deal with)