1 STA 517 – Chp4 Introduction to Generalized Linear Models 4.3 GENERALIZED LINEAR MODELS FOR COUNTS  count data - assume a Poisson distribution  counts.

Slides:



Advertisements
Similar presentations
1 Markov Chains: Transitional Modeling Qi Liu. 2 content Terminology Transitional Models without Explanatory Variables Transitional Models without Explanatory.
Advertisements

Data: Crab mating patterns Data: Typists (Poisson with random effects) (Poisson Regression, ZIP model, Negative Binomial) Data: Challenger (Binomial with.
Simple Logistic Regression
STA305 week 31 Assessing Model Adequacy A number of assumptions were made about the model, and these need to be verified in order to use the model for.
EPI 809/Spring Probability Distribution of Random Error.
Logistic Regression Example: Horseshoe Crab Data
Multiple Linear Regression
Loglinear Models for Independence and Interaction in Three-way Tables Veronica Estrada Robert Lagier.
Loglinear Models for Contingency Tables. Consider an IxJ contingency table that cross- classifies a multinomial sample of n subjects on two categorical.
1 STA 517 – Introduction: Distribution and Inference 1.5 STATISTICAL INFERENCE FOR MULTINOMIAL PARAMETERS  Recall multi(n, =( 1,  2, …,  c ))  Suppose.
Some Terms Y =  o +  1 X Regression of Y on X Regress Y on X X called independent variable or predictor variable or covariate or factor Which factors.
Header= Verdana 28 pt., Red 1 STA 517 – Chapter 3: Inference for Contingency Tables 3. Inference for Contingency Tables 3.1 Confidence Intervals for Association.
Plots, Correlations, and Regression Getting a feel for the data using plots, then analyzing the data with correlations and linear regression.
Linear statistical models 2008 Count data, contingency tables and log-linear models Expected frequency: Log-linear models are linear models of the log.
OLS versus MLE Example YX Here is the data:
Linear statistical models 2009 Count data  Contingency tables and log-linear models  Poisson regression.
Generalized Linear Models
Poisson Regression Caution Flags (Crashes) in NASCAR Winston Cup Races L. Winner (2006). “NASCAR Winston Cup Race Results for ,” Journal.
SAS Lecture 5 – Some regression procedures Aidan McDermott, April 25, 2005.
McGraw-Hill/IrwinCopyright © 2009 by The McGraw-Hill Companies, Inc. All Rights Reserved. Chapter 4 and 5 Probability and Discrete Random Variables.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Discrete Random Variables Chapter 4.
Topic 28: Unequal Replication in Two-Way ANOVA. Outline Two-way ANOVA with unequal numbers of observations in the cells –Data and model –Regression approach.
Biostatistics Case Studies 2005 Peter D. Christenson Biostatistician Session 4: Taking Risks and Playing the Odds: OR vs.
Objective: I can write linear equations that model real world data.
Chapter 3: Generalized Linear Models 3.1 The Generalization 3.2 Logistic Regression Revisited 3.3 Poisson Regression 1.
What is a probability distribution? It is the set of probabilities on a sample space or set of outcomes.
Lecture 4 SIMPLE LINEAR REGRESSION.
Generalized Linear Models II Distributions, link functions, diagnostics (linearity, homoscedasticity, leverage)
1 Experimental Statistics - week 10 Chapter 11: Linear Regression and Correlation Note: Homework Due Thursday.
Correlation Correlation is used to measure strength of the relationship between two variables.
Copyright © 2010 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Chapter 5 Discrete Random Variables.
McGraw-Hill/IrwinCopyright © 2009 by The McGraw-Hill Companies, Inc. All Rights Reserved. Chapter 5 Discrete Random Variables.
Linear Model. Formal Definition General Linear Model.
1 STA 617 – Chp9 Loglinear/Logit Models Loglinear / Logit Models  Chapter 5-7 logistic regression: GLM with logit link binomial / multinomial  Chapter.
1 The greatest achievement in life is to be able to get up again from failure.
1 GLM I: Introduction to Generalized Linear Models By Curtis Gary Dean Distinguished Professor of Actuarial Science Ball State University By Curtis Gary.
1 Topic 2 LOGIT analysis of contingency tables. 2 Contingency table a cross classification Table containing two or more variables of classification, and.
© Copyright McGraw-Hill Correlation and Regression CHAPTER 10.
Generalized Linear Models (GLMs) & Categorical Data Analysis (CDA) in R Hong Tran, April 21, 2015.
Topic 26: Analysis of Covariance. Outline One-way analysis of covariance –Data –Model –Inference –Diagnostics and rememdies Multifactor analysis of covariance.
1 STA 617 – Chp9 Loglinear/Logit Models 9.7 Poisson regressions for rates  In Section 4.3 we introduced Poisson regression for modeling counts. When outcomes.
STA617 Advanced Categorical Data Analysis
1 STA 617 – Chp10 Models for matched pairs Summary  Describing categorical random variable – chapter 1  Poisson for count data  Binomial for binary.
Generalized Linear Models (GLMs) and Their Applications.
Log-linear Models HRP /03/04 Log-Linear Models for Multi-way Contingency Tables 1. GLM for Poisson-distributed data with log-link (see Agresti.
Topic 24: Two-Way ANOVA. Outline Two-way ANOVA –Data –Cell means model –Parameter estimates –Factor effects model.
1 STA 617 – Chp12 Generalized Linear Mixed Models SAS for Model (12.3) with Matched Pairs from Table 12.1.
Topic 20: Single Factor Analysis of Variance. Outline Analysis of Variance –One set of treatments (i.e., single factor) Cell means model Factor effects.
SAS® Global Forum 2014 March Washington, DC Got Randomness?
Dependent Variable Discrete  2 values – binomial  3 or more discrete values – multinomial  Skewed – e.g. Poisson Continuous  Non-normal.
1 Fighting for fame, scrambling for fortune, where is the end? Great wealth and glorious honor, no more than a night dream. Lasting pleasure, worry-free.
Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Chapter 5 Discrete Random Variables.
STA 216 Generalized Linear Models Instructor: David Dunson 211 Old Chem, (NIEHS)
Week 7: General linear models Overview Questions from last week What are general linear models? Discussion of the 3 articles.
1 Linear Regression Model. 2 Types of Regression Models.
Generalized Linear Models
Caution Flags (Crashes) in NASCAR Winston Cup Races
Introduction to logistic regression a.k.a. Varbrul
Goodness of Fit Tests The goal of χ2 goodness of fit tests is to test is the data comes from a certain distribution. There are various situations to which.
6-1 Introduction To Empirical Models
Residuals and Residual Plots
Combining Data Sets in the DATA step.
Joyful mood is a meritorious deed that cheers up people around you
Correlation & Trend Lines
4.6 Fitting generalized linear models
Generalized Additive Model
Chp 7 Logit Models for Multivariate Responses
5.2 Inference for logistic regression
5.4 Multiple logistic regression
Presentation transcript:

1 STA 517 – Chp4 Introduction to Generalized Linear Models 4.3 GENERALIZED LINEAR MODELS FOR COUNTS  count data - assume a Poisson distribution  counts in contingency tables with categorical response variables.  modeling count or rate data for a single discrete response variable.

2 STA 517 – Chp4 Introduction to Generalized Linear Models Poisson Loglinear Models  The Poisson distribution has a positive mean µ.  Although a GLM can model a positive mean using the identity link, it is more common to model the log of the mean.  Like the linear predictor, the log mean can take any real value.  The log mean is the natural parameter for the Poisson distribution, and the log link is the canonical link for a Poisson GLM.  A Poisson loglinear GLM assumes a Poisson distribution for Y and uses the log link.

3 STA 517 – Chp4 Introduction to Generalized Linear Models Log linear model  The Poisson loglinear model with explanatory variable X is  For this model, the mean satisfies the exponential relationship x  A 1-unit increase in x has a multiplicative impact of on µ  The mean at x+1 equals the mean at x multiplied by.

4 STA 517 – Chp4 Introduction to Generalized Linear Models Horseshoe Crab Mating Example

5 STA 517 – Chp4 Introduction to Generalized Linear Models

Horseshoe Crab Mating Example  a study of nesting horseshoe crabs.  Each female horseshoe crab had a male crab resident in her nest.  AIM: factors affecting whether the female crab had any other males, called satellites, residing nearby.  Explanatory variables are :  C - the female crab’s color,  S - spine condition,  Wt - weight,  W - carapace width.  Outcome: number of satellites (Sa) of a female crab.  For now, we only study W (carapace width)

7 STA 517 – Chp4 Introduction to Generalized Linear Models number of satellites (Sa) = f (W)  Scatter plot – weakly linear ? (N=173)  Grouped plot: To get a clearer picture, we grouped the female crabs into width categories and calculated the sample mean number of satellites for female crabs in each category.  Figure 4.4 plots these sample means against the sample mean width for crabs in each category.  The sample means show a strong increasing trend. WHY?

8 STA 517 – Chp4 Introduction to Generalized Linear Models

9

10 STA 517 – Chp4 Introduction to Generalized Linear Models

11 STA 517 – Chp4 Introduction to Generalized Linear Models

12 STA 517 – Chp4 Introduction to Generalized Linear Models

13 STA 517 – Chp4 Introduction to Generalized Linear Models

14 STA 517 – Chp4 Introduction to Generalized Linear Models SAS code data table4_3; input C S W Wt cards; … ; proc genmod data=table4_3; model Sa=W/dist=poisson link=identity; ods output ParameterEstimates=PE1; run; proc genmod data=table4_3; model Sa=w/dist=poisson link=log; ods output ParameterEstimates=PE2; run;

15 STA 517 – Chp4 Introduction to Generalized Linear Models data _NULL_; set PE1; if Parameter="Intercept" then call symput("intercp1", Estimate); if Parameter="W" then call symput("b1", Estimate); data _NULL_; set PE2; if Parameter="Intercept" then call symput("intercp2", Estimate); if Parameter="W" then call symput("b2", Estimate); run; data tmp; do W=22 to 32 by 0.01; mu1=&intercp1 + &b1*W; mu2=exp(&intercp2 + &b2*W); output; end; run;

16 STA 517 – Chp4 Introduction to Generalized Linear Models Graphs proc sort data=table4_3; by W; data tmp1; merge table4_3 tmp; by W; run; symbol1 i=join line=1 color=green value=none; symbol2 i=join line=2 color=red value=none; symbol3 i=none line=3 value=circle; proc gplot data=tmp1; plot mu1*W mu2*W Sa*W / overlay; run;

17 STA 517 – Chp4 Introduction to Generalized Linear Models

18 STA 517 – Chp4 Introduction to Generalized Linear Models Group data /*group data*/ data table4_3a; set table4_3; W_g=round(W-0.75)+0.75; *if W<23.25 then W_g=22.5; *if W>29.25 then W_g=30.5; run; proc sql; create table table4_3g as select W_g, count(W_g) as Num_of_Cases, sum(Sa) as Num_of_Satellites, mean(Sa) as Sa_g, var(sa) as Var_SA from table4_3a group by W_g; quit; proc print; run;

19 STA 517 – Chp4 Introduction to Generalized Linear Models SAS output Num_of_ Num_of_ Obs W_g Cases Satellites Sa_g Var_SA

20 STA 517 – Chp4 Introduction to Generalized Linear Models Graphs data tmp2; merge table4_3g(rename=(W_g=W)) tmp; by W; run; symbol1 i=join line=1 color=green value=none; symbol2 i=join line=2 color=red value=none; symbol3 i=none line=3 value=circle; proc gplot data=tmp2; plot mu1*W mu2*W Sa_g*W / overlay; run;

21 STA 517 – Chp4 Introduction to Generalized Linear Models

22 STA 517 – Chp4 Introduction to Generalized Linear Models Overdispersion for Poisson GLMs

23 STA 517 – Chp4 Introduction to Generalized Linear Models Solution?

24 STA 517 – Chp4 Introduction to Generalized Linear Models Negative binomial GLMs

25 STA 517 – Chp4 Introduction to Generalized Linear Models

26 STA 517 – Chp4 Introduction to Generalized Linear Models /*fit negative binomial with identical link to count for overdispersion*/ proc genmod data=table4_3; model Sa=W/dist=NEGBIN link=identity; ods output ParameterEstimates=PE3; run;

27 STA 517 – Chp4 Introduction to Generalized Linear Models Poisson GLM of independence in I × J contingence tables

28 STA 517 – Chp4 Introduction to Generalized Linear Models