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
x <- rgamma(100,3)
SPIn(x)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(SPIn)
Loading required package: quadprog
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/SPIn/SPIn.Rd_%03d_medium.png", width=480, height=480)
> ### Name: SPIn
> ### Title: Simulation Efficient Shortest Probability Intervals
> ### Aliases: SPIn
> ### Keywords: ~kwd1 ~kwd2
>
> ### ** Examples
>
> x <- rgamma(100,3)
> SPIn(x)
$spin
[1] 0.8731362 6.2353431
$conf
[1] 0.95
$x
[1] 0.8731362 0.9871522 1.0558732 1.1668564 1.2114516 1.2161766 1.2191626
[8] 1.2253897 1.2696120 1.2802791 1.3026940 1.3146275 1.3280116 1.3396666
[15] 1.3399785 1.3589106 1.3595420 1.4139395 1.4381359 1.4813411 1.4904952
[22] 1.6038785 1.6212158 1.7864210 1.7875888 1.8365196 1.8635843 1.8655068
[29] 1.9502865 1.9793630 2.0152992 2.0363913 2.0377646 2.1136084 2.1242802
[36] 2.1256695 2.1944526 2.2184076 2.2547789 2.2664642 2.3064149 2.3345573
[43] 2.3855791 2.4562916 2.4572719 2.4686588 2.5017802 2.5049358 2.5226197
[50] 2.5312020 2.5605094 2.6196931 2.6275438 2.6422086 2.7469309 2.7749754
[57] 2.7773988 2.7806952 2.7955978 2.8550509 2.9081935 2.9160845 2.9243735
[64] 2.9559564 3.0106494 3.0934089 3.1163127 3.2062127 3.3380218 3.4421001
[71] 3.4678231 3.4934997 3.5318192 3.5752255 3.7136507 3.7549733 3.7926999
[78] 3.7964829 3.9181516 3.9977932 4.0561023 4.1384228 4.5975566 4.6790302
[85] 4.6979950 4.7481469 4.8273851 4.9627150 5.0087649 5.0604596 5.1833879
[92] 5.4571533 5.5782716 5.9464899 5.9870605 6.1728587 7.3123466 7.4854247
[99] 7.7278347 7.9183307
$w.l
[1] 1
$w.u
[1] 0.10945234 0.11529187 0.11787537 0.12572962 0.12659501 0.12263185 0.09832610
[8] 0.09463428 0.08946357
$l.l
[1] 1
$l.u
[1] 1
$u.l
[1] 91
$u.u
[1] 99
attr(,"class")
[1] "SPIn"
>
>
>
>
>
> dev.off()
null device
1
>