bootSPIn: SPIn with Bootstrap

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

Description

Compute the shortest probability interval (spin) using SPIn with bootstrap.

Usage

1
bootSPIn(x, n.boot = 50, conf = 0.95, bw = 0, lb = -Inf, ub = Inf, l = NA, u = NA)

Arguments

x

A vector of samples from the distribution.

n.boot

Number of bootstraps.

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.boot computes the shortest probability interval for a distribution using SPIn with bootstrap.

Value

spin.boot 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

plot.SPIn,SPIn

Examples

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

Example output

Loading required package: quadprog
$spin
[1] 0.4280436 6.6387644

$conf
[1] 0.95

$x
  [1] 0.2865586 0.4118884 0.4521899 0.6708742 0.7591170 0.7798964 0.9449463
  [8] 1.0515777 1.0660976 1.0943963 1.2517089 1.3128049 1.3512131 1.4040062
 [15] 1.4582725 1.5085466 1.5988698 1.6511715 1.6968004 1.7649733 1.8084420
 [22] 1.8190970 1.8777804 1.9671420 1.9982517 2.0064375 2.0089150 2.0539225
 [29] 2.0888339 2.1111118 2.1206706 2.1227750 2.1763978 2.1868276 2.4343568
 [36] 2.4426136 2.4638524 2.4998436 2.5140343 2.5211143 2.5244275 2.5305970
 [43] 2.5564657 2.5849578 2.5869185 2.6356401 2.6406580 2.6742869 2.7262336
 [50] 2.7672054 2.7752811 2.8039775 2.8694618 2.8918690 2.9249759 2.9813887
 [57] 2.9861596 3.1246841 3.1665872 3.1802159 3.2752246 3.2760238 3.3314386
 [64] 3.4176273 3.4920757 3.4946424 3.5976486 3.6221430 3.6311350 3.6360460
 [71] 3.6684693 3.6894431 3.7119017 3.8250257 3.8787023 4.0378206 4.0913348
 [78] 4.1500030 4.1995204 4.2775326 4.4167704 4.5567597 4.6743124 4.6976680
 [85] 4.7612414 4.7641328 4.7650523 5.1358211 5.4933473 5.5012403 5.5291261
 [92] 5.6498649 5.9590712 6.1657579 6.2000705 6.2529279 6.5018501 6.6072377
 [99] 8.7439168 9.3663957

$w.l
  [1] 0.511914389 0.156787564 0.128626952 0.070035853 0.067625886 0.021986705
  [7] 0.021841766 0.009819692 0.009201162 0.002160032 0.000000000 0.000000000
 [13] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [19] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [25] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [31] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [37] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [43] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [49] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [55] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [61] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [67] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [73] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [79] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [85] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [91] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [97] 0.000000000 0.000000000 0.000000000 0.000000000

$w.u
  [1] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
  [7] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [13] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [19] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [25] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [31] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [37] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [43] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [49] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [55] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [61] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [67] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [73] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [79] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [85] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
 [91] 0.04277807 0.07446706 0.07671634 0.12167973 0.12795223 0.14795315
 [97] 0.13165012 0.12274983 0.08720177 0.06685170

$l.l
[1] 1

$l.u
[1] 10

$u.l
[1] 91

$u.u
[1] 100

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

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