R语言 进行F测试–var.test()方法

R语言 进行F测试–var.test()方法

R编程语言中的var.test()方法 在两个正态种群之间进行F检验,假设两个种群的变异性相等。

R语言 var.test()方法语法

语法: var.test()

返回: 返回某个假设的F-测试分数。

R编程语言中的var.test()方法示例

例子1 :

x <- rnorm(50, mean=0)
y <- rnorm(50, mean=1)
 
# Using var.test() method
gfg <- var.test(x, y)
 
print(gfg)
R

输出

F test to compare two variances

data:  x and y

F = 1.0779, num df = 49, denom df = 49, p-value = 0.794

alternative hypothesis: true ratio of variances is not equal to 1

95 percent confidence interval:

0.6116778 1.8994484

sample estimates:

ratio of variances

1.077892
Bash

例2 :

x <- rnorm(50, mean=1.2)
y <- rnorm(50, mean=1.8)
 
# Using var.test() method
gfg <- var.test(x, y)
 
print(gfg)
R

输出

F test to compare two variances

data:  x and y

F = 2.382, num df = 49, denom df = 49, p-value = 0.002911

alternative hypothesis: true ratio of variances is not equal to 1

95 percent confidence interval:

1.351715 4.197491

sample estimates:

ratio of variances

2.381976
Bash

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程

登录

注册