Learn R Programming

outliers (version 0.15)

qgrubbs: Calculate critical values and p-values for Grubbs tests

Description

This function is designed to calculate critical values for Grubbs tests for outliers detecting and to approximate p-values reversively.

Usage

qgrubbs(p, n, type = 10, rev = FALSE)
pgrubbs(q, n, type = 10)

Arguments

p

vector of probabilities.

q

vector of quantiles.

n

sample size.

type

Integer value indicating test variant. 10 is a test for one outlier (side is detected automatically and can be reversed by opposite parameter). 11 is a test for two outliers on opposite tails, 20 is test for two outliers in one tail.

rev

if set to TRUE, function qgrubbs acts as pgrubbs.

Value

A vector of quantiles or p-values.

Details

The critical values for test for one outlier is calculated according to approximations given by Pearson and Sekar (1936). The formula is simply reversed to obtain p-value.

The values for two outliers test (on opposite sides) are calculated according to David, Hartley, and Pearson (1954). Their formula cannot be rearranged to obtain p-value, thus such values are obtained by uniroot.

For test checking presence of two outliers at one tail, the tabularized distribution (Grubbs, 1950) is used, and approximations of p-values are interpolated using qtable.

References

Grubbs, F.E. (1950). Sample Criteria for testing outlying observations. Ann. Math. Stat. 21, 1, 27-58.

Pearson, E.S., Sekar, C.C. (1936). The efficiency of statistical tools and a criterion for the rejection of outlying observations. Biometrika, 28, 3, 308-320.

David, H.A, Hartley, H.O., Pearson, E.S. (1954). The distribution of the ratio, in a single normal sample, of range to standard deviation. Biometrika, 41, 3, 482-493.

See Also

grubbs.test