Sunday, March 16, 2014

How to calculate a p-value for an ANOVA F-Statistic using R or a TI-84

At the end of calculating an Analysis of Variance (ANOVA), you have an F-statistic.  To get the p-value of the F-Statistic, you can use R or the TI-84:

For example, in an ANOVA with treatment degrees of freedom = 1 and error degrees of freedom = 10, you calculate the F-Statistic as 2.81 and want to know its p-value (that is, what is the probability of observing this F-Statistic under the Null Hypothesis?):

1) R
# The following calculates the p-value of an F-statistic
pf(q=2.81, df1=1, df2=10, lower.tail=FALSE)

 You'll get the answer:
[1] 0.1246126

2) TI-84
The syntax for the Fcdf command is:
Fcdf(lower limit, upper limit, numerator degrees of freedom, denominator degrees of freedom).
Fcdf(2.81, 99999, 1, 10)
 You'll get the answer:
[1] 0.1246126

I'm a student in the MS in Applied Statistics program and the University of the District of Columbia.

2 comments:

  1. Thanks! It's always hard to find R help online, but this helped me answer part of a HW assignment

    ReplyDelete
  2. Dear Timothy,

    I hope you can help!

    I have a model that reports as per summary below.

    I need to obtain the F Statistic and Degrees of freedom values? How do I get these from this summary or per command?

    > summary(modelnp)

    Call:
    lm(formula = data2, data = data2)

    Residuals:
    Min 1Q Median 3Q Max
    -0.91777 -0.28089 0.03571 0.23273 0.82883

    Coefficients:
    Estimate Std. Error t value Pr(>|t|)
    (Intercept) 10.572610 8.862711 1.193 0.238760
    Roi9 -0.105219 0.042237 -2.491 0.016244 *
    Roi14 0.199637 0.033340 5.988 2.62e-07 ***
    Roi38 0.023947 0.006492 3.689 0.000574 ***
    Roi39 -0.012495 0.003821 -3.270 0.001991 **
    Roi42 0.045623 0.018258 2.499 0.015940 *
    Roi44 -0.027964 0.018030 -1.551 0.127476
    Roi47 -0.133500 0.026998 -4.945 9.73e-06 ***
    ---
    Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

    Residual standard error: 0.3872 on 48 degrees of freedom
    Multiple R-squared: 0.7737, Adjusted R-squared: 0.7407
    F-statistic: 23.44 on 7 and 48 DF, p-value: 1.792e-13

    ReplyDelete

I moderate comments blog posts over 14 days old. This keeps a lot of spam away. I generally am all right about moderating. Thanks for understanding.