Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/predIntLnormAltSimultaneousTestPower.R
Compute the probability that at least one set of future observations violates the given rule based on a simultaneous prediction interval for the next r future sampling occasions for a lognormal distribution. The three possible rules are: kofm, California, or Modified California.
1 2 3 4  predIntLnormAltSimultaneousTestPower(n, df = n  1, n.geomean = 1, k = 1,
m = 2, r = 1, rule = "k.of.m", ratio.of.means = 1, cv = 1, pi.type = "upper",
conf.level = 0.95, r.shifted = r, K.tol = .Machine$double.eps^0.5,
integrate.args.list = NULL)

n 
vector of positive integers greater than 2 indicating the sample size upon which the prediction interval is based. 
df 
vector of positive integers indicating the degrees of freedom associated with
the sample size. The default value is 
n.geomean 
positive integer specifying the sample size associated with the future geometric
means.
The default value is 
k 
for the kofm rule ( 
m 
vector of positive integers specifying the maximum number of future observations (or
averages) on one future sampling “occasion”.
The default value is 
r 
vector of positive integers specifying the number of future sampling “occasions”.
The default value is 
rule 
character string specifying which rule to use. The possible values are

ratio.of.means 
numeric vector specifying the ratio of the mean of the population that will be
sampled to produce the future observations vs. the mean of the population that
was sampled to construct the prediction interval. See the DETAILS section below
for more information. The default value is 
cv 
numeric vector of positive values specifying the coefficient of variation for
both the population that was sampled to construct the prediction interval and
the population that will be sampled to produce the future observations. The
default value is 
pi.type 
character string indicating what kind of prediction interval to compute.
The possible values are 
conf.level 
vector of values between 0 and 1 indicating the confidence level of the prediction interval.
The default value is 
r.shifted 
vector of positive integers specifying the number of future sampling occasions for
which the mean is shifted. All values must be integeters
between 
K.tol 
numeric scalar indicating the tolerance to use in the nonlinear search algorithm to
compute K. The default value is 
integrate.args.list 
a list of arguments to supply to the 
What is a Simultaneous Prediction Interval?
A prediction interval for some population is an interval on the real line constructed
so that it will contain k future observations from that population
with some specified probability (1α)100\%, where
0 < α < 1 and k is some prespecified positive integer.
The quantity (1α)100\% is called
the confidence coefficient or confidence level associated with the prediction
interval. The function predIntNorm
computes a standard prediction
interval based on a sample from a normal distribution.
The function predIntLnormAltSimultaneous
computes a simultaneous
prediction interval (assuming lognormal observations) that will contain a
certain number of future observations
with probability (1α)100\% for each of r future sampling
“occasions”, where r is some prespecified positive integer.
The quantity r may refer to r distinct future sampling occasions in
time, or it may for example refer to sampling at r distinct locations on
one future sampling occasion,
assuming that the population standard deviation is the same at all of the r
distinct locations.
The function predIntLnormAltSimultaneous
computes a simultaneous
prediction interval based on one of three possible rules:
For the kofm rule (rule="k.of.m"
), at least k of
the next m future observations will fall in the prediction
interval with probability (1α)100\% on each of the r future
sampling occasions. If obserations are being taken sequentially, for a particular
sampling occasion, up to m observations may be taken, but once
k of the observations fall within the prediction interval, sampling can stop.
Note: When k=m and r=1, the results of predIntNormSimultaneous
are equivalent to the results of predIntNorm
.
For the California rule (rule="CA"
), with probability
(1α)100\%, for each of the r future sampling occasions, either
the first observation will fall in the prediction interval, or else all of the next
m1 observations will fall in the prediction interval. That is, if the first
observation falls in the prediction interval then sampling can stop. Otherwise,
m1 more observations must be taken.
For the Modified California rule (rule="Modified.CA"
), with probability
(1α)100\%, for each of the r future sampling occasions, either the
first observation will fall in the prediction interval, or else at least 2 out of
the next 3 observations will fall in the prediction interval. That is, if the first
observation falls in the prediction interval then sampling can stop. Otherwise, up
to 3 more observations must be taken.
Computing Power
The function predIntNormSimultaneousTestPower
computes the
probability that at least one set of future observations or averages will
violate the given rule based on a simultaneous prediction interval for the
next r future sampling occasions for a normal distribution,
based on the assumption of normally distributed observations,
where the population mean for the future observations is allowed to differ from
the population mean for the observations used to construct the prediction interval.
The function predIntLnormAltSimultaneousTestPower
assumes all observations are
from a lognormal distribution. The observations used to
construct the prediction interval are assumed to come from a lognormal distribution
with mean θ_2 and coefficient of variation τ. The future
observations are assumed to come from a lognormal distribution with mean
θ_1 and coefficient of variation τ; that is, the means are
allowed to differ between the two populations, but not the coefficient of variation.
The function predIntLnormAltSimultaneousTestPower
calls the function
predIntNormSimultaneousTestPower
, with the argument
delta.over.sigma
given by:
\frac{δ}{σ} = \frac{log(R)}{√{log(τ^2 + 1)}} \;\;\;\;\;\; (1)
where R is given by:
R = \frac{θ_1}{θ_2} \;\;\;\;\;\; (2)
and corresponds to the argument ratio.of.means
for the function
predIntLnormAltSimultaneousTestPower
, and τ corresponds to the
argument cv
.
vector of values between 0 and 1 equal to the probability that the rule will be violated.
See the help files for predIntLnormAltSimultaneous
and
predIntNormSimultaneousTestPower
.
Steven P. Millard (EnvStats@ProbStatInfo.com)
See the help file for predIntLnormAltSimultaneous
.
predIntLnormAltSimultaneous
,
plotPredIntLnormAltSimultaneousTestPowerCurve
,
predIntNormSimultaneous
,
plotPredIntNormSimultaneousTestPowerCurve
,
Prediction Intervals, LognormalAlt.
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  # For the kofm rule with n=4, k=1, m=3, and r=1, show how the power increases
# as ratio.of.means increases. Assume a 95% upper prediction interval.
predIntLnormAltSimultaneousTestPower(n = 4, m = 3, ratio.of.means = 1:3)
#[1] 0.0500000 0.2356914 0.4236723
#
# Look at how the power increases with sample size for an upper onesided
# prediction interval using the kofm rule with k=1, m=3, r=20,
# ratio.of.means=4, and a confidence level of 95%.
predIntLnormAltSimultaneousTestPower(n = c(4, 8), m = 3, r = 20, ratio.of.means = 4)
#[1] 0.4915743 0.8218175
#
# Compare the power for the 1of3 rule with the power for the California and
# Modified California rules, based on a 95% upper prediction interval and
# ratio.of.means=4. Assume a sample size of n=8. Note that in this case the
# power for the Modified California rule is greater than the power for the
# 1of3 rule and California rule.
predIntLnormAltSimultaneousTestPower(n = 8, k = 1, m = 3, ratio.of.means = 4)
#[1] 0.6594845
predIntLnormAltSimultaneousTestPower(n = 8, m = 3, rule = "CA", ratio.of.means = 4)
#[1] 0.5864311
predIntLnormAltSimultaneousTestPower(n = 8, rule = "Modified.CA", ratio.of.means = 4)
#[1] 0.691135
#
# Show how the power for an upper 95% simultaneous prediction limit increases
# as the number of future sampling occasions r increases. Here, we'll use the
# 1of3 rule with n=8 and ratio.of.means=4.
predIntLnormAltSimultaneousTestPower(n = 8, k = 1, m = 3, r = c(1, 2, 5, 10),
ratio.of.means = 4)
#[1] 0.6594845 0.7529576 0.8180814 0.8302302

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.