Description Usage Arguments Details Value Examples
View source: R/max_prob_pred_int.R
objective function for probability of a prediciton interval for 'small' sample sizes.
1 2 3 4 5 6 7 8 |
alpha |
miscoverage or 'error rate' |
x |
a vector |
method |
either 'tdist' (assumes normality) or 'conformal' (distribution-free) |
m.method |
method used to compute conformal prediction interval: either "quantile", "deviation" or "jackknife" |
alpha.penalty |
whether to include an alpha penalty (default 0 or 'no') |
scale |
whether to scale the input vector. This only makes sense if the alpha.penalty is different from zero. |
Objective funciton for optimization
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).
a single value which represents a value that should be minimized
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
set.seed(12345)
x <- rnorm(10)
alphas <- seq(0,1, 0.05)
objf <- numeric(length(alphas))
for(i in 1:length(objf)){
objf[i] <- mpdi_obj(alphas[i], x = x, method = "conformal")
}
qplot(alphas, objf, geom = "line")
## Trying the t-distribution
y <- rt(10, df = 1)
alphas <- seq(0,1, 0.05)
objf <- numeric(length(alphas))
for(i in 1:length(objf)){
objf[i] <- mpdi_obj(alphas[i], x = y, method = "conformal")
}
qplot(alphas, objf, geom = "line")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.