GLM Families and Effect Measures: Choosing the Right Model for Y
- Mayta
- 9 minutes ago
- 4 min read
GLM Family | Y: Data Type | Link Function / Model | Effect Measure |
Gaussian | Continuous (e.g., BP, cholesterol) | Linear regression | Mean difference |
Positive, skewed continuous | Log-linear regression | Mean ratio | |
Binomial | Binary outcome (e.g., disease/no disease) | Logistic regression (logit link) | Odds ratio (OR) |
Log-binomial regression (log link) | Risk ratio (RR) | ||
Linear probability model (identity link) | Risk difference (RD) | ||
Poisson | Count data, rate (rare events, no overdisp.) | Poisson regression (log link) | Incidence rate ratio (IRR) |
Negative Binomial | Overdispersed count data (variance > mean) | Negative binomial regression | IRR (robust to overdispersion) |
Gamma | Positive, skewed continuous (e.g., cost) | Log-gamma regression | Mean ratio |
Survival (Time-to-event) | Time until event (e.g., death, relapse) | Cox model (semi-parametric) | Hazard ratio (HR) |
Parametric survival models (Weibull, etc.) | Hazard ratio (HR) |
When you're building models in clinical research, the starting point is always this question:
What is the outcome variable (Y), and what is its nature?
That’s because your entire analysis strategy in Generalized Linear Models (GLMs) hinges on the Family of Y. Each “family” corresponds to a different type of outcome — continuous, binary, count, time-to-event — and brings its own logic for link function and interpretation.
Let’s walk through the 6 major GLM families, linking each one to:
the type of Y,
the model you’d use,
the link function under the hood,
and the effect measure it gives you.
🧮 1. Gaussian Family → For Continuous Outcomes
✅ When to use:
Y is a numeric continuous variable (e.g., blood pressure, serum sodium).
You're modeling differences in means.
🔗 Link functions and models:
Linear regression: identity link — estimates mean difference.
Log-linear regression: log link — for positively skewed data like cost or length of stay.
🎯 Effect measures:
Linear → Mean difference
Log-linear → Mean ratio
🔍 Example:
"Does Drug A reduce average systolic blood pressure compared to Drug B?" Use linear regression → output interprets as mmHg difference in means.
⚫ 2. Binomial Family → For Binary Outcomes
✅ When to use:
Y is binary (yes/no, event/no event, dead/alive).
You're comparing probabilities or odds.
🔗 Link functions and models:
Logistic regression (logit link) → gives odds ratio (OR)
Log-binomial regression (log link) → gives risk ratio (RR)
Linear probability model (identity link) → gives risk difference (RD)
🎯 Effect measures:
Logistic → Odds ratio
Log-binomial → Risk ratio
Linear probability → Risk difference
⚠️ Pitfall alert:
Odds ratio ≠ risk ratio. Use RR when prevalence is high to avoid OR inflation.
🔍 Example:
"Is smoking associated with MI?" Use log-binomial if feasible for RR, or logistic if convergence issues occur.
🔢 3. Poisson Family → For Rate Data (Count Outcomes)
✅ When to use:
Y is a count (number of asthma attacks, infections).
You're modeling events per time or person-unit.
Assumes variance ≈ mean (no overdispersion).
🔗 Model:
Poisson regression with log link.
🎯 Effect measure:
Incidence rate ratio (IRR)
🔍 Example:
"Does ICU stay increase infection rates per 1000 catheter days?"
🧨 4. Negative Binomial Family → For Overdispersed Count Data
✅ When to use:
Y is a count with overdispersion (variance > mean), aka (σ2>μ).
Common in real-world epidemiology, where counts vary more than Poisson expects.
🔗 Model:
Negative binomial regression — similar link, better variance handling.
🎯 Effect measure:
IRR, more robust to dispersion.
🔍 Example:
"How does COPD affect number of ER visits?" Overdispersion is likely — negative binomial > Poisson.
Overdispersion
"Overdispersion" ในบริบททางสถิติ มีคำแปลและการนิยามดังนี้:
คำแปลภาษาไทย: ความแปรปรวนเกิน หรือ การกระจายตัวมากเกิน
นิยามและความหมาย
Overdispersion (ความแปรปรวนเกิน) คือปรากฏการณ์ทางสถิติที่เกิดขึ้นเมื่อความแปรปรวน (variance) ของข้อมูลที่สังเกตได้จริง สูงกว่า ความแปรปรวนที่คาดไว้ตามทฤษฎีของแบบจำลองความน่าจะเป็น (statistical probability model) ที่เลือกใช้
เพื่อให้เข้าใจง่ายขึ้น ลองดูบริบทที่พบบ่อยที่สุด:
1. ในแบบจำลองปัวซง (Poisson Model)
แบบจำลองปัวซงมักใช้สำหรับวิเคราะห์ข้อมูลประเภท "จำนวนนับ" (count data) เช่น จำนวนอุบัติเหตุต่อวัน, จำนวนลูกค้าที่เข้าร้านต่อชั่วโมง
ทฤษฎีของปัวซง: กำหนดว่า ค่าเฉลี่ย (μ) ต้องเท่ากับ ค่าความแปรปรวน (σ2) ⟹μ=σ2
ภาวะ Overdispersion: เมื่อนำข้อมูลจริงมาวิเคราะห์ พบว่า ค่าความแปรปรวน มากกว่า ค่าเฉลี่ย (σ2>μ)
ตัวอย่าง: สมมติเรานับจำนวนลูกค้าที่โทรเข้ามา call center ในแต่ละชั่วโมง
ค่าเฉลี่ยการโทร = 20 ครั้งต่อชั่วโมง
ตามทฤษฎีปัวซง ความแปรปรวนควรจะประมาณ 20 ด้วย
แต่ถ้าข้อมูลจริงแสดงให้เห็นว่า บางชั่วโมงมี 5 ครั้ง แต่บางชั่วโมงพุ่งไปถึง 50 ครั้ง ทำให้คำนวณความแปรปรวนได้ถึง 45 ⟹ นี่คือภาวะความแปรปรวนเกิน (45 > 20)
2. สาเหตุที่พบบ่อย
ความแตกต่างแฝง (Unobserved Heterogeneity): มีปัจจัยสำคัญที่ส่งผลต่อข้อมูลแต่ไม่ได้ถูกรวมไว้ในแบบจำลอง เช่น ในตัวอย่าง call center ข้างต้น อาจมีปัจจัยเรื่อง "ช่วงโปรโมชั่น" หรือ "ระบบล่ม" ที่ทำให้จำนวนการโทรผันผวนสูงกว่าปกติ
การขาดความเป็นอิสระต่อกัน (Lack of Independence): ข้อมูลบางกลุ่มอาจมีความสัมพันธ์กันเอง (correlation)
3. ผลกระทบหากไม่จัดการ
หากเพิกเฉยต่อภาวะ Overdispersion จะทำให้การประมาณค่าความคลาดเคลื่อนมาตรฐาน (Standard Errors) ของแบบจำลองต่ำกว่าความเป็นจริง ส่งผลให้ค่า p-value น้อยเกินไป และนำไปสู่การสรุปผลที่ผิดพลาดว่าตัวแปรนั้นมีนัยสำคัญทางสถิติ (Type I error)
💰 5. Gamma Family → For Skewed Continuous Outcomes
✅ When to use:
Y is continuous, positive, and highly skewed (e.g., cost, length of stay).
Avoids bias from using linear regression on non-normal Y.
🔗 Model:
Log-gamma regression
🎯 Effect measure:
Mean ratio (interpreted multiplicatively)
🔍 Example:
"What’s the effect of surgical approach on hospital cost?"
⏱️ 6. Survival Family → For Time-to-Event Data
✅ When to use:
Y is time until an event (e.g., death, discharge, relapse).
Can handle censoring (people who don't reach the event).
🔗 Models:
Cox proportional hazards model (semi-parametric, no Y distribution assumed)
Parametric models: Exponential, Weibull, Gompertz (model shape of hazard)
🎯 Effect measure:
Hazard ratio (HR)
🔍 Example:
"What’s the effect of chemotherapy on time to progression?"
✅ Final Takeaway: The GLM "Match Game"
Always choose your model based on Y. Here's the golden shortcut:
Y Type | GLM Family | Common Model | Effect Measure |
Continuous (normal) | Gaussian | Linear regression | Mean difference |
Skewed continuous | Gamma | Log-gamma regression | Mean ratio |
Binary | Binomial | Logistic / log-binomial | OR / RR / RD |
Count (rare, Poisson-like) | Poisson | Poisson regression | IRR |
Count (overdispersed) | Negative Binomial | Neg. binomial regression | IRR |
Time-to-event | Survival | Cox / parametric models | HR |
Comments