I'm developing a regression algorithm for predicting the future value each day ahead, from days 1 through n. The dataset I'm working with has over 100 variables.
When I run the regression for Future Day 1, variables b, c, and d may be significant and kept in, but running for Day 3 variables c, f, and g may be the ones kept.
I'm looking for a way to have output that will take the regression coefficients, as well as the RSE for whichever model is being predicted on.
Ideally, the output would be be able to bind / merge (I apologize for wrong terminology) to look a little like this.
Future_1 Future_2 Future_3
RSE 1.32 1.54 1.85
Intercept 1 1.2 1.4
A
B 1.2
C 1.3 1.43 1.5
D 1.5 1.4
E
F 1.9
G -2.1 1.2
H -1.3
i <- 1
for( i in 1:10) {
modeldata <- na.omit(AAPL[,c(1:3,5,6+i,17:ncol(AAPL))])
formula <- lm(paste("modeldata$Future_",i," ~ .", sep=""), data = modeldata)
#Modelling
model.Everything <- stepAIC(formula,
steps=10000, direction="both", validation = "CV", k=3.5)
coeff <- model.Everything$coefficients
rse <- sigma(model.Everything)
i <- i + 1
}