Learn R Programming

SPIn (version 1.1)

SPIn: Simulation Efficient Shortest Probability Intervals

Description

Compute the shortest probability interval (spin) using an optimal weighting strategy.

Usage

SPIn(x, conf = 0.95, bw = 0, lb = -Inf, ub = Inf, l=NA, u=NA)

Arguments

x
A vector of samples from the distribution.
conf
Scalar, the confidence level desired.
bw
Scalar, the bandwidth of the weighting kernel in terms of sample points. If not specified, sqrt(n) will be used, where n is the sample size.
lb,ub
Scalars, the lower and upper bounds of the distribution. If specified, a pseudo-sample point equal to the corresponding bound will be added.
l,u
Scalars, weighting centers (if provided).

Value

  • SPIn returns an object of class 'SPIn'. An object of class 'SPIn' is a list containing the following components:
  • spinA vector of length 2 with the lower and upper endpoints of the interval.
  • confThe confidence level.
  • xA vector of samples from the distribution.
  • w.l,w.uVectors of the computed weights.
  • l.l,l.u,u.l,u.uEndpoints of the weights.

Details

SPIn computes the shortest probability interval for a distribution using an optimal weighting strategy. Quadratic programming is used to determine the optimal weights.

References

Simulation efficient shortest probability intervals. (arXiv:1302.2142)

See Also

bootSPIn,plot.SPIn

Examples

Run this code
x <- rgamma(100,3)
SPIn(x)

Run the code above in your browser using DataLab