Analyze count data and event rates when your variance exceeds your mean (overdispersion) by testing how independent predictors (X) influence a discrete outcome (Y).
==================================================================================
Negative Binomial Regression Equation (Log-Link)
Negative Binomial Regression is an advanced Generalized Linear Model (GLM) designed exclusively for modeling count data and event frequencies. While it shares its foundational architecture with Poisson regression, it is specifically engineered to handle datasets that exhibit overdispersion-a common real-world phenomenon where the variance of the data is significantly larger than its mean.
In standard count models, assuming that events happen at a perfectly constant rate is often unrealistic. Events tend to cluster together due to unmeasured variables or natural contagion (e.g., infectious diseases, viral social media posts, or localized weather events). Negative Binomial Regression introduces a critical mathematical shock absorber-the dispersion parameter-to account for this clustering, ensuring your standard errors, p-values, and confidence intervals remain highly accurate.
To understand why this tool is necessary, you must understand the fatal flaw of the standard Poisson model: the assumption of equidispersion. Poisson math strictly assumes that the mean (μ) of your count data is exactly equal to its variance (V).
When data is overdispersed (Variance > Mean), running a Poisson model artificially shrinks the standard errors. This creates a dangerous illusion of statistical significance, leading researchers to commit Type I errors (False Positives). The Negative Binomial model corrects this by relaxing the equidispersion constraint, safely absorbing the excess variance into its structural framework.
Like Poisson regression, the Negative Binomial model utilizes a log-link function to ensure that it never predicts impossible negative counts. The linear predictor is defined as:
\[\ln(\mu) = \beta_0 + \beta_1X_1 + \beta_2X_2 + \dots + \beta_kX_k\]
However, the crucial difference lies in how the variance is modeled. The Negative Binomial model calculates an explicit Dispersion Parameter (often denoted mathematically as α or θ, though our UI simply labels it the "NB2 Dispersion Param" to avoid confusion with the α significance level). The variance is modeled as a quadratic function of the mean:
\[\text{Variance} = \mu + \alpha\mu^2\]
If the calculated dispersion parameter (α) is exactly zero, the formula collapses back into μ, making it identical to a Poisson model. If α > 0, the model successfully accounts for the overdispersion.
You should deploy this calculator whenever you are modeling event counts that naturally cluster or exhibit high variability. Common applications include:
When tracking events, your observation windows or population sizes will frequently vary. Comparing 50 car accidents in a city of two million people to 50 accidents in a town of five thousand people is mathematically invalid without standardizing the rate.
By mapping an "Exposure" column, the calculator seamlessly converts raw counts into standardized rates. It does this by injecting the natural logarithm of your exposure variable directly into the log-link equation with a locked coefficient of 1.0:
\[Y = \text{Exposure} \times \exp(\beta_0 + \beta_1X_1 + \dots + \beta_kX_k)\]
Because traditional linear R2 metrics do not apply to count models, our calculator generates specialized GLM diagnostics to help you evaluate model fit:
To ensure computational stability during Maximum Likelihood Estimation, your dataset must adhere to the following rules:
Our graphical interface makes advanced Python-based statsmodels GLM computing accessible entirely in your browser. Our engine automatically estimates the θ dispersion parameter so you don't have to provide it manually.