35#ifndef STK_LAW_BINOMIAL_H
36#define STK_LAW_BINOMIAL_H
82 inline int n()
const {
return n_;}
200GetRNGstate();
int s = Rf_rbinom(
n,
prob); PutRNGstate();
return s;
204{
return (
Real)Rf_dbinom(x, (
double)
n,
prob,
false);}
206{
return (
Real)Rf_dbinom((
double)x, (
double)
n,
prob,
true);}
208{
return (
Real)Rf_pbinom(t, (
double)
n,
prob,
true,
false);}
210{
return Rf_qbinom(p, (
double)
n,
prob,
true,
false);}
In this file we define the interface base class IUnivLaw for all probabilities laws.
#define STKDOMAIN_ERROR_1ARG(Where, Arg, Error)
#define STKDOMAIN_ERROR_2ARG(Where, Arg1, Arg2, Error)
#define _T(x)
Let x unmodified.
Binomial probability law.
virtual Integer icdf(Real const &p) const
inverse cumulative distribution function The quantile is defined as the smallest value x such that F...
Real const & prob() const
virtual Real cdf(Real const &t) const
compute the cumulative distribution function Give the probability that a Binomial random variate is l...
virtual Integer rand() const
virtual Real lpdf(Integer const &x) const
compute the log probability distribution function Give the value of the log-pdf at the point x.
virtual Real pdf(Integer const &x) const
compute the probability distribution function (density) Give the value of the pdf at the point x.
void setProb(Real const &prob)
Binomial(int n=1, Real const &prob=0.5)
constructor
Real prob_
probability of success in a Bernoulli trial
virtual ~Binomial()
destructor
Interface base class for all the univariate distributions.
virtual Real cdfc(Real const &t) const
calculate the complement of cumulative distribution function, called in statistics the survival funct...
virtual Real lcdfc(Real const &t) const
calculate the log-complement of cumulative distribution function Give the log-probability that a rand...
virtual Real lcdf(Real const &t) const
compute the lower tail log-cumulative distribution function Give the log-probability that a random va...
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
double Real
STK fundamental type of Real values.
int Integer
STK fundamental type of integer values.
The namespace STK is the main domain space of the Statistical ToolKit project.