Suppose we are assessing the impact three factors, each with two levels, have on some response $Y$. Let's call the factors $A$ with levels $\{a_1, a_2\}$, $B$ with levels $\{b_1, b_2\}$and $C$ with levels $\{c_1, c_2\}$.
Suppose that first of all we want to determine the 'best' model in R using step-wise regression techniques.
full_model = lm(Y ~ A*B*C)
null_model = lm(Y ~ 1)
forward_model = step(null_model, scope=list(lower=null_model, upper=full_model), direction="forward", k = 2)
backward_model = step(full_model, direction="backward", k = 2)
bidirec_model = step(full_model, direction="both", k = 2)
After running the code suppose that we find that each of the main effects, two-way interactions and three-way interactions are significant. That is, full_model = lm(Y ~ A*B*C)
is our 'best' model.
When add the summary wrapper around full_model
, i.e. summary(full_model)
and run it we get a result like this,
Call:
lm(formula = Y ~ A * B * V)
Residuals:
Min 1Q Median 3Q Max
-5.50 -1.25 0.00 1.50 4.75
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 30.150 1.095 29.801 < 2e-16
a2 11.250 1.548 7.267 2.05e-10
b2 -0.500 1.548 -0.323 0.74754
c2 38.250 1.548 24.708 < 2e-16
.
.
.
a2:b1 5.250 2.189 2.398 0.01879
.
.
.
a2:b1:c1 4.500 3.096 1.453 0.14998
a2:b1:c2 3.250 3.096 1.050 0.29699
.
.
.
('...' represents omitted rows) Note: I just made these values up
My questions are,
Why does $R$ use the factor as a WHOLE (i.e. $A$ instead of $a_1$ and $a_2$, $B$ instead pf $b_1$ etc) in step-wise regression? R instead will exclude the factor as a WHOLE, that is, it will remove $A$ completely from the model rather than just a particular level. Why is this?
When (if at all) should we remove insiginifcant terms from our model obtained with step-wise regression?