max_prob_pred_int: Maximum probability for the prediciton interval 'small sample...

Description Usage Arguments Details Value Examples

View source: R/max_prob_pred_int.R

Description

Finds the maximum probability for a prediction interval using optimization

Usage

1
2
3
4
5
6
7
8
max_prob_pred_int(
  x,
  method = c("tdist", "conformal", "npar"),
  m.method = c("quantile", "deviation", "jackknife"),
  interval = c(0, 1),
  alpha.penalty = 0,
  scale = FALSE
)

Arguments

x

should be a vector

method

either 'tdist' (assumes normality), 'conformal' (distribution-free), or non-parametric ('npar')

m.method

method used to compute conformal prediction interval: either "quantile", "deviation" or "jackknife"

interval

maximum and minimum values for the optimization search

alpha.penalty

whether to include a penalty for alpha

scale

whether to scale the input vector

Details

Optimize the maximum probability for the prediction of a small sample size using either the t-distribution or conformal methods

The idea is to find the maximum level of probability that will produce a prediction interval which matches the minimum and maximum values in the observed sample. The distance is calculated as abs(x.min - calc.lower.bound) + abs(x.max - calc.upper.bound).

Value

a single value which represents a 'suggestion' for the maximum level of probability given the data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
set.seed(12345)
x <- rnorm(10)
mp.pdi <- max_prob_pred_int(x) 
## For this particular sample, the maximum is about 76%
data(soyrs)
soyrs.s <- aggregate(lrr ~ Trial_ID, data = soyrs, FUN = mean)
mp.pdi.soy.tdist <- max_prob_pred_int(soyrs.s$lrr)
mp.pdi.soy.conf <- max_prob_pred_int(soyrs.s$lrr, method = "conformal")
print(round(c(mp.pdi.soy.tdist, mp.pdi.soy.conf1),2))

## End(Not run)

femiguez/predintma documentation built on July 5, 2021, 4:16 a.m.