35#ifndef STK_LAW_GAMMA_H
36#define STK_LAW_GAMMA_H
214GetRNGstate();
Real s = Rf_rgamma(a, b); PutRNGstate();
return s;
218{
return Rf_dgamma(x, a, b,
false);}
220{
return Rf_dgamma(x, a, b,
true);}
222{
return Rf_pgamma(t, a, b,
true,
false);}
224{
return Rf_qgamma(p, a, b,
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.
Real a_
The shape parameter.
Real b_
The scale parameter.
Real const & shape() const
virtual Real pdf(Real const &x) const
compute
virtual Real lpdf(Real const &x) const
Compute.
Real const & scale() const
virtual Real rand() const
generate a gamma random variate using the G.S algorithm of Ahrens and Dieter (1974) for 0<a_<1 and Ma...
void setScale(Real const &scale)
void setShape(Real const &shape)
Gamma(Real const &shape=1., Real const &scale=1.)
Default constructor.
Real c_
First and second constants for rand.
virtual Real icdf(Real const &p) const
virtual Real cdf(Real const &t) const
void computeCtes() const
compute c_ and d_
virtual ~Gamma()
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.
The namespace STK is the main domain space of the Statistical ToolKit project.
Arithmetic properties of STK fundamental types.