Description Usage Arguments Value References See Also Examples
Calculates parametric and non-parametric prediction intervals to contain at least k out of m future observations given a observed sample
1 2 | predint(x, k, m, level=0.95, alternative="two.sided", quantile=NULL, absError=0.001, interval=c(0, 100))
nparpredint(x, k, m, level=0.95, alternative="two.sided")
|
x |
A numeric vector with a sample of observations |
k |
Number of future observations contained in the interval |
m |
Size of future sample |
level |
Confidence level |
alternative |
One of "two.sided", "less", or "greater" to calculate two- or one-sided intervals |
quantile |
Supply a user-defined quantile for parametric intervals |
absError |
The maximum absolute error tolerated when calculating the quantile |
interval |
Root finding interval when calculating the quantile |
An object inheriting from class
PredInterval
, or nparPredInterval
Odeh, RE (1990): 2-Sided prediction intervals to contain at least k out of m future observations from a normal distribution. Technometric 32(2): 203-216.
Danziger, L. and Davis, S.A. (1964): Tables of distribution-free tolerance limits. Annals of Mathematical Statistics 35(3):1361-1365.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | x <- rnorm(50)
predint(x, k=7, m=10)
nparpredint(x, k=7, m=10)
## Not run:
# for k=m the prediction interval:
predint(x, k=10, m=10, absError=0.0001)
# can also be calculated by
library(mvtnorm)
rho <- matrix(1/(length(x)+1), nrow=10, ncol=10)
diag(rho) <- 1
m <- mean(x)
std <- sd(x)
quant <- qmvt(0.95, df=length(x)-1, corr=rho, tail="both.tails")$quantile
m + c(-1, 1) * quant * std * sqrt((length(x)+1)/length(x))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.