I like to extract the coefficients and standard errors of each lm object and combine them into a data.frame with NA fill in for the missing predictors.
set.seed(12345)
x<-matrix(rnorm(1000),nrow=100,ncol=10)
colnames(x)<-paste("x",1:10,sep="")
df<-data.frame(y=rnorm(100),x)
m1<-vector('list', 10)
for ( i in 2:11){
eqn <- as.formula(paste("y ~", paste(colnames(df)[2:i], collapse='+')))
m1[[i-1]] <- lm(eqn, df)
}
Any suggestions would be much appreciated!
This should do the trick:
Edit:
To collect the standard errors into a similar structure, just do something like this: