I have this output from R that I'm trying to understand.

I would gladly appreciate any help!

Model 1: y ~ x + w + x:w
Model 2: y ~ x + w
  Res.Df      RSS Df Sum of Sq      F  Pr(>F)  
1     40 13452999                              
2     41 14759878 -1  -1306879 3.8858 0.05564 .

I should add that I'm a novice at using R and from what I can see:


Numerator $df=0$

Denominator $df=-1$

Can a df be negative ?

Why would my $F$ and be on the last line?

Is it technically correct if I say that my $p$-val$= 0.05564$


The above R code gives me nothing coherent.

This is a test to assert the importance of $\beta_3$ in the model

  • 1
    $\begingroup$ The documentation of the function ANOVA in R says "It is conventional to list the models from smallest to largest, but this is up to the user." I think that answers one of my questions. $\endgroup$ – Mahamad A. Kanouté Sep 19 at 22:43
  • $\begingroup$ What questions remain? $\endgroup$ – Peter Flom - Reinstate Monica Sep 20 at 13:04
  • $\begingroup$ Why would F be on the last line ? Is it customary to R ? $\endgroup$ – Mahamad A. Kanouté Sep 20 at 15:38

This is the output of a call to anova() to compare two models, one with the term x:w and one without. The null hypothesis is that the model without x:w fits better.

This is a $1$-$df$ test. The numerator $df = 1$ and the denominator $df = 40$. The code to compute the p-value would be 1-pf(3.8858,1,40), which does indeed give $0.05564$. Becuase $p>.05$, there is not enough evidence to reject the null hypothesis at a $.05$ significance level. The x:w term doesn't significantly add to the model given the data you observed. Note that this p-value should be exactly equal to the p-value on the coefficient of $\beta_3$ if x and w are numeric because the test for whether $\beta_3=0$ is identical to the model comparison test you just performed.

$F$ is on the last line because that's a logical place for it to be to keep the output compact.

  • $\begingroup$ What's your truck for choosing the df ? I see 41 and 40 how do you know which one to pick ? $\endgroup$ – Mahamad A. Kanouté Sep 20 at 15:40
  • $\begingroup$ This technique has probably been described in statistics textbooks, which would tell you the formula. I figured it out by seeing which df gave me the p-value produced by the test. $\endgroup$ – Noah Sep 20 at 16:08
  • $\begingroup$ Gotcha ! Indeed I do remember it but it's a bit confusing here as I see Res.Df and Df . Thank you anyway ! $\endgroup$ – Mahamad A. Kanouté Sep 20 at 16:18

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