Learn R Programming

seqtest (version 0.1-0)

seqtest.mean: Sequential triangular test for the arithmetic mean

Description

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

Usage

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, $\mu$.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, $\sigma$.
delta
absolute minimum difference to be detected, $\delta$.
theta
relative minimum difference to be detected, $\theta$.
alpha
type-I-risk, $\alpha$.
beta
type-II-risk, $\beta$.
output
logical: if TRUE, output is shown.
plot
logical: if TRUE, a plot is generated.

Value

  • Returns an object of class seqtest, to be used for later update steps. The object has following entries: ll{ 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 }

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: $\mu$ >= $\mu$.0 and the alternative hypothesis, H1: $\mu$ < $\mu$.0; alternative = "greater" specifies the null hypothesis, H0: $\mu$ <= $\mu$.0="" and="" the="" alternative="" hypothesis,="" h1:="" $\mu$=""> $\mu$.0. For the two-sample test alternative = "less" specifies the null hypothesis, H0: $\mu$.1 >= $\mu$.2 and the alternative hypothesis, H1: $\mu$.1 < $\mu$.2; alternative = "greater" specifies the null hypothesis, H0: $\mu$.1 <= $\mu$.2="" and="" the="" alternative="" hypothesis,="" h1:="" $\mu$.1=""> $\mu$.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.

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

Run this code
#--------------------------------------
# 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))

Run the code above in your browser using DataLab