libatomprobe
Library for Atom Probe Tomography (APT) computation
confidence.h
Go to the documentation of this file.
1 /* confidence.cpp : confidence interval estimation routines
2  * Copyright (C) 2020 Daniel Haley
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef LIBATOMPROBE_CONFIDENCE_H
18 #define LIBATOMPROBE_CONFIDENCE_H
19 
20 #include <gsl/gsl_rng.h>
21 
22 namespace AtomProbe
23 {
25 // uses chi-square estimates from
26 // http://ms.mcmaster.ca/peter/s743/poissonalpha.html
27 // - Counts: Observed counts
28 // - alpha : confidence level for bounds (0->1, exclusive)
29 // - lBound : lower bound
30 // - uBound : upper bound
31 // - Note upper and lower bounds are absolutes, not delta.
32 // - Poisson confidence limits of poisson rate parameter, given some observed counts
33 // - technically "counts" is integral
34 void poissonConfidenceObservation(float counts, float alpha, float &lBound, float &uBound);
35 
37 
50 bool numericalEstimatePoissRatioConf(float lambda1,float lambda2, float alpha,
51  unsigned int nTrials, gsl_rng *r, float &lBound, float &uBound );
52 
53 
55 
71 bool numericalEstimateGaussRatioConf(float mu1,float mu2,float var1, float var2, float alpha,
72  unsigned int nTrials, gsl_rng *r,float &lBound, float &uBound );
73 
75 
83 bool numericalEstimateSkellamConf(float lambda1, float lambda2, float alpha,
84  unsigned int nTrials, gsl_rng *r, float &lBound,float &uBound);
85 
87 // are poisson distributed, summed together, you have observed the sum,
88 // but want to subtract the background.
106 bool zechConfidenceLimits(float lambdaBack, unsigned int observation, float alpha,
107  float &estimate);
108 
109 #ifdef DEBUG
110 bool runConfidenceTests();
111 #endif
112 }
113 #endif
bool numericalEstimateSkellamConf(float lambda1, float lambda2, float alpha, unsigned int nTrials, gsl_rng *r, float &lBound, float &uBound)
Brute-force the confidence bounds of a skellam distribution.
Definition: confidence.cpp:173
bool zechConfidenceLimits(float lambdaBack, unsigned int observation, float alpha, float &estimate)
Provides a best estimate for true signal when true signal, background.
Definition: confidence.cpp:406
void poissonConfidenceObservation(float counts, float alpha, float &lBound, float &uBound)
Obtain poisson confidence limits for the mean of a poisson distribution.
Definition: confidence.cpp:508
bool numericalEstimatePoissRatioConf(float lambda1, float lambda2, float alpha, unsigned int nTrials, gsl_rng *r, float &lBound, float &uBound)
Brute-force poisson ratio confidence estimator. Returns the confidence interval in the estimate of th...
Definition: confidence.cpp:68
bool numericalEstimateGaussRatioConf(float mu1, float mu2, float var1, float var2, float alpha, unsigned int nTrials, gsl_rng *r, float &lBound, float &uBound)
Brute-force guassian ratio confidence estimator.
Definition: confidence.cpp:275