ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
Functions
dgamma.cpp File Reference

Gamma density functions. More...

#include "statsLib.h"

Go to the source code of this file.

Functions

dvariable dgamma (const dvariable &x, const double &a, const double &b)
dvariable dgamma (const dvariable &x, const dvariable &a, const dvariable &b)
dvariable dgamma (const dvector &x, const prevariable &a, const prevariable &b)
dvariable dgamma (const dvector &x, const prevariable &a, const dvar_vector &b)
dvariable dgamma (const dvector &x, const dvar_vector &a, const dvar_vector &b)
dvariable dgamma (const dvector &x, const dvar_vector &a, const prevariable &b)

Detailed Description

Gamma density functions.

Author:
Steven Martell and Mollie Brooks
Date:
2/28/2011

This file contains the negative loglikelihood functions for the gamma distribution. The function dgamma is implemented as:

\[ -a \ln(b) + \ln(\Gamma(a)) - (a-1) \ln(x)+b x \]

The expected value is given by $ E(x)=a/b $ and the variance as $ V(x)=a/b^2 $. Note that you can also derive $a$ and $b$ from the expected value and variance via:

\[ a = \frac{E(x)^2}{V(x)}, \quad b=\frac{a}{V(x)} \]

Definition in file dgamma.cpp.


Function Documentation

dvariable dgamma ( const dvariable x,
const double &  a,
const double &  b 
)
Date:
2/28/2011
Author:
Steven Martell
Parameters:
xis the quantile and must be greater than 0.
ais the shape parameter and must be positive.
bis the rate parameter and must be positive.
Returns:
a dvariable object
See also:

Definition at line 37 of file dgamma.cpp.

dvariable dgamma ( const dvariable x,
const dvariable a,
const dvariable b 
)
Date:
2/28/2011
Author:
Steven Martell
Parameters:
xis the quantile and must be greater than 0.
ais the shape parameter and must be positive.
bis the rate parameter and must be positive.
Returns:
a dvariable object
See also:

Definition at line 66 of file dgamma.cpp.

dvariable dgamma ( const dvector x,
const prevariable a,
const prevariable b 
)
Date:
8/1/2011
Author:
Mollie Brooks
Parameters:
xis the quantile and must be greater than 0.
ais the shape parameter and must be positive.
bis the rate parameter and must be positive.
Returns:
a dvariable object $ \Sigma_i (-a \ln(b)+\ln(\Gamma(a))-(a-1)\ln(x_i)+b x_i) $
See also:

Definition at line 97 of file dgamma.cpp.

dvariable dgamma ( const dvector x,
const prevariable a,
const dvar_vector b 
)
Date:
8/1/2011
Author:
Mollie Brooks
Parameters:
xis the quantile and must be greater than 0.
ais the shape parameter and must be positive.
bis the rate parameter and must be positive.
Returns:
a dvariable object $ \Sigma_i (-a \ln(b_i)+\ln(\Gamma(a))-(a-1)\ln(x_i)+b_i x_i) $
See also:

Definition at line 129 of file dgamma.cpp.

dvariable dgamma ( const dvector x,
const dvar_vector a,
const dvar_vector b 
)
Date:
8/1/2011
Author:
Mollie Brooks
Parameters:
xis the quantile and must be greater than 0.
ais the shape parameter and must be positive.
bis the rate parameter and must be positive.
Returns:
a dvariable object $ \Sigma_i (-a_i \ln(b_i)+\ln(\Gamma(a_i))-(a_i-1)\ln(x_i)+b_i x_i) $
See also:

Definition at line 163 of file dgamma.cpp.

dvariable dgamma ( const dvector x,
const dvar_vector a,
const prevariable b 
)
Date:
8/1/2011
Author:
Mollie Brooks
Parameters:
xis the quantile and must be greater than 0.
ais the shape parameter and must be positive.
bis the rate parameter and must be positive.
Returns:
a dvariable object $ \Sigma_i (-a_i \ln(b)+\ln(\Gamma(a_i))-(a_i-1)\ln(x_i)+b x_i) $
See also:

Definition at line 197 of file dgamma.cpp.