Performs Grubbs double outlier test.
doubleGrubbsTest(x, alternative = c("two.sided", "greater", "less"), m = 10000)
a numeric vector of data.
the alternative hypothesis.
Defaults to "two.sided"
.
number of Monte-Carlo replicates.
A list with class "htest"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
the estimated quantile of the test statistic.
the p-value for the test.
the parameters of the test statistic, if any.
a character string describing the alternative hypothesis.
the estimates, if any.
the estimate under the null hypothesis, if any.
Let \(X\) denote an identically and independently distributed continuous variate with realizations \(x_i ~~ (1 \le i \le k)\). Further, let the increasingly ordered realizations denote \(x_{(1)} \le x_{(2)} \le \ldots \le x_{(n)}\). Then the following model for testing two maximum outliers can be proposed:
$$ x_{(i)} = \left\{ \begin{array}{lcl} \mu + \epsilon_{(i)}, & \qquad & i = 1, \ldots, n - 2 \\ \mu + \Delta + \epsilon_{(j)} & \qquad & j = n-1, n \\ \end{array} \right.$$
with \(\epsilon \approx N(0,\sigma)\). The null hypothesis, H\(_0: \Delta = 0\) is tested against the alternative, H\(_{\mathrm{A}}: \Delta > 0\).
For testing two minimum outliers, the model can be proposed as
$$ x_{(i)} = \left\{ \begin{array}{lcl} \mu + \Delta + \epsilon_{(j)} & \qquad & j = 1, 2 \\ \mu + \epsilon_{(i)}, & \qquad & i = 3, \ldots, n \\ \end{array} \right.$$
The null hypothesis is tested against the alternative, H\(_{\mathrm{A}}: \Delta < 0\).
The p-value is computed with the function pdgrubbs
.
Grubbs, F. E. (1950) Sample criteria for testing outlying observations. Ann. Math. Stat. 21, 27--58.
Wilrich, P.-T. (2011) Critical values of Mandel's h and k, Grubbs and the Cochran test statistic. Adv. Stat. Anal.. 10.1007/s10182-011-0185-y.
# NOT RUN {
data(Pentosan)
dat <- subset(Pentosan, subset = (material == "A"))
labMeans <- tapply(dat$value, dat$lab, mean)
doubleGrubbsTest(x = labMeans, alternative = "less")
# }
Run the code above in your browser using DataLab