***~会飞的蝎子~学习宁静致远 » 日志 » F-test Using R
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:
==================================================================
F-distribution in Mathematica:
PDF[FRatioDistribution[n, m], x]
output:

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

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:

曾经的这一天...
- » 2006年: [color=red]荣幸其实也会郁闷~郁闷其实会有动力[/color]
- » 2005年: 忙碌的一段落
相关日志:
收藏:
QQ书签
del.icio.us
订阅:
Google
抓虾
