|
| | GeometricRand (double probability=0.5) |
| |
| std::string | Name () const override |
| |
| void | SetProbability (double probability) |
| |
| double | P (const IntType &k) const override |
| |
| double | logP (const IntType &k) const override |
| |
| double | F (const IntType &k) const override |
| |
| double | S (const IntType &k) const override |
| |
| template<std::uniform_random_bit_generator G> |
| IntType | operator() (G &g) const |
| |
| IntType | Median () const override |
| |
| long double | Entropy () const |
| |
Public Member Functions inherited from randlib::NegativeBinomialRand< IntType, T > |
| | NegativeBinomialRand (T number=1, double probability=0.5) |
| |
| std::string | Name () const override |
| |
| void | Fit (std::span< const IntType > sample) |
| | set number and probability, estimated via maximum-likelihood method
|
| |
Public Member Functions inherited from randlib::NegativeBinomialDistribution< IntType, T > |
| Support | SupportType () const override |
| |
| IntType | MinValue () const override |
| |
| IntType | MaxValue () const override |
| |
| double | GetProbability () const noexcept |
| |
| T | GetNumber () const noexcept |
| |
| double | P (const IntType &k) const override |
| |
| double | logP (const IntType &k) const override |
| |
| double | F (const IntType &k) const override |
| |
| double | S (const IntType &k) const override |
| |
| template<std::uniform_random_bit_generator G> |
| IntType | operator() (G &g) const |
| |
| long double | Mean () const override |
| |
| long double | Variance () const override |
| |
| IntType | Mode () const override |
| | Mode is the value, which has the largest probability to happen, or, in the case of continuous distribution, has the largest value of density function.
|
| |
| long double | Skewness () const override |
| |
| long double | ExcessKurtosis () const override |
| |
| BetaRand | FitProbabilityBayes (std::span< const IntType > sample, const BetaDistribution<> &priorDistribution, bool MAP=false) |
| |
Public Member Functions inherited from randlib::DiscreteDistribution< IntType > |
| virtual | ~DiscreteDistribution () |
| |
| void | ProbabilityMassFunction (std::span< const IntType > x, std::span< double > y) const |
| | fill vector y with P(x)
|
| |
| void | LogProbabilityMassFunction (std::span< const IntType > x, std::span< double > y) const |
| | fill vector y with logP(x)
|
| |
| double | Hazard (const IntType &x) const override |
| |
| double | LikelihoodFunction (std::span< const IntType > sample) const override |
| |
| double | LogLikelihoodFunction (std::span< const IntType > sample) const override |
| |
| bool | PearsonChiSquaredTest (std::span< const IntType > orderStatistic, double alpha, int lowerBoundary, int upperBoundary, size_t numberOfEstimatedParameters=0) const |
| |
| bool | PearsonChiSquaredTest (std::span< const IntType > orderStatistic, double alpha, size_t numberOfEstimatedParameters=0) const |
| |
Public Member Functions inherited from randlib::UnivariateDistribution< IntType > |
| virtual | ~UnivariateDistribution () |
| |
| bool | isLeftBounded () const |
| |
| bool | isRightBounded () const |
| |
| IntType | Quantile (double p) const |
| |
| IntType | Quantile1m (double p) const |
| |
| void | QuantileFunction (std::span< const double > p, std::span< IntType > y) const |
| |
| void | QuantileFunction1m (std::span< const double > p, std::span< IntType > y) const |
| |
| std::complex< double > | CF (double t) const |
| |
| void | CharacteristicFunction (std::span< const double > t, std::span< std::complex< double > > y) const |
| |
| void | HazardFunction (std::span< const IntType > x, std::span< double > y) const |
| |
| virtual long double | Kurtosis () const |
| |
| virtual long double | SecondMoment () const |
| |
| virtual long double | ThirdMoment () const |
| |
| virtual long double | FourthMoment () const |
| |
Public Member Functions inherited from randlib::ProbabilityDistribution< T > |
| virtual | ~ProbabilityDistribution ()=default |
| |
| virtual double | F (const T &x) const =0 |
| |
| void | CumulativeDistributionFunction (std::span< const T > x, std::span< double > y) const |
| |
| virtual double | S (const T &x) const |
| |
| void | SurvivalFunction (std::span< const T > x, std::span< double > y) const |
| |
| template<std::uniform_random_bit_generator G> |
| T | operator() (G &g) const |
| | Draws a variate with the given engine through the virtual interface.
|
| |
| T | Variate () const |
| | Uses the engine of this object, so it is not thread-safe for one object; use operator() with one engine per thread instead.
|
| |
| void | Sample (std::span< T > outputData) const |
| | Fills the output with variates drawn with the engine of this object.
|
| |
| template<std::uniform_random_bit_generator G> |
| void | Sample (G &g, std::span< T > outputData) const |
| | Fills the output with variates drawn with the given engine.
|
| |
| void | Reseed (std::uint64_t seed) |
| |
|
Public Types inherited from randlib::ProbabilityDistribution< T > |
| using | value_type = T |
| |
Static Public Attributes inherited from randlib::NegativeBinomialRand< IntType, T > |
| static constexpr char | TOO_SMALL_VARIANCE [] = "Sample variance should be greater than sample mean" |
| |
Protected Types inherited from randlib::NegativeBinomialDistribution< IntType, T > |
| enum | GENERATOR_ID { TABLE
, EXPONENTIAL
, GAMMA_POISSON
} |
| |
Protected Member Functions inherited from randlib::NegativeBinomialDistribution< IntType, T > |
| | NegativeBinomialDistribution (T number=1, double probability=0.5) |
| |
| void | SetParameters (T number, double probability) |
| |
| GENERATOR_ID | GetIdOfUsedGenerator () const |
| | For a small integer r the variate is a sum of r geometric variates, drawn by a table or, for p < 0.08 where the tail is too heavy for the table, as the integer part of an exponential variate.
|
| |
| template<std::uniform_random_bit_generator G> |
| IntType | variateGeometricByTable (G &g) const |
| |
| template<std::uniform_random_bit_generator G> |
| IntType | variateGeometricThroughExponential (G &g) const |
| |
Protected Member Functions inherited from randlib::DiscreteDistribution< IntType > |
| | DiscreteDistribution () |
| |
| IntType | quantileImpl (double p, IntType initValue) const override |
| |
| IntType | quantileImpl (double p) const override |
| |
| IntType | quantileImpl1m (double p, IntType initValue) const override |
| |
| IntType | quantileImpl1m (double p) const override |
| |
| long double | ExpectedValue (const std::function< double(IntType)> &funPtr, IntType minPoint, IntType maxPoint) const override |
| |
Protected Member Functions inherited from randlib::UnivariateDistribution< IntType > |
| | UnivariateDistribution () |
| |
Protected Member Functions inherited from randlib::ProbabilityDistribution< T > |
| std::string | toStringWithPrecision (const double a_value, const int n=6) const |
| |
| | ProbabilityDistribution ()=default |
| |
| DefaultEngine & | engine () const |
| |
| virtual void | sample (detail::EngineRef g, std::span< T > outputData) const |
| | Fills the output with variate(g); distributions with a faster bulk algorithm override it.
|
| |
| fit_error | fitError (FitErrorCode code, const std::string &explanation) const |
| |
Static Protected Member Functions inherited from randlib::UnivariateDistribution< IntType > |
| static bool | allElementsAreNotGreaterThan (IntType value, std::span< const IntType > sample) |
| |
| static bool | allElementsAreNotSmallerThan (IntType value, std::span< const IntType > sample) |
| |
| static bool | allElementsAreNonNegative (std::span< const IntType > sample) |
| |
| static bool | allElementsArePositive (std::span< const IntType > sample) |
| |
Protected Attributes inherited from randlib::NegativeBinomialDistribution< IntType, T > |
| double | p = 0.5 |
| | probability of failure
|
| |
| double | q = 0.5 |
| | probability of success
|
| |
| double | logProb = -randlib::consts::ln2 |
| | log(p)
|
| |
| double | log1mProb = -randlib::consts::ln2 |
| | log(q)
|
| |
Static Protected Attributes inherited from randlib::ProbabilityDistribution< T > |
| static constexpr size_t | MAX_ITER_REJECTION = detail::MAX_ITER_REJECTION |
| | MAX_ITER_REJECTION upper boundary for maximum amount of iterations in rejection methods one thousand should be enough to be sure there is a bug (or rejection method is too slow to be used)
|
| |
| static constexpr char | POSITIVITY_VIOLATION [] = "All elements should be positive" |
| |
| static constexpr char | NON_NEGATIVITY_VIOLATION [] = "All elements should be non-negative" |
| |
| static constexpr char | UPPER_LIMIT_VIOLATION [] = "No element should be greater than " |
| |
| static constexpr char | LOWER_LIMIT_VIOLATION [] = "No element should be smaller than " |
| |
template<typename IntType>
class randlib::GeometricRand< IntType >
The GeometricRand class
Geometric distribution.
P(X = k) = p (1 - p)^k
Notation: X ~ Geometric(p)
Related distributions:
X ~ NB(1, p)