SPIn: Simulation Efficient Shortest Probability Intervals

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

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

Usage

1
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).

Details

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

Value

SPIn returns an object of class 'SPIn'. An object of class 'SPIn' is a list containing the following components:

spin

A vector of length 2 with the lower and upper endpoints of the interval.

conf

The confidence level.

x

A vector of samples from the distribution.

w.l,w.u

Vectors of the computed weights.

l.l,l.u,u.l,u.u

Endpoints of the weights.

Note

This function assumes that the distribution is unimodal, and computes only 1 interval, not the set of intervals that are appropriate for multimodal distributions.

Author(s)

Ying Liu yliu@stat.columbia.edu

References

Simulation efficient shortest probability intervals. (arXiv:1302.2142)

See Also

bootSPIn,plot.SPIn

Examples

1
2
x <- rgamma(100,3)
SPIn(x)

Example output

Loading required package: quadprog
$spin
[1] 0.2933806 5.9742295

$conf
[1] 0.95

$x
  [1] 0.2933806 0.3485911 0.7415010 0.7634083 0.7694012 0.7694763 0.9556156
  [8] 1.1205427 1.1592866 1.1615992 1.1799116 1.2611875 1.3281426 1.3838270
 [15] 1.3907733 1.4288182 1.4310369 1.5271968 1.5330393 1.5547128 1.5783302
 [22] 1.5996157 1.6562046 1.7051711 1.7450177 1.7616346 1.7767946 1.7781777
 [29] 1.7846513 1.8412842 1.8907984 1.9381865 1.9384494 2.0218090 2.0570562
 [36] 2.1200397 2.1287980 2.2047718 2.2218065 2.2737837 2.3331989 2.3623842
 [43] 2.3734601 2.4310775 2.4316440 2.4369964 2.4522400 2.4534747 2.4813414
 [50] 2.4971950 2.5602084 2.6256629 2.6766900 2.7285126 2.7874975 2.8658699
 [57] 2.8683657 2.8713209 2.9258665 2.9582580 2.9819862 3.0208198 3.0440925
 [64] 3.0727895 3.2078849 3.2095308 3.2548720 3.2734187 3.3076861 3.3358902
 [71] 3.4246774 3.4713158 3.5194713 3.6182669 3.6554772 3.7834751 3.7974750
 [78] 4.1328766 4.2972266 4.2992561 4.3042960 4.4937605 4.5704219 4.5856807
 [85] 4.6027198 4.6317146 4.6843149 4.6946458 4.7527710 4.7952631 5.0794101
 [92] 5.2879296 5.3970868 5.4082599 5.7919276 6.1045459 6.3941511 6.5815453
 [99] 7.7232092 8.4660350

$w.l
[1] 1

$w.u
[1] 0.1111111 0.1111111 0.1111111 0.1111111 0.1111111 0.1111111 0.1111111
[8] 0.1111111 0.1111111

$l.l
[1] 1

$l.u
[1] 1

$u.l
[1] 91

$u.u
[1] 99

attr(,"class")
[1] "SPIn"

SPIn documentation built on May 2, 2019, 7:50 a.m.