[Regressor] Gamma Regression

안암동컴맹·2024년 4월 6일
0

Machine Learning

목록 보기
85/103

Gamma Regression

Introduction

Gamma Regression is utilized for modeling positive continuous data with skewed distributions, often applied in fields such as insurance, medical research, and economics. It is particularly suited for data that are not only positive but also exhibit variability not conforming to normal distributions. This regression model assumes that the dependent variable follows a Gamma distribution, a flexible family of distributions that can capture a wide range of data shapes.

Background and Theory

Gamma Distribution

The Gamma distribution is defined for positive continuous variables and is characterized by its shape (kk) and scale (θ\theta) parameters. The probability density function (PDF) is given by:

f(y;k,θ)=yk1eyθθkΓ(k)f(y; k, \theta) = \frac{y^{k-1}e^{-\frac{y}{\theta}}}{\theta^k \Gamma(k)}

where y>0y > 0, k>0k > 0 is the shape parameter, θ>0\theta > 0 is the scale parameter, and Γ(k)\Gamma(k) is the gamma function evaluated at kk.

Gamma Regression Model

In Gamma regression, the response variable YY is assumed to follow a Gamma distribution. The mean of YY, μ\mu, is linked to a linear combination of explanatory variables through a link function, commonly the natural logarithm, ensuring that predictions remain positive:

log(μ)=β0+β1X1++βnXn\log(\mu) = \beta_0 + \beta_1X_1 + \ldots + \beta_nX_n

Optimization Process

Maximum Likelihood Estimation (MLE)

MLE is used to estimate the parameters (β0,β1,,βn\beta_0, \beta_1, \ldots, \beta_n) of the Gamma regression model. The likelihood function for a set of parameters given the observed data is constructed based on the joint PDF of the observed responses, which, under the assumption of independence, is the product of individual Gamma PDFs.

The likelihood function L(β;y,X)L(\beta; y, X) for the Gamma regression model, given NN independent observations (yi,xi)(y_i, x_i), is:

L(β;y,X)=i=1Nyik1eyiθiθikΓ(k)L(\beta; y, X) = \prod_{i=1}^{N} \frac{y_i^{k-1}e^{-\frac{y_i}{\theta_i}}}{\theta_i^k \Gamma(k)}

where each θi\theta_i is related to the mean μi\mu_i (a function of XiX_i and β\beta) and the shape parameter kk is typically assumed to be constant across observations.

Log-Likelihood Function

The log-likelihood function, which is more tractable for optimization purposes, is given by:

logL(β;y,X)=i=1N[(k1)log(yi)yiθiklog(θi)log(Γ(k))]\log L(\beta; y, X) = \sum_{i=1}^{N} \left[ (k-1) \log(y_i) - \frac{y_i}{\theta_i} - k \log(\theta_i) - \log(\Gamma(k)) \right]

Notably, θi\theta_i is a function of the explanatory variables and the parameters to be estimated.

Optimization via Gradient Ascent

The optimization of the log-likelihood function involves calculating its gradient with respect to the parameters and iteratively adjusting these parameters to find the maximum log-likelihood. Due to the complexity of the Gamma distribution's log-likelihood function, numerical methods such as gradient ascent or quasi-Newton methods are employed to estimate the parameters.

Implementation

Parameters

  • alpha: float, default = 1.0
    Shape parameter of gamma distribution
  • beta: float, default = 1.0
    Scale parameter of gamma distribution
  • learning_rate: float, default = 0.01
    Step size of the gradient descent update
  • max_iter: int, default = 100
    Number of iteration
  • l1_ratio: float, default = 0.5
    Balancing parameter of L1 and L2 in elastic-net regularization
  • reg_strength: float, defualt = 0.01
    Regularization strength
  • regularization: Literal['l1', 'l2', 'elastic-net'], default = None
    Regularization type

Applications

Gamma regression is widely used in scenarios where the dependent variable is strictly positive and highly skewed, such as:

  • Insurance: Modeling claim sizes.
  • Medical Research: Time to event (survival times) analysis.
  • Economics: Modeling income distributions.

Strengths and Limitations

Strengths

  • Flexibility: Can model a wide range of data distributions due to the Gamma distribution's flexibility.
  • Predictive Power: Suitable for skewed data, providing better predictions for the mean of the response variable.

Limitations

  • Complexity: The estimation process can be computationally intensive due to the non-linear relationship and the optimization of the log-likelihood function.
  • Assumptions: Assumes a constant shape parameter across observations, which may not hold for all datasets.

Advanced Considerations

  • Shape Parameter: Exploring methods for estimating or adapting the shape parameter kk can enhance model flexibility and fit.
  • Alternative Link Functions: While the log link is common, other link functions may be more appropriate based on the distribution of the response variable.

Conclusion

Gamma Regression provides a robust framework for modeling positive continuous data, especially when dealing with skewed distributions. The use of MLE for parameter estimation, while computationally demanding, allows for precise model fitting, making Gamma Regression a powerful tool in statistical analysis and prediction across various fields.

References

  1. McCullagh, Peter, and John Nelder. "Generalized Linear Models." Chapman & Hall/CRC, 1989.
  2. Dunn, Peter K., and Gordon K. Smyth. "Generalized Linear Models With Examples in R." Springer, 2018.
profile
𝖪𝗈𝗋𝖾𝖺 𝖴𝗇𝗂𝗏. 𝖢𝗈𝗆𝗉𝗎𝗍𝖾𝗋 𝖲𝖼𝗂𝖾𝗇𝖼𝖾 & 𝖤𝗇𝗀𝗂𝗇𝖾𝖾𝗋𝗂𝗇𝗀

0개의 댓글