In R stepwise forward regression, I specify a minimal model and a set of variables to add (or not to add):
min.model = lm(y ~ 1)
fwd.model = step(min.model, direction='forward', scope=(~ x1 + x2 + x3 + ...))
Is there any way to specify using all variables in a matrix/data.frame, so I don't have to enumerate them?
Examples to illustrate what I'd like to do, but they don't work:
# 1
fwd.model = step(min.model, direction='forward', scope=(~ ., data=my.data.frame))
# 2
min.model = lm(y ~ 1, data=my.data.frame)
fwd.model = step(min.model, direction='forward', scope=(~ .))