[R] F test

Mike Lawrence Mike.Lawrence at dal.ca
Thu Apr 16 19:08:47 CEST 2009


summary(my_lm) will give you t-values, anova(my_lm) will give you
(equivalent) F-values. 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.
>



-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

Looking to arrange a meeting? Check my public calendar:
http://tr.im/mikes_public_calendar

~ Certainty is folly... I think. ~




More information about the R-help mailing list