MyNixOS website logo
Description

Compute FAB (Frequentist and Bayes) Conformal Prediction Intervals.

Computes and plots prediction intervals for numerical data or prediction sets for categorical data using prior information. Empirical Bayes procedures to estimate the prior information from multi-group data are included. See, e.g.,Bersson and Hoff (2022) <arXiv:2204.08122> "Optimal Conformal Prediction for Small Areas".

fabPrediction

An R package for constructing frequentist prediction regions using indirect information.

References

Bersson and Hoff (2023). Frequentist Prediction Sets for Species Abundance using Indirect Information.

Bersson and Hoff (2022). Optimal Conformal Prediction for Small Areas.

Installation

install_packages("fabPrediction")  
library(fabPrediction)

Usage

To load the package:

library(fabPrediction)  

The two main functions are

  • predictionInterval, which constructs prediction intervals for a continuous response. This function can be used to construct nonparametric FAB or distance-to-average conformal intervals, or parametric normal or Bayesian intervals.
  • predictionSet, which constructs prediction sets for a categorical counts response. This function can be used to construct nonparametric FAB or direct sets, or a parametric Bayesian set.

Construction of basic FAB prediction regions are demonstrated below. Please see the vignette for full package capabilities, including empirical Bayes procedures to obtain estimates of prior hyperparameters based on auxiliary data.

Continuous Response

We wlil demonstrate usage on a random normal sample of length 10.

y = rnorm(10)

A FAB prediction interval with 1-alpha coverage can be constructed for these data based on a prior parameters mu and tau2 from a Normal-Normal working model:

y_PI = predictionInterval(y, method = "FAB",
      alpha = .05,
      mu = 0, tau2 = 1/2)

and plotted:

plot(y_PI)

Categorical Response

We wlil demonstrate usage on a random multinomial sample for 10 categories based on a heterogeneous prior concentration gamma.

gamma = c(10:1)
y = c(rmultinom(1,20,rdirichlet(gamma)))

A FAB prediction set with 1-alpha coverage can be constructed for these data based on an estimate of the prior parameter gamma from a Multinomial-Dirichlet working model:

y_PS = predictionSet(y, method = "FAB",
      alpha = .15,
      gamma = gamma)

And this prediction set can be plotted:

plot(y_PS)

Examples

Metadata

Version

1.0.4

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows