yat  0.21pre
Public Member Functions | List of all members
theplu::yat::regression::NegativeBinomial Class Reference

#include <yat/regression/NegativeBinomial.h>

Inheritance diagram for theplu::yat::regression::NegativeBinomial:
theplu::yat::regression::Multivariate

Public Member Functions

double alpha (void) const
 alpha parameter More...
 
const utility::Matrixcovariance (void) const
 Covariance of parameters. More...
 
void fit2 (const utility::MatrixBase &x, const utility::VectorBase &y)
 fit model parameters More...
 
void fit (const utility::Matrix &X, const utility::VectorBase &y)
 
const utility::Vectorfit_parameters (void) const
 
double predict (const utility::VectorBase &x) const
 

Detailed Description

Negative Binomial regression models count data from a negative binomial distribution, $ y \in NB(r;p) $, for which the mean is $ \mu = \frac{pr}{1-p} $ is modeled as $ log(\mu) = \beta_0 + \beta_1 x_1 + ... + \beta_p x_p $ and the variance $ V = \frac{pr}{(1-p)^2} = \alpha m(x) $ where $ \alpha $ is the dispersion parameter $( \ge 1 )$ describing how wider the distribution is compared to Poisson; for $ \alpha = 1 $ the models equals Poisson regression.

Since
new in yat 0.15

Member Function Documentation

◆ alpha()

double theplu::yat::regression::NegativeBinomial::alpha ( void  ) const

alpha parameter

The alpha parameter describes the dispersion of the data. Greater alpha implies greater dispersion and unity alpha means the model is same as Poisson regression.

◆ covariance()

const utility::Matrix& theplu::yat::regression::NegativeBinomial::covariance ( void  ) const

Covariance of parameters.

Covariance matrix is inferred as $ \alpha \left( X' W X \right)^{-1} $ where $ W $ is a diagonal matrix with element $ W_{ii} = \mu_i $

◆ fit()

void theplu::yat::regression::NegativeBinomial::fit ( const utility::Matrix X,
const utility::VectorBase y 
)
virtual

Just kept for back compatibility with yat 0.19. Exactly the same behaviour as for fit2.

Implements theplu::yat::regression::Multivariate.

◆ fit2()

void theplu::yat::regression::NegativeBinomial::fit2 ( const utility::MatrixBase x,
const utility::VectorBase y 
)
virtual

fit model parameters

The parameters are tuned to minimise deviation between data and model $ 2 \sum_i y_i \ln (y_i / \mu_i) $

Each row in x represents a sample.

Since
New in yat 0.20

Reimplemented from theplu::yat::regression::Multivariate.

◆ fit_parameters()

const utility::Vector& theplu::yat::regression::NegativeBinomial::fit_parameters ( void  ) const
virtual
Returns
model parameters

Implements theplu::yat::regression::Multivariate.

◆ predict()

double theplu::yat::regression::NegativeBinomial::predict ( const utility::VectorBase x) const
virtual

Predicted value given x. The prediction is calculated as $ \exp{\beta_0 + \beta_1 x_1 +...+\beta_p x_p} $

Implements theplu::yat::regression::Multivariate.


The documentation for this class was generated from the following file:

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14