3
$\begingroup$

I'm just approaching to the regression model analysis in R software. I would like to ask some particulars about the difference between the anova test used to compare models and the simple summary command. I explain you what I mean.

I have a datasets and I have to estimate a linear regression between a response and one or probably many predictors. In order to analyse the significance of each variable I usually start from the summary, after having build my model with lm and the output tells me which predictor is significant through the p-value and the significance stars.

Proceeding in this way, when I should use the anova test? Since I can already check the significance through the summary, why should I build another model with different variables and then perform anova?

What I am really asking is: when I should use summary and when anova and what are the conclusion I can obtain from them in the prospective of my analysis? Remember that my final goal is to build the best model for the description of the regression.

$\endgroup$
1
  • $\begingroup$ Welcome to CV. Note that this site is not intended as a resource for software specific or programming questions. For instance, I'm not an R user and don't know anything about the summary command. It would be helpful if you were to generalize your question about the summary command vs ANOVA by removing the R references and describing more generally what it is you think they do. $\endgroup$
    – user78229
    Commented Apr 1, 2016 at 13:23

1 Answer 1

2
$\begingroup$

Probably I know what you mean, but at first, I present what I concluded from your question. You have single quantitive response (DV) variable Y and several independent variables (IV) / predictors, e.g. A, B. I assume you're asking inter alia what's the difference between these two approaches:

  • anova(lm(Y ~ A * B, data=my_data))

    From anova(stats)

  • summary(lm(Y ~ A * B, data = my_data)) or to get coefficients

    printCoefmat(summary(lm(Y ~ A * B, data = my_data)))$coefs

    From summary.lm(stats)

Probably you're trying to test the significance of additive effects of those IVs.

Below I'm using the R convention:

  • Y ~ 1 - empty model only with the mean
  • A:B - only interaction between A and B
  • A * B - adds both of the IVs A and B as well as their interaction A:B

The first case (anova) is Test I type or sequential and you're comparing bigger and bigger models, starting from an empty model (with only mean). In this case the order of IVs is important:

For Y ~ A * B you're goint to compare such models:

  • Y ~ 1 versus Y ~ 1 + A
  • Y ~ 1 + A versus Y ~ A + B
  • Y ~ 1 + A + B versus Y ~ 1 + A + B + A:B

Watch out Here, the order is important: Y ~ A * B and Y ~ B * A will lead to different tests.

In the second case (summary) you're comparing the full model and almost full model without effect of particular IV. That is called Test III type or marginal. For Y ~ A * B are performed three tests comparing these pairs of models (the second in each pair is always full):

  • Y ~ 1 + A + A:B versus Y ~ 1 + A + B + A:B

  • Y ~ 1 + B + A:B versus Y ~ 1 + A + B + A:B

  • Y ~ 1 + A + B versus Y ~ 1 + A + B + A:B


The most important part

If you're using Test III type / marginal with full model Y ~ A * B, that is Y ~ A + B + A:B you would knock out only one factor at a time, so if you knock out A you leave the interaction A:B, so an influence from A isn't deleted completly.

ANOVA is all about comparing two models. You can literally compare any two models in the following manner: model1 = lm(Y ~ A * C, data = my_data) model2 = lm(Y ~ A * B * C, data = my_data) anova(model1, model2) Here, I compared the model with all IVs with a model without B and its interactions with diffrent IVs (e.g. A:B or C:B), (but interaction A:C holds). Probably, you cannot do that with summary.

$\endgroup$
2
  • $\begingroup$ I get it what you're saying and you have understood what approaches I was talking about. Essentially what I'm interested in is where I can find information useful in the decision whether to delete or not a predictor. I start the analysis fitting a model with all the predictors, then through summary approach (looking at the p-value) I check which predictor is less significant for my model and possibly delete it. From here, what contribution might bring an anova test? May I compare the initial model (all predictors) with the second one (with some of them deleted)? $\endgroup$ Commented Apr 1, 2016 at 15:00
  • $\begingroup$ Using ANOVA you're able to test literally any two models like Y ~ A * C against Y ~ A * B * C, whereas with summary you delete only one compound. Summary applied to Y ~ A * B * C could delete B, but it leaves B's interactions, e.g A:B and B:C, thus influence fom B isn't deleted completly (look at the edited answer). $\endgroup$ Commented Apr 1, 2016 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.