-
Notifications
You must be signed in to change notification settings - Fork 0
/
Estimator.h
34 lines (28 loc) · 1.3 KB
/
Estimator.h
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
#ifndef ESTIMATOR_H
#define ESTIMATOR_H
class Estimator{
public:
// confidence interval struct
// using a struct since the confidence interval is actually an
// entwined couple: an interval length, and a probability
struct confidence_interval{
double value; // length of interval
double probability; // how much probability is this covering
};
double estimate; // point estimate
confidence_interval interval; // confidence interval on the estimate
//double precision; // how much precise should the estimate be
bool satisfiesPrecision(double precision);
void setEstimate(double value);
void setInterval(double a_interval_length, double a_probability);
virtual double quantile(double p) =0; // returns the quantile associated to the given probability, based on the distribution of your object
virtual double quantile2tailed(double p) =0; // q such that there is p prob. between -q and q
};
// estimator in the case in which the variable is assumed to be
// distributed as a standard normal N(0,1)
class StdNormEstimator : public Estimator {
public:
double quantile(double p) override; // implementation of quantile() for standar normal
double quantile2tailed(double p) override;
};
#endif // ESTIMATOR_H