F-test Using R

蝎子 发表于 2008-01-16 01:22:21

F Test to Compare Two Variances

Usage:
var.test(x, ...)
The default setting:
var.test(x, y, ratio = 1, alternative =
c("two.sided", "less", "greater"), conf.level = 0.95, ...)

example:

 a=c(6.7,3.8,5.2,4.2,5.3,3.2,7.6,7.4,3.1,4.2)
p=c(5.9,6.0,5.2,6.8,14.7,15.5,4.2,14.0,4.7,4.7)
var.test(a,p,ratio=1,alternative=
c("two.sided","less","greater"),conf.level=0.90)


The ourput is:

        F test to compare two variances

data:  a and p
F = 0.1314, num df = 9, denom df = 9, p-value = 0.005796
alternative hypothesis: true ratio of variances is not equal to 1
90 percent confidence interval:
 0.04132690 0.41762331
sample estimates:
ratio of variances
         0.1313738

detail in calculation by R:

>low=qf(0.95, 9, 9,lower.tail = TRUE, log.p = FALSE)
>up=qf(0.05, 9, 9,lower.tail = TRUE, log.p = FALSE)
>f=var(a)/var(p)
> f/low
[1] 0.04132690
> f/up
[1] 0.4176233





something to mention about F-distribution:

Note that three of the most important distributions (namely the normal distribution, the t distribution, and the chi-square distribution) may be seen as special cases of the F distribution: 

normal distribution = F(1,infinite)
t distribution = F(1, n2)
chi-square distribution = F(n1, infinite)


==================================================================
F-distribution in Mathematica:
PDF[FRatioDistribution[n, m], x]
output:




Plot[PDF[FRatioDistribution[5, 15], x], {x, 0, 5}]
output:


关键词(Tag): r mathematica ftest var.test



收藏: QQ书签 del.icio.us 订阅: Google 抓虾

最新评论

发表评论

* 昵称

已经注册过? 请登录

新用户请先注册 以便能显示头像及追踪评论回复

Email
网址
* 评论
表情
 
 

分类小组论坛
杂谈, 娱乐、八卦, 文学、艺术, 体育, 旅游、同城, 象牙塔, 情感, 时尚、生活, 星座, 科技

请注意遵守中华人民共和国法律法规, 如威胁到本站生存, 将依法向有关部门报告, 同时本站的相关记录可能成为对您不利的证据.

相关法律法规
全国人大常委会关于维护互联网安全的决定
中华人民共和国计算机信息系统安全保护条例
中华人民共和国计算机信息网络国际联网管理暂行规定
计算机信息网络国际联网安全保护管理办法
计算机信息系统国际联网保密管理规定