[R] F test

Emmanuel Charpentier charpent at bacbuc.dyndns.org
Thu Apr 16 20:47:53 CEST 2009


Le jeudi 16 avril 2009 à 14:08 -0300, Mike Lawrence a écrit :
> summary(my_lm) will give you t-values, anova(my_lm) will give you
> (equivalent) F-values.

Ahem. "Equivalent", my tired foot...

In simple terms (the "real" real story may be more intricate....) :

The "F values" stated by anova are something entierely different of t
values in summary. The latter allow you to assess properties of *one*
coefficient in your model (namely, do I have enough suport to state that
it is nonzero ?). The former allows you to assess whether you have
support for stating that *ALL* the coefficient related to the same
factor cannot be *SIMULTANEOUSLY* null. Which is a horse of quite
another color...

By the way : if your "summary" indeed does give you the mean^K^K an
unbiased estimate of your coefficient and an (hopefully) unbiased
estimate of its standard error, the "F" ration is the ratio of estimates
of "remaining" variabilities with and without the H0 assumption it
tests, that is that *ALL* coefficients of your factor of interest are
*SIMULTANEOUSLY* null.

F and t "numbers" will be "equivalent" if and only if your "factor of
interest" needs only one coefficient to get expressed, i. e. is a
continuous covariable or a two-class discrete variable (such as
boolean). In this case, you can test your factor either by the t value
which, under H0, fluctuates as a Student's t with n_res dof (n_res being
the "residual degrees of freedom" of the model) or by the F value, which
will fluctuate as a Fisher F statistic with 1 and n_res dof, which
happens (but that's not happenstance...) to be the *square* of a t with
n_dof.

May I suggest consulting a textbook *before* flunking ANOVA 101 ?

					Emmanuel Charpentier

>  summary() might be preferred because it also
> provides the estimates & SE.
> 
> > a=data.frame(dv=rnorm(10),iv1=rnorm(10),iv2=rnorm(10))
> > my_lm=lm(dv~iv1*iv2,a)
> > summary(my_lm)
> 
> Call:
> lm(formula = dv ~ iv1 * iv2, data = a)
> 
> Residuals:
>     Min      1Q  Median      3Q     Max
> -1.8484 -0.2059  0.1627  0.4623  1.0401
> 
> Coefficients:
>             Estimate Std. Error t value Pr(>|t|)
> (Intercept)  -0.4864     0.4007  -1.214    0.270
> iv1           0.8233     0.5538   1.487    0.188
> iv2           0.2314     0.3863   0.599    0.571
> iv1:iv2      -0.4110     0.5713  -0.719    0.499
> 
> Residual standard error: 1.017 on 6 degrees of freedom
> Multiple R-squared: 0.3161,	Adjusted R-squared: -0.02592
> F-statistic: 0.9242 on 3 and 6 DF,  p-value: 0.4842
> 
> > anova(my_lm)
> Analysis of Variance Table
> 
> Response: dv
>           Df Sum Sq Mean Sq F value Pr(>F)
> iv1        1 1.9149  1.9149  1.8530 0.2223
> iv2        1 0.4156  0.4156  0.4021 0.5494
> iv1:iv2    1 0.5348  0.5348  0.5175 0.4990
> Residuals  6 6.2004  1.0334
> 
> 
> On Thu, Apr 16, 2009 at 10:35 AM, kayj <kjaja27 at yahoo.com> wrote:
> >
> > Hi,
> >
> >
> > How can I find the p-value for the F test for the interaction terms in a
> > regression linear model lm ?
> >
> > I appreciate your help
> >
> >
> > --
> > View this message in context: http://www.nabble.com/F-test-tp23078122p23078122.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> 
> 
> 




More information about the R-help mailing list