• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
The Analysis Factor

The Analysis Factor

Statistical Consulting, Resources, and Statistics Workshops for Researchers

  • Home
  • Our Programs
    • Membership
    • Online Workshops
    • Free Webinars
    • Consulting Services
  • About
    • Our Team
    • Our Core Values
    • Our Privacy Policy
    • Employment
    • Collaborate with Us
  • Statistical Resources
  • Contact
  • Blog
  • Login

Count Models: Understanding the Log Link Function

by Jeff Meyer 2 Comments

When we run a statistical model, we are in a sense creating a mathematical equation. The simplest regression model looks like this:

Yi = β0 + β1X+ εi

The left side of the equation is the sum of two parts on the right: the fixed component, β0 + β1X, and the random component, εi.

You’ll also sometimes see the equation written about the mean or expected value of Y on the left and only the fixed component on the right:

μY|X = β0 + β1X

All we’ve done is remove that random component from both sides to focus on the fixed portion. Why?

The random component has a probability distribution. Since the outcome variable Y includes that random component, it too follows a probability distribution.

In linear regression, we assume that probability distribution is normal.  But there are a lot of outcome variables for which a normal distribution doesn’t fit.

Generalized Linear Models

Generalized linear models allow a few other distributions, including Poisson, binomial, and Gamma (among others).

But in order to make the model fit in a linear form for these other distributions, we often need to take some function of the mean. That second equation above doesn’t fit.

In generalized linear models, there is a link function, which is the link between the mean of Y on the left and the fixed component on the right.

f(μY|X) = β0 + β1X

It’s very possible you have run models without being aware of this. Some software packages have models (e.g., Stata’s nbreg or SAS proc logistic) that use a default link function.

But if you run a generalized linear model in a more general software procedure (like SAS’s proc genmod or R’s glm), then you must select the link function that works with the distribution in the random components.

A natural fit for count variables that follow the Poisson or negative binomial distribution is the log link. The log link exponentiates the linear predictors. It does not log transform the outcome variable.

Here are two versions of the same basic model equation for count data:

ln(μ) = β0 + β1X

μ = exp(β0 + β1X), also written as μ = eβ0 + β1X

Where μ=predicted value of Y given X, exp(β0) = the effect on the mean of μ when X=0, and exp(β1)= the multiplicative effect on the mean of Y for a one-unit increase in X.  e is a constant value of approximately 2.72.

There are several link choices for each probability distribution. The table below shows the potential combinations allowed in Stata.

statacombos-cm2-blog-jm

But there is generally a best fitting link for each distribution, the canonical link. Be sure to choose the best fit.

**This article was updated Nov. 12th, 2020.

Jeff Meyer is a statistical consultant with The Analysis Factor, a stats mentor for Statistically Speaking membership, and a workshop instructor. Read more about Jeff here.

Poisson and Negative Binomial Regression for Count Data
Learn when you need to use Poisson or Negative Binomial Regression in your analysis, how to interpret the results, and how they differ from similar models.

Tagged With: count model, generalized linear models, linear regression, link function, log link, log transformation, Negative Binomial Regression, Poisson Regression

Related Posts

  • The Importance of Including an Exposure Variable in Count Models
  • The Difference Between Link Functions and Data Transformations
  • Getting Accurate Predicted Counts When There Are No Zeros in the Data
  • The Problem with Linear Regression for Count Data

Reader Interactions

Comments

  1. Barry says

    June 27, 2021 at 7:47 pm

    This article explains very nicely how the error term (and the response variable Y) in simple linear regression are assumed to follow a normal distribution.

    But what happens to the error term in GLMs? All I see is the fixed component on the right.

    Reply
    • Karen Grace-Martin says

      July 16, 2021 at 11:43 am

      Hi Barry,

      There isn’t an error term in Generalized Linear Models. See: https://www.theanalysisfactor.com/generalized-linear-models-no-error-term/

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Please note that, due to the large number of comments submitted, any questions on problems related to a personal study/project will not be answered. We suggest joining Statistically Speaking, where you have access to a private forum and more resources 24/7.

Primary Sidebar

This Month’s Statistically Speaking Live Training

  • Member Training: Introduction to SPSS Software Tutorial

Upcoming Free Webinars

Poisson and Negative Binomial Regression Models for Count Data

Upcoming Workshops

  • Analyzing Count Data: Poisson, Negative Binomial, and Other Essential Models (Jul 2022)
  • Introduction to Generalized Linear Mixed Models (Jul 2022)

Copyright © 2008–2022 The Analysis Factor, LLC. All rights reserved.
877-272-8096   Contact Us

The Analysis Factor uses cookies to ensure that we give you the best experience of our website. If you continue we assume that you consent to receive cookies on all websites from The Analysis Factor.
Continue Privacy Policy
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT