To clarify what I mean, let's say we have these two models
fit.1<-lm(Output~Input1)
fit.1.2<-lm(Output~Input1+Input2)
Running anova(fit.1,fit.1.2)
will provide an f-statistic for Input2 and the p-value for it's significance. Running summary(fit.1.2)
will provide a t-statistic for Input1 and Input2 and the p-value for both. My question is why is the p-value for the f-statistic of Input2 in the ANOVA test equal to the p-value of the t-statistic of Input2 in the t-test? Below, I have attempted to include the output.
> anova(fit.1,fit.1.2)
Analysis of Variance Table
Model 1: Output ~ Input1
Model 2: Output ~ Input1 + Input2
Res.Df RSS Df Sum of Sq F Pr(>F)
1 498 185.43
2 497 185.38 1 0.0452 0.1212 0.7279
> summary(fit.1.2.3)
Call:
lm(formula = Output ~ Input1+Input2)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.21480 0.05179 23.458 <2e-16
Input1 0.80116 0.02819 28.423 <2e-16
Input2 0.00970 0.02787 0.348 0.728