vark.1937Bartlett {SHT} | R Documentation |
Bartlett's Test for Homogeneity of Variance
Description
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 Bartlett (1937).
Usage
vark.1937Bartlett(dlist)
Arguments
dlist |
a list of length |
Value
a (list) object of S3
class htest
containing:
- statistic
a test statistic.
- p.value
p
-value underH_0
.- alternative
alternative hypothesis.
- method
name of the test.
- data.name
name(s) of provided sample data.
References
Bartlett MS (1937). “Properties of Sufficiency and Statistical Tests.” Proceedings of the Royal Society of London. Series A, Mathematical and Physical Sciences, 160(901), 268–282. ISSN 00804630.
Examples
## CRAN-purpose small example
small1d = list()
for (i in 1:5){ # k=5 sample
small1d[[i]] = rnorm(20)
}
vark.1937Bartlett(small1d) # run the test
## 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.1937Bartlett(mylist)$p.value < 0.05, 1, 0)
}
## print the result
cat(paste("\n* Example for 'vark.1937Bartlett'\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=""))
[Package SHT version 0.1.8 Index]