Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cochranTest

Cochran Test


Description

Performs Cochran's test for testing an outlying (or inlying) variance.

Usage

cochranTest(x, ...)

## Default S3 method:
cochranTest(x, g, alternative = c("greater", "less"), ...)

## S3 method for class 'formula'
cochranTest(
  formula,
  data,
  subset,
  na.action,
  alternative = c("greater", "less"),
  ...
)

Arguments

x

a numeric vector of data values, or a list of numeric data vectors.

...

further arguments to be passed to or from methods.

g

a vector or factor object giving the group for the corresponding elements of "x". Ignored with a warning if "x" is a list.

alternative

the alternative hypothesis. Defaults to "greater"

formula

a formula of the form response ~ group where response gives the data values and group a vector or factor of the corresponding groups.

data

an optional matrix or data frame (or similar: see model.frame) containing the variables in the formula formula. By default the variables are taken from environment(formula).

subset

an optional vector specifying a subset of observations to be used.

na.action

a function which indicates what should happen when the data contain NAs. Defaults to getOption("na.action").

Details

For normally distributed data the null hypothesis, H_0: σ_1^2 = σ_2^2 = … = σ_k^2 is tested against the alternative (greater) H_{\mathrm{A}}: σ_p > σ_i ~~ (i ≤ k, i \ne p) with at least one inequality being strict.

The p-value is computed with the function pcochran.

Value

A list with class "htest" containing the following components:

method

a character string indicating what type of test was performed.

data.name

a character string giving the name(s) of the data.

statistic

the estimated quantile of the test statistic.

p.value

the p-value for the test.

parameter

the parameters of the test statistic, if any.

alternative

a character string describing the alternative hypothesis.

estimates

the estimates, if any.

null.value

the estimate under the null hypothesis, if any.

References

Cochran, W.G. (1941) The distribution of the largest of a set of estimated variances as a fraction of their total. Ann. Eugen. 11, 47–52.

Wilrich, P.-T. (2011) Critical values of Mandel's h and k, Grubbs and the Cochran test statistic. Adv. Stat. Anal.. doi: 10.1007/s10182-011-0185-y.

See Also

Examples

data(Pentosan)
cochranTest(value ~ lab, data = Pentosan, subset = (material == "A"))

PMCMRplus

Calculate Pairwise Multiple Comparisons of Mean Rank Sums Extended

v1.9.0
GPL (>= 3)
Authors
Thorsten Pohlert [aut, cre] (<https://orcid.org/0000-0003-3855-3025>)
Initial release
2021-01-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.