seqtest.mean: Sequential triangular test for the arithmetic mean

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/seqtest.mean.R

Description

This function performs the sequential triangular test for the arithmetic mean in one- or two-samples

Usage

1
2
3
seqtest.mean(x, y = NULL, mu = NULL, alternative = c("two.sided", "less", "greater"),
             sigma = NULL, delta = NULL, theta = NULL, alpha = 0.05, beta = 0.1,
             output = TRUE, plot = FALSE)

Arguments

x

initial data for group x, at least one entry.

y

initial data for group y, at least one entry for a two-sample test.

mu

a number indicating the true value of the mean in case of the one-sample test, μ.0.

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".

sigma

standard deviation in the population, σ.

delta

absolute minimum difference to be detected, δ.

theta

relative minimum difference to be detected, θ.

alpha

type-I-risk, α.

beta

type-II-risk, β.

output

logical: if TRUE, output is shown.

plot

logical: if TRUE, a plot is generated.

Details

For the one-sample test, arguments x, mu and the minimum difference to be detected has to be specified (i.e., argument y must not be specified). For the two-sample test, arguments x, y, and the minimum difference to be detected has to be specified. There are two options to specify the minimum difference to be detected: (1) using arguments mu, sigma and delta or (2) using arguments mu and theta. Note that it is not a requirement to know sigma in advance, i.e., theta can be specified directly. For example, theta = 1 specifies a relative minimum difference to be detected of one standard deviation.

In order to specify a one-sided test, argument alternative has to be used (i.e., two-sided tests are conducted by default). For the one-sample test, alternative = "less" specifies the null hypothesis, H0: μ >= μ.0 and the alternative hypothesis, H1: μ < μ.0; alternative = "greater" specifies the null hypothesis, H0: μ <= μ.0 and the alternative hypothesis, H1: μ > μ.0. For the two-sample test alternative = "less" specifies the null hypothesis, H0: μ.1 >= μ.2 and the alternative hypothesis, H1: μ.1 < μ.2; alternative = "greater" specifies the null hypothesis, H0: μ.1 <= μ.2 and the alternative hypothesis, H1: μ.1 > μ.2.

The main characteristic of the sequential triangular test is that there is no fixed sample size given in advance. That is, for the most recent sampling point, one has to decide whether sampling has to be continued or either the null- or the alternative hypothesis can be accepted given specified precision requirements (i.e. type-I-risk, type-II-risk and a minimum difference to be detected). The (cumulative) test statistic Z.m on a Cartesian coordinate system produces a "sequential path" on a continuation area as a triangle. As long as the statistic remains within that triangle, additional data have to be sampled. If the path touches or exceeds the borderlines of the triangle, sampling is completed. Depending on the particular borderline, the null-hypothesis is either accepted or rejected.

Value

Returns an object of class seqtest, to be used for later update steps. The object has following entries:

call function call
type type of the test (i.e., arithmetic mean)
spec specification of function arguments
tri specification of the triangular
dat data
res list with results

Author(s)

Takuya Yanagida [email protected],

References

Rasch, D., Pilz, J., Verdooren, L. R., & Gebhardt, G. (2011). Optimal experimental design with R. Boca Raton: Chapman & Hall/CRC.

Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.

See Also

update.seqtest, seqtest.prop, seqtest.cor, print.seqtest, plot.seqtest, descript

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#--------------------------------------
# Two-sided one-sample test
# H0: mu = 50, H1: mu != 50
# alpha = 0.05, beta = 0.2, theta = 0.5

seq.obj <- seqtest.mean(56, mu = 50, theta = 0.5,
                        alpha = 0.05, beta = 0.2, plot = TRUE)

# alternative specifiation using sigma and delta
seq.obj <- seqtest.mean(56, mu = 50, sigma = 10, delta = 5,
                        alpha = 0.05, beta = 0.2, plot = TRUE)

seq.obj <- update(seq.obj, x = c(54, 52, 46, 49))
seq.obj <- update(seq.obj, x = c(46, 49, 51, 45))
seq.obj <- update(seq.obj, x = c(51, 42, 50, 53))
seq.obj <- update(seq.obj, x = c(50, 53, 49, 53))

#--------------------------------------
# One-sided one-sample test
# H0: mu <= 50, H1: mu > 50
# alpha = 0.05, beta = 0.2, theta = 0.5

seq.obj <- seqtest.mean(c(56, 53), mu = 50, alternative = "greater",
                        theta = 0.5, alpha = 0.05, beta = 0.2, plot = TRUE)

# alternative specifiation using sigma and delta
seq.obj <- seqtest.mean(c(56, 53), mu = 50, alternative = "greater",
                        sigma = 10, delta = 5, alpha = 0.05, beta = 0.2, plot = TRUE)

seq.obj <- update(seq.obj, x = c(67, 52, 48, 59))
seq.obj <- update(seq.obj, x = c(53, 57, 54, 62))
seq.obj <- update(seq.obj, x = 58)

#--------------------------------------
# Two-sided two-sample test
# H0: mu.1 = mu.2, H1: mu.1 != mu.2
# alpha = 0.01, beta = 0.1, theta = 1

seq.obj <- seqtest.mean(53, 45, theta = 1,
                        alpha = 0.01, beta = 0.01, plot = TRUE)

# alternative specifiation using sigma and delta
seq.obj <- seqtest.mean(57, 45, sigma = 10, delta = 10,
                        alpha = 0.01, beta = 0.01, plot = TRUE)

seq.obj <- update(seq.obj, x = c(58, 54, 56), y = c(45, 41, 42))
seq.obj <- update(seq.obj, x = c(56, 50, 49), y = c(42, 45, 50))
seq.obj <- update(seq.obj, x = c(62, 57, 59))
seq.obj <- update(seq.obj, y = c(41, 39, 46))
seq.obj <- update(seq.obj, x = 67)
seq.obj <- update(seq.obj, y = 40)
seq.obj <- update(seq.obj, y = 36)

#--------------------------------------
# One-sided two-sample test
# H0: mu.1 <= mu.2, H1: mu.1 > mu.2
# alpha = 0.01, beta = 0.1, theta = 1

seq.obj <- seqtest.mean(53, 45, alternative = "greater", theta = 1,
                        alpha = 0.01, beta = 0.01, plot = TRUE)

# alternative specifiation using sigma and delta
seq.obj <- seqtest.mean(57, 45, alternative = "greater",sigma = 10, delta = 10,
                        alpha = 0.01, beta = 0.01, plot = TRUE)

seq.obj <- update(seq.obj, x = c(58, 54, 56), y = c(45, 41, 42))
seq.obj <- update(seq.obj, x = c(56, 50, 49), y = c(42, 45, 50))
seq.obj <- update(seq.obj, x = c(62, 57, 59))
seq.obj <- update(seq.obj, y = c(41, 39, 46))

seqtest documentation built on May 29, 2017, 6:52 p.m.