如何使R吐出基于ANOVA的F统计量的临界值? [英] How do I get R to spit out the critical value for F-statistic based on ANOVA?

查看:166
本文介绍了如何使R吐出基于ANOVA的F统计量的临界值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

R中的ANOVA分析缺少的一件事是它不会自动显示临界值.一切都给定了.我可以说我的F值比应该的高得多,但是我想知道截止点的边距.有一个在线计算器可以根据自由度得出F统计的临界值,但我希望R做到这一点. http://www.danielsoper.com/statcalc/calculator.aspx?id=4

The one thing missing from an ANOVA analysis in R is that it doesn't automatically display the critical value. Everything else is given. I can tell that my F-value is way higher than it should be, but I want to know the margin at where the cut-off is. There's this online calculator that yields the critical value for F statistics based on the degrees of freedom, but I want R to do this. http://www.danielsoper.com/statcalc/calculator.aspx?id=4

我该怎么做?

示例:

>anova(anovaModel.model1)
                          Df  Sum Sq   Mean Sq F value    Pr(>F)    
data$SIZE    4 0.1193 0.027926  22.056 4.55e-16 ***
Residuals               1372 1.994 0.001352            
>F(variance.mod1)    #??
>F(4,1372 )          #Something like this?

推荐答案

尝试一下:

mylm <- lm(wt~mpg, data = mtcars)
myanova <- anova(mylm)
cbind(myanova, 'CriticalValue' = qf(1-.05, myanova[1,1], myanova[2,1]))

          Df    Sum Sq    Mean Sq  F value       Pr(>F) CriticalValue
mpg        1 22.343135 22.3431348 91.37533 1.293959e-10      4.170877
Residuals 30  7.335613  0.2445204       NA           NA      4.170877

在这种情况下,qf函数是您的朋友.

The qf function is your friend in this case.

alpha = .05
qf(1-alpha, myanova[1,1], myanova[2,1])

[1] 4.170877

这篇关于如何使R吐出基于ANOVA的F统计量的临界值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆