| sprt | R Documentation |
Runs a Sequential Probability Ratio Test for hypotheses
about population densities of the form H_{0}:\mu = \psi_{0} vs.
H_{1}:\mu < \psi_{1}, where \psi_{0} < \psi_{1}. Data is treated
in a sequential framework.
sprt(data = NA, mu0, mu1, density_func, overdispersion, alpha, beta)
data |
Optional vector of count data (NAs not allowed). Each value is
considered a sampling bout over time. Can't process group sequential data.
If not provided (NA), returns a |
mu0 |
Single non-negative number with the value for the low
hypothesized population density, |
mu1 |
Single non-negative number with the value for the high
hypothesized population density, |
density_func |
Kernel probability density function for the data. See details. |
overdispersion |
A number specifying the overdispersion parameter.
Only required when using |
alpha |
Single number indicating tolerable type I error rate. |
beta |
Single number indicating tolerable type II error rate. |
The density_func argument should be specified as character string.
Acceptable options are "poisson", "negative binomial", and
"binomial". As far as we know, no one has ever calculated and published stop
lines for the beta-binomial family. The overdispersion parameter should only be
specified as a constant. In contrast to the STBP, SPRT is only use overdispersion
to calculate stop lines, so the estimate for the threshold population density
should be used (e.g., at \psi_{0} < \psi < \psi_{1}).
An object of class "SPRT".
Binns, M.R., Nyrop, J.P. & Werf, W.v.d. (2000) Sampling and monitoring in crop protection: the theoretical basis for developing practical decision guides. CABI Pub., Wallingford, Oxon, UK; New York, N.Y.
Wald, A. (1945) Sequential Tests of Statistical Hypotheses. The Annals of Mathematical Statistics 16(2): 117-186.
# If no data is provided, an object of class "SPRT" is returned from which a
# chart with stop lines or a summary of the test with coefficients for stop lines
# can be extracted.
test00 <- sprt(mu0 = 2,
mu1 = 4,
density_func = "negative binomial",
overdispersion = 4.6,
alpha = 0.1,
beta = 0.1)
test00 # returns test specification and stop lines coefficients
plot(test00) # returns a chart with stop lines
# If data is provided, an object of class "SPRT" is returned with test results.
counts <- c(2, 5, 6, 2, 7)
test11 <- sprt(data = counts,
mu0 = 2,
mu1 = 4,
density_func = "negative binomial",
overdispersion = 4.6,
alpha = 0.1,
beta = 0.1)
test11 # returns "accept H1" after 5 sampling bouts processed.
## End (Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.