I know that somewhere there will exist this kind of question, but I couldn't find it. I have the variables a, b, c, d
and I want to write a loop, such that I regress and append the variables and regress again with the additional variable
lm(Y ~ a, data = data)
, then
lm(Y ~ a + b, data = data)
, then
lm(Y ~ a + b + c, data = data)
etc.
How would you do this?