-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsmallNumberStatistics.lyx
More file actions
1603 lines (1267 loc) · 38.7 KB
/
smallNumberStatistics.lyx
File metadata and controls
1603 lines (1267 loc) · 38.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass emulateapj
\begin_preamble
\end_preamble
\use_default_options true
\begin_modules
enumitem
\end_modules
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref true
\pdf_bookmarks true
\pdf_bookmarksnumbered true
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks false
\pdf_pdfborder true
\pdf_colorlinks false
\pdf_backref section
\pdf_pdfusetitle true
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 2
\tocdepth 2
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Abstract
We describe novel methods for determining accurate confidence limits using
the binomial and Poisson distributions for small datasets; explore how
and when each distribution should be used; and provide code implementing
our methods.
Example applications from astronomy are briefly described.
\end_layout
\begin_layout Standard
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
keywords{Methods: data analysis --- Methods: statistical}
\end_layout
\begin_layout Plain Layout
\backslash
title{Counting Statistics for Small Datasets}
\end_layout
\begin_layout Plain Layout
\backslash
author{Tim Haines, Daniel H McIntosh}
\end_layout
\begin_layout Plain Layout
\backslash
affil{Department of Physics and Astronomy, University of Missouri - Kansas
City, 5110 Rockhill Road, Kansas City, MO 64110, USA}
\end_layout
\end_inset
\end_layout
\begin_layout Section
Introduction
\end_layout
\begin_layout Standard
Being at the forefront of observational astronomy requires competing for
ever-increasingly expensive telescope time.
This drives the need to derive as much information from as few observations
as possible.
Moreover, if our small number of observations are to be used in an attempt
to discriminate between competing hypotheses, correctly determining the
confidence limits of our data is paramount.
If these values are not precisely determined, then we may incorrectly conclude
that our data do not allow for the exclusion of a hypothesis that is not
actually supported by the data or vice versa.
\end_layout
\begin_layout Standard
To understand the precision of a measurement, we represent our answer within
a possible range of values (confidence limits) based on a confidence level
(CL).
The confidence level answers the question,
\begin_inset Quotes eld
\end_inset
How certain do I want to be of my measurements?
\begin_inset Quotes erd
\end_inset
The confidence limits answer the question,
\begin_inset Quotes eld
\end_inset
What are the minimum and maximum values of the interval that contains the
true value of my measurement with the certainty of my confidence level?
\begin_inset Quotes erd
\end_inset
The choice of CL is usually given as a multiple of the standard deviation
(e.g., the
\begin_inset Quotes eld
\end_inset
1-sigma
\begin_inset Quotes erd
\end_inset
level) or as a percent (e.g., the 95% confidence level) reflecting the desired
coverage of variance.
\end_layout
\begin_layout Standard
Before the confidence limits are computed, an assumption of underlying distribut
ion is made for the data.
The ever-vigilant normal distribution is nearly always the go-to for the
assumed distribution of measurements in astronomy.
This isn't always an incorrect assumption.
The Central Limit Theorem tells us that as the number of observations increases
to a sufficiently large size (formally, infinity), the distribution of
measured values will take on the form of the normal (Gaussian) distribution.
The sole assumption is that the errors are small, random, and not systematic.
However, we will see that the normal distribution is insufficient for accuratel
y describing confidence limits when the number of measurements is small.
Instead, we must rely on distributions such as the Poisson or binomial
when our data do not satisfy the conditions of the Central Limit Theorem.
\end_layout
\begin_layout Standard
Much effort has been put forth to find ways of computing confidence limits
for small data sets as accurately and as simply as possible.
The most prominent of which is the long-standing work of
\begin_inset CommandInset citation
LatexCommand citet
before "G86;"
key "gehrels1986"
literal "true"
\end_inset
.
\begin_inset CommandInset citation
LatexCommand citet
key "ebeling2003"
literal "true"
\end_inset
expands the G86 approximations for the Poisson distribution in the regime
of very large confidence levels.
Efforts to utilize Bayesian analysis
\begin_inset CommandInset citation
LatexCommand citep
key "kraft1991,cameron2011"
literal "true"
\end_inset
have been fruitful in providing more accurate coverage of the confidence
intervals.
We describe a novel method of accurately and quickly computing confidence
limits of the binomial and Poisson distributions by exploiting the fact
that their respecitve cummulative distribution functions are the well-known
incomplete beta and complemented incomplete gamma functions.
Our method removes the reliance on approximations, interpolation in tables,
or resorting to direct solution of the inverse of a cumulative distribution
function (cf.
\begin_inset CommandInset citation
LatexCommand cite
key "clopper1934"
literal "true"
\end_inset
).
Further, we provide code in three of the most common languages used in
the astronomical community to facilitate utilization of our method.
\end_layout
\begin_layout Subsection
Confidence Limits and Coverage
\end_layout
\begin_layout Standard
Explain one-sided versus two-sided.
Explain coverage with an analogy of throwing darts at a target with a circle
drawn on it.
If you make the circle bigger (i.e., increase the confidence level), you
are more likely to put a dart inside of the circle.
Have a robot throw a random (but unknown!) number of darts.
You count the number of darts inside the circle.
If you make it smaller, then you have a better chance of knowing that any
dart inside of the circle came close to the center of the circle, but far
fewer darts will be inside of the circle.
\end_layout
\begin_layout Subsection
An Illustrative Example
\end_layout
\begin_layout Standard
\begin_inset CommandInset label
LatexCommand label
name "subsec:An-Illustrative-Example"
\end_inset
Here, we work through an example situation that is the primary driver for
this work.
Let us assume that we have two hypothetical initial mass functions (IMFs)
which differ only in the predicted fraction of nebulae containing more
than 30% A-type stars.
The first IMF predicts that the fraction of nebulae will never exceed 20%.
The second IMF predicts that the fraction of nebulae can exceed 20%.
Taking the prediction of the first IMF to be the null hypothesis, we perform
our tests against the second IMF.
Using a sample of fifty nebulae found in the Milky Way, we count the number
of A-type stars in each and find that 5 (10%) nebulae have more than 30%
A-type stars.
\end_layout
\begin_layout Standard
Since all measurements contain random error, we must now attempt to quantify
it.
If we treat the fraction of nebulae we observed to have more than 30% A-type
stars as a probability and assume that the data are normally distributed,
we find the upper and lower confidence limits at the 1-sigma confidence
level (see Section
\begin_inset CommandInset ref
LatexCommand ref
reference "sec:CalcConfLims"
\end_inset
) to be 24.1% and 0%, respectively.
Given these confidence limits, we see that the fraction of nebulae having
more than 30% A-type stars can exceed 20% (the upper limit being
\begin_inset Formula $\sim24$
\end_inset
%), so we reject the null hypothesis.
As we shall see later in Section
\begin_inset CommandInset ref
LatexCommand ref
reference "sec:Distributions"
\end_inset
, this problem is more appropriately described by the binomial distribution
where a
\begin_inset Quotes eld
\end_inset
success
\begin_inset Quotes erd
\end_inset
is taken as a nebula having more than 30% A-type stars.
Under this assumption, we find that the upper and lower confidence limits
at the 1-sigma confidence level are
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none
15.89
\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\uuline default
\uwave default
\noun default
\color inherit
% and 7.19%, respectively, so we accept the null hypothesis.
\end_layout
\begin_layout Standard
Clearly, the choice of assumed distribution strongly affects the outcome
of our analysis.
Our first priority, then, is to determine which distribution best describes
our measurements.
In Section
\begin_inset CommandInset ref
LatexCommand ref
reference "sec:Distributions"
\end_inset
, we discuss the definitions, characteristics, and usages of the two most
relevant distributions for
\shape italic
small
\shape default
datasets in astrophysics: the binomial and the Poisson, and provide a general
overview of the normal distribution.
The technical details of how confidence limits are calculated using these
distributions is provided in Section
\begin_inset CommandInset ref
LatexCommand ref
reference "sec:CalcConfLims"
\end_inset
.
We compare the normal, binomial, and Poisson distributions in the small
number regime in Section
\begin_inset CommandInset ref
LatexCommand ref
reference "sec:discussion"
\end_inset
.
In Section
\begin_inset CommandInset ref
LatexCommand ref
reference "sec:discussion"
\end_inset
, we provide a comparison of our methods of computing confidence limits
to the long-standing and ubiquitous methods provided in G86.
Finally, Section
\begin_inset CommandInset ref
LatexCommand ref
reference "sec:Using-Our-Code"
\end_inset
outlines computing confidence limits using our freely-distributed code.
\end_layout
\begin_layout Section
Distributions
\end_layout
\begin_layout Standard
\begin_inset CommandInset label
LatexCommand label
name "sec:Distributions"
\end_inset
There are a multitude of distributions governing the statistics of discrete
processes.
Most of them are strongly related– sometimes varying only in a single requireme
nt (e.g., the binomial and hypergeometric distributions differ only in assumption
of independence).
Nearly all measurements in astrophysics can be described or approximated
by the normal, Poisson, or binomial distribution.
Here, we outline of the properties of each.
\end_layout
\begin_layout Subsection
Normal Distribution
\end_layout
\begin_layout Standard
The normal (Gaussian) distribution is the most ubiquitous distribution in
all of statistics as its relatively simple form allows modelling complex
processes with minimal computational overhead.
The Central Limit Theorem guarantees statistical utility inconsequential
of the real distribution underlying the data– so long as a sufficiently
large number of measurements are performed.
Given its simplicity and utility, it is no surprise that it finds a great
deal of use in the astronomical community.
But it does have limitations; especially when the number of measurements
is small.
Exactly how large that number must be is explored in detail in Section
\begin_inset CommandInset ref
LatexCommand ref
reference "sec:discussion"
\end_inset
.
\end_layout
\begin_layout Subsection
Binomial Distribution
\end_layout
\begin_layout Standard
\begin_inset CommandInset label
LatexCommand label
name "subsec:BinomialDist"
\end_inset
The binomial distribution describes performing a measurement as executing
a trial of some particular process having only two possible outcomes.
These outcomes are most normally labeled
\begin_inset Quotes eld
\end_inset
success
\begin_inset Quotes erd
\end_inset
and
\begin_inset Quotes eld
\end_inset
failure
\begin_inset Quotes erd
\end_inset
with the actual meaning depending on the process being tested.
Each measurement is performed in exactly the same way- that is, every trial
must be performed by an identical method.
The outcome between any two trials is assumed to be equally likely such
that the order in which the trials are performed is inconsequential.
Mathematicians would say that the binomial distribution describes
\begin_inset Quotes eld
\end_inset
the output of performing N Bernoulli trials.
\begin_inset Quotes erd
\end_inset
\end_layout
\begin_layout Standard
Examples of this type of behavior are demonstrated in determining the fraction
of red galaxies in a mass range, the relative ratio of mergers for blue
and red galaxies at a given redshift, or testing a statement by making
observations which can be described as a success or failure (e.g., our example
problem in Section
\begin_inset CommandInset ref
LatexCommand ref
reference "subsec:An-Illustrative-Example"
\end_inset
).
Generally, the binomial distribution is used when the outcome can, essentially,
be determined by the flip of a coin or the roll of a die.
Specifically, it is used whenever a fraction is computed.
\end_layout
\begin_layout Subsection
Poisson Distribution
\end_layout
\begin_layout Standard
\begin_inset CommandInset label
LatexCommand label
name "subsec:PoissonDist"
\end_inset
The Poisson distribution describes any process having events that are discrete,
random, and independent.
Given the generic nature of these characteristics, the Poisson distribution
is often used for describing stochastic processes such as time- or space-rates
of events.
\end_layout
\begin_layout Standard
Examples of this type of behavior are the detection of photons at a CCD,
determining rate at which galaxies are merging in a fixed volume, the number
of supernovae since z=1, or the number of S0 galaxies in a cluster.
Because the defining characteristics of the Poisson distribution are so
generic, it is most often the type of distribution underlying any type
of time analysis.
The principal parameter of the distribution is known as the Poisson parameter
(usually denoted as λ), and is taken to be the average rate of the events
being measured– a fact that should be kept in mind when expressing Poisson
confidence limits.
\end_layout
\begin_layout Section
Calculating Confidence Limits
\end_layout
\begin_layout Standard
\begin_inset CommandInset label
LatexCommand label
name "sec:CalcConfLims"
\end_inset
Each distribution has a different set of rules for computing confidence
limits.
However, the double-sided confidence levels always come from the standard
normal distribution via the formula
\begin_inset Formula
\begin{equation}
\begin{array}{ccl}
CL\left(S\right) & = & \frac{1}{\sqrt{2\pi}}\int_{-S}^{S}\exp\left(-z^{2}/2\right)dz\\
& = & erf\left(S/\sqrt{2}\right)
\end{array}\label{eq:CL}
\end{equation}
\end_inset
where S is the number of standard deviations desired and
\begin_inset Formula $erf$
\end_inset
is the error function.
For instance, the more famous confidence limits are the 1-sigma level at
68.26%, the 2-sigma level at 95.45%, and the 3-sigma level at 99.73%.
\end_layout
\begin_layout Standard
We usually consider probability distributions by thinking about finding
the cumulative probability of a sequence of events knowing the probability
of an individual event (or the mean of many).
However, the probability of an individual event is precisely what we wish
to find in order to assign confidence limits to our measurements.
We thus have to think about the inverse of a probability distribution.
This is not an easy task as most probability distribution functions are
given in terms of complicated transcendental functions whose inverses do
not have closed-form solutions.
We outline our methods for determining the confidence limits of each distributi
on.
\end_layout
\begin_layout Subsection
Normal Confidence Limits
\end_layout
\begin_layout Standard
\begin_inset CommandInset label
LatexCommand label
name "subsec:NormalConfLims"
\end_inset
For large samples of
\begin_inset Formula $N$
\end_inset
observations, the two-sided upper and lower confidence limits may be estimated
by the standard deviation of the mean (also known as the standard error)
given the sample mean
\begin_inset Formula $\bar{x}$
\end_inset
and non-biased sample standard deviation
\begin_inset Formula $s$
\end_inset
by
\begin_inset Formula
\begin{equation}
\bar{x}\pm\frac{s}{\sqrt{N}}.\label{eq:SDOM}
\end{equation}
\end_inset
Often in astronomy, the confidence limits are computed by assuming
\begin_inset Formula $s=1$
\end_inset
in Equation
\begin_inset CommandInset ref
LatexCommand eqref
reference "eq:SDOM"
\end_inset
.
In this instance, the sample is said to come from the
\shape italic
standard
\shape default
normal distribution, and the limits are referred to as the
\begin_inset Quotes eld
\end_inset
root-N
\begin_inset Quotes erd
\end_inset
limits.
For the example problem in Section
\begin_inset CommandInset ref
LatexCommand ref
reference "subsec:An-Illustrative-Example"
\end_inset
taking
\begin_inset Formula $\bar{x}=5/50=0.1$
\end_inset
,
\begin_inset Formula $N=50$
\end_inset
, and
\begin_inset Formula $s=1$
\end_inset
, we calculate the root-N limits to be 24.1% and 0% as shown there.
The lower limit is actually found to be negative, but negative probabilities
are not allowed so we clip to 0%.
\end_layout
\begin_layout Standard
If we know that our small sample of measurements is truly drawn from the
normal distribution, then the confidence limits are given by
\begin_inset Formula $U_{CL}=\bar{x}\pm t^{\prime}\,s/\sqrt{N}$
\end_inset
where
\begin_inset Formula $t^{\prime}$
\end_inset
is the parameter for the Student's t-distribution with
\begin_inset Formula $N-1$
\end_inset
degrees of freedom at the
\begin_inset Formula $CL$
\end_inset
confidence level
\begin_inset Foot
status collapsed
\begin_layout Plain Layout
The student's t-distribution uses the significance level,
\begin_inset Formula $\alpha$
\end_inset
, given by
\begin_inset Formula $\alpha=1-\mathtt{CL}$
\end_inset
.
\end_layout
\end_inset
.
For our example problem, the confidence limits are
\begin_inset Formula $U_{1\sigma}=0.1\pm0.3795\cdot\left(1/\sqrt{50}\right)$
\end_inset
giving 15.37% and 4.63% for the upper and lower limits, respectively.
These values are much closer to those achieved using the binomial distribution
as discussed in Section
\begin_inset CommandInset ref
LatexCommand ref
reference "subsec:An-Illustrative-Example"
\end_inset
.
\end_layout
\begin_layout Subsection
Binomial Confidence Limits
\end_layout
\begin_layout Standard
\begin_inset CommandInset label
LatexCommand label
name "subsec:binConfLimits"
\end_inset
Utilizing the same process employed by the inverse binomial distribution
(
\noun on
bdtri)
\noun default
function in the Cephes
\begin_inset Foot
status collapsed
\begin_layout Plain Layout
© Stephen Mosier; http://www.netlib.org/cephes/
\end_layout
\end_inset
library, we compute binomial confidence limits by using the relationship
between the binomial distribution and the incomplete beta function.
For a measurement of
\begin_inset Formula $N_{s}$
\end_inset
successes out of a total of
\begin_inset Formula $N$
\end_inset
Bernoulli trials, we seek the event probability
\begin_inset Formula $p$
\end_inset
such that the sum of the terms 0 through
\begin_inset Formula $N_{s}$
\end_inset
of the binomial probability density function is equal to the specified
cumulative probability
\begin_inset Formula $y$
\end_inset
.
This is accomplished by using the inverse of the regularized incomplete
beta function
\begin_inset Formula $B^{-1}\left(a,b;y\right)$
\end_inset
and the relation
\begin_inset Newline linebreak
\end_inset
\begin_inset Formula $p=1-B^{-1}(a,b;y)$
\end_inset
.
To find the solution to this equation, we find the event probability
\begin_inset Foot
status collapsed
\begin_layout Plain Layout
In computing the event probability, we consider only the comparison of the
number of events of a single type to the total number of events (e.g., number
of successes as a fraction of total), and refer the reader to G86 for other
types of comparisons.
\end_layout
\end_inset
\begin_inset Formula $p$
\end_inset
such that
\begin_inset Formula
\begin{equation}
\begin{array}{ccl}
y & = & B\left(p;\,a,\,b\right)\\
& = & \int_{0}^{p}t^{a-1}\left(1-t\right)^{b-1}dt
\end{array}\label{eq:incbi}
\end{equation}
\end_inset
where
\begin_inset Formula $B\left(p;a,b\right)$
\end_inset
is the regularized incomplete beta function.
We solve Equation
\begin_inset CommandInset ref
LatexCommand eqref
reference "eq:incbi"
\end_inset
using the bisection root-finding algorithm with an initial value of
\begin_inset Formula $0.5$
\end_inset
and search radius of
\begin_inset Formula $0.5$
\end_inset
to ensure convergence to the correct value of
\begin_inset Formula $p$
\end_inset
.
\end_layout
\begin_layout Standard
Assuming the normalized liklihood from
\begin_inset CommandInset citation
LatexCommand citet
key "cameron2011"
literal "true"
\end_inset
, the upper and lower double-sided confidence limits are computed using
the beta distribution parameters
\begin_inset Formula $a=N_{s}+1$
\end_inset
,
\begin_inset Formula $b=N-N_{s}+1$
\end_inset
, and
\begin_inset Formula $y=\left(1-CL\right)/2$
\end_inset
.
Combining these with the Cephes definition of
\begin_inset Formula $B^{-1}\left(a,b;y\right)$
\end_inset
, we find the upper and lower limits are given by
\begin_inset Formula $p_{u}=1-B^{-1}\left(a,b;y\right)$
\end_inset
and
\begin_inset Formula $p_{l}=1-B^{-1}\left(a,b;1-y\right)$
\end_inset
, respectively.
\end_layout
\begin_layout Standard
The confidence limits in our example problem are computed with
\begin_inset Formula $y=\left(1-CL(1)\right)/2$
\end_inset
(cf.
Equation
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:CL"
\end_inset
),
\begin_inset Formula $N=50$
\end_inset
, and
\begin_inset Formula $N_{s}=5$
\end_inset
.
Solving Equation
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:incbi"
\end_inset
with these parameters gives an upper confidence limit of
\begin_inset Formula $p_{u}=15.89\%$
\end_inset
and a lower limit of
\begin_inset Formula $p_{l}=7.19\%$
\end_inset
.
\end_layout
\begin_layout Subsection
Poisson Confidence Limits
\end_layout
\begin_layout Standard
\begin_inset CommandInset label
LatexCommand label
name "subsec:PoissonConfLims"
\end_inset
Mirroring the method of the inverse Poisson distribution
\noun on
(pdtri)
\noun default
function in the Cephes library, we determine confidence limits by exploiting
the relationship between the Poisson distribution and the complemented
incomplete gamma function.
For a measurement of K Poisson events, we seek the Poisson parameter λ
such that the integral from 0 to λ of the Poisson probability density function
is equal to the given cumulative probability
\begin_inset Formula $y$
\end_inset
.
This is accomplished by using the inverse complemented lower incomplete
gamma function and the relation
\begin_inset Formula $\lambda=\gamma^{-1}\left(a;y\right)$
\end_inset
.
To find the solution to this equation, we find the parameter λ such that
\begin_inset Formula
\begin{equation}
y=1-\gamma\left(\lambda,a\right)=1-\int_{0}^{\lambda}t^{a-1}e^{-t}dt\label{eq:igami}
\end{equation}
\end_inset
We use the bisection root-finding algorithm with the starting point
\begin_inset Formula $\lambda=K\left[1-\frac{1}{9K}-\sqrt{\frac{1}{9K}}\Phi^{-1}(y)\right]^{3}$
\end_inset
where
\begin_inset Formula $\Phi^{-1}$
\end_inset
is the inverse of the standard normal distribution used in the Cephes
\noun on
pdtri
\noun default
function, and allow only positive roots as the Poisson parameter is defined
to be positive.
For the two-sided confidence interval, we utilize the parameters outlined
in Equation (15) of