Learn R Programming

outliers (version 0.13-3)

cochran.test: Test for outlying or inlying variance

Description

This test is useful to check if largest variance in several groups of data is "outlying" and this group should be rejected. Alternatively, if one group has very small variance, we can test for "inlying" variance.

Usage

cochran.test(object, data, inlying = FALSE)

Arguments

object
A vector of variances or formula.
data
If object is a vector, data should be another vector, giving number of data in each corresponding group. If object is a formula, data should be a dataframe.
inlying
Test smallest variance instead of largest.

Value

  • A list with class htest containing the following components:
  • statisticthe value of Cochran-statistic.
  • p.valuethe p-value for the test.
  • alternativea character string describing the alternative hypothesis.
  • methoda character string indicating what type of test was performed.
  • data.namename of the data argument.
  • estimatevector of variance estimates

Details

The corresponding p-value is calculated using pcochran function.

References

Snedecor, G.W., Cochran, W.G. (1980). Statistical Methods (seventh edition). Iowa State University Press, Ames, Iowa.

See Also

qcochran

Examples

Run this code
set.seed(1234)
x=rnorm(100)
d=data.frame(x=x,group=rep(1:10,10))
cochran.test(x~group,d)
cochran.test(x~group,d,inlying=TRUE)
x=runif(5)
cochran.test(x,rep(5,5))
cochran.test(x,rep(100,5))

Run the code above in your browser using DataLab