Learn R Programming

EnvStats (version 2.3.1)

predIntLnormAltTestPower: Probability That at Least One Future Observation Falls Outside a Prediction Interval for a Lognormal Distribution

Description

Compute the probability that at least one out of \(k\) future observations (or geometric means) falls outside a prediction interval for \(k\) future observations (or geometric means) for a normal distribution.

Usage

predIntLnormAltTestPower(n, df = n - 1, n.geomean = 1, k = 1, 
    ratio.of.means = 1, cv = 1, pi.type = "upper", conf.level = 0.95)

Arguments

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 df=n-1.

n.geomean

positive integer specifying the sample size associated with the future geometric means. The default value is n.geomean=1 (i.e., individual observations). Note that all future geometric means must be based on the same sample size.

k

vector of positive integers specifying the number of future observations that the prediction interval should contain with confidence level conf.level. The default value is k=1.

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 ratio.of.means=1.

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 cv=1.

pi.type

character string indicating what kind of prediction interval to compute. The possible values are pi.type="upper" (the default), and pi.type="lower".

conf.level

numeric vector of values between 0 and 1 indicating the confidence level of the prediction interval. The default value is conf.level=0.95.

Value

vector of numbers between 0 and 1 equal to the probability that at least one of \(k\) future observations or geometric means will fall outside the prediction interval.

Details

A prediction interval for some population is an interval on the real line constructed so that it will contain \(k\) future observations or averages from that population with some specified probability \((1-\alpha)100\%\), where \(0 < \alpha < 1\) and \(k\) is some pre-specified positive integer. The quantity \((1-\alpha)100\%\) is call 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 predIntNormTestPower computes the probability that at least one out of \(k\) future observations or averages will not be contained in a prediction interval 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 predIntLnormAltTestPower 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 \(\theta_2\) and coefficient of variation \(\tau\). The future observations are assumed to come from a lognormal distribution with mean \(\theta_1\) and coefficient of variation \(\tau\); that is, the means are allowed to differ between the two populations, but not the coefficient of variation.

The function predIntLnormAltTestPower calls the function predIntNormTestPower, with the argument delta.over.sigma given by: $$\frac{\delta}{\sigma} = \frac{log(R)}{\sqrt{log(\tau^2 + 1)}} \;\;\;\;\;\; (1)$$ where \(R\) is given by: $$R = \frac{\theta_1}{\theta_2} \;\;\;\;\;\; (2)$$ and corresponds to the argument ratio.of.means for the function predIntLnormAltTestPower, and \(\tau\) corresponds to the argument cv.

References

See the help files for predIntNormTestPower and tTestLnormAltPower.

See Also

plotPredIntLnormAltTestPowerCurve, predIntLnormAlt, predIntNorm, predIntNormK, plotPredIntNormTestPowerCurve, predIntLnormAltSimultaneous, predIntLnormAltSimultaneousTestPower, Prediction Intervals, LognormalAlt.

Examples

Run this code
# NOT RUN {
  # Show how the power increases as ratio.of.means increases.  Assume a 
  # 95% upper prediction interval.

  predIntLnormAltTestPower(n = 4, ratio.of.means = 1:3) 
  #[1] 0.0500000 0.1459516 0.2367793

  #----------

  # Look at how the power increases with sample size for an upper one-sided 
  # prediction interval with k=3, ratio.of.means=4, and a confidence level of 95%.

  predIntLnormAltTestPower(n = c(4, 8), k = 3, ratio.of.means = 4) 
  #[1] 0.2860952 0.4533567

  #----------

  # Show how the power for an upper 95% prediction limit increases as the 
  # number of future observations k increases.  Here, we'll use n=20 and 
  # ratio.of.means=2.

  predIntLnormAltTestPower(n = 20, k = 1:3, ratio.of.means = 2) 
  #[1] 0.1945886 0.2189538 0.2321562
# }

Run the code above in your browser using DataLab