View source: R/loo_conformal.R
loo_conformal | R Documentation |
Prepares for jackknife(+) conformal prediction by performing Pareto-smoothed importance sampling to yield leave-one-out residuals.
loo_conformal(fit, ...) ## Default S3 method: loo_conformal(fit, truth, chain = NULL, est_fun = c("mean", "median"), ...) ## S3 method for class 'stanreg' loo_conformal(fit, est_fun = c("mean", "median"), ...) ## S3 method for class 'brmsfit' loo_conformal(fit, est_fun = c("mean", "median"), ...)
fit |
Model fit; an object with |
... |
Ignored. |
truth |
True values to predict. Not required for |
chain |
An integer vector identifying the chain numbers for the posterior draws. Should be provided if multiple chains are used. |
est_fun |
Whether to use the posterior |
A modified fit
object with an additional class conformal
.
Calling predictive_interval()
on this new object will yield conformal
intervals.
Vehtari, A., Simpson, D., Gelman, A., Yao, Y., & Gabry, J. (2015). Pareto smoothed importance sampling. arXiv preprint arXiv:1507.02646.
if (requireNamespace("rstanarm", quietly=TRUE)) suppressWarnings({ library(rstanarm) # fit a simple linear regression m = stan_glm(mpg ~ disp + cyl, data=mtcars, chains=1, iter=1000, control=list(adapt_delta=0.999), refresh=0) loo_conformal(m) })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.