Given univariate samples \(X_1~,\ldots,~X_k\), it tests $$H_0 : \sigma_1^2 = \cdots \sigma_k^2\quad vs\quad H_1 : \textrm{at least one equality does not hold}$$ using the procedure by Levene (1960).
vark.1960Levene(dlist)
a list of length \(k\) where each element is a sample vector.
a (list) object of S3
class htest
containing:
a test statistic.
\(p\)-value under \(H_0\).
alternative hypothesis.
name of the test.
name(s) of provided sample data.
Levene H (1960). “Robust tests for equality of variances.” In Contributions to Probability and Statistics: Essays in Honor of Harold Hotelling, 278--292. Stanford University Press, Palo Alto, California.
## CRAN-purpose small example
small1d = list()
for (i in 1:5){ # k=5 sample
small1d[[i]] = rnorm(20)
}
vark.1960Levene(small1d) # run the test
#>
#> Levene's Test for Homogeneity of Variance.
#>
#> data: small1d
#> statistic = 2.1061, p-value = 0.08605
#> alternative hypothesis: at least one of equalities does not hold.
#>
# \donttest{
## test when k=5 (samples)
## empirical Type 1 error
niter = 1000
counter = rep(0,niter) # record p-values
for (i in 1:niter){
mylist = list()
for (j in 1:5){
mylist[[j]] = rnorm(50)
}
counter[i] = ifelse(vark.1960Levene(mylist)$p.value < 0.05, 1, 0)
}
## print the result
cat(paste("\n* Example for 'vark.1960Levene'\n","*\n",
"* number of rejections : ", sum(counter),"\n",
"* total number of trials : ", niter,"\n",
"* empirical Type 1 error : ",round(sum(counter/niter),5),"\n",sep=""))
#>
#> * Example for 'vark.1960Levene'
#> *
#> * number of rejections : 54
#> * total number of trials : 1000
#> * empirical Type 1 error : 0.054
# }