Contents

[-]
1 F-검정
2 levene 테스트


1 F-검정 #

  • 2개의 변수에 대해서 분산이 같은지 다른지 검정.
  • R에서는 var.test 함수 이용

a <- c(61,60,56,63,56,63,59,56,44,61)
b <- c(55,54,47,59,51,61,57,54,62,58)
var.test(a,b)

결과는 다음과 같다.
        F test to compare two variances

data:  a and b 
F = 1.4815, num df = 9, denom df = 9, p-value = 0.5675
alternative hypothesis: true ratio of variances is not equal to 1 
95 percent confidence interval:
 0.3679936 5.9646717 
sample estimates:
ratio of variances 
           1.48154 

> 

결과해석
  • 가설
    • 귀무가설: 분산에 차이가 없다.
    • 대립가설: 분산에 차이가 있다.
  • p-value가 0.5675로 유의수준 0.05보다 크므로 대립가설은 뻑. 그러므로 귀무가설 지지.

2 levene 테스트 #

  • 변수들 중 분산이 하나라도 다른 것이 있는지에 대한 검정
  • R에서는 levene.test를 이용

library("car")
a <- c(61,60,56,63,56,63,59,56,44,61)
b <- c(55,54,47,59,51,61,57,54,62,58)
x1 <- data.frame(a,b)
x2 <- stack(x1)
levene.test(values~ind, data=x2)

결과는 다음과 같다.
Levene's Test for Homogeneity of Variance
      Df F value Pr(>F)
group  1  0.0039 0.9508
      18               

결과해석
  • 가설
    • 귀무가설: 분산의 차이가 없다.
    • 대립가설: 분산의 차이가 있다.
  • p-value = 0.9508 로 유의수준 0.05보다 크다. 그러므로 대립가설은 뻑남. 귀무가설 지지.

library("car")
c1 <- c(3.6, 4.1, 4.0)
c2 <- c(3.1, 3.2, 3.9)
c3 <- c(3.2, 3.5, 3.5)
c4 <- c(3.5, 3.8, 3.9)
x1 <- data.frame(c1,c2,c3,c4)
x2 <- stack(x1)
levene.test(values~ind, data=x2)

결과는 다음과 같다.
Levene's Test for Homogeneity of Variance
      Df F value Pr(>F)
group  3  0.2593 0.8528
       8               
역시 귀무가설 지지..