SAS Textbook Examples
Generalized Estimating Equations by
James W. Hardin and Joseph M. Hilbe
Chapter 2 Model Construction and Estimating Equations
Model on page 35 using data set https://stats.idre.ucla.edu/wp-content/uploads/2016/02/ship.sas7bdat.
proc genmod data = ship; class ship(ref='1') /param = ref; model accident = ship op_75_79 co_65_69 co_70_74 co_75_79 /dist=poisson offset=exposure; run; quit;
Criteria For Assessing Goodness Of Fit
Criterion DF Value Value/DF
Deviance 25 38.6950 1.5478 Scaled Deviance 25 38.6950 1.5478 Pearson Chi-Square 25 42.2752 1.6910 Scaled Pearson X2 25 42.2752 1.6910 Log Likelihood 768.0131
Algorithm converged.
Analysis Of Parameter Estimates
Standard Wald 95% Confidence Chi- Parameter DF Estimate Error Limits Square Pr > ChiSq
Intercept 1 -6.4059 0.2174 -6.8321 -5.9797 867.89 <.0001 ship 2 1 -0.5433 0.1776 -0.8914 -0.1953 9.36 0.0022 ship 3 1 -0.6874 0.3290 -1.3323 -0.0425 4.36 0.0367 ship 4 1 -0.0760 0.2906 -0.6455 0.4936 0.07 0.7938 ship 5 1 0.3256 0.2359 -0.1367 0.7879 1.91 0.1675 op_75_79 1 0.3845 0.1183 0.1527 0.6163 10.57 0.0012 co_65_69 1 0.6971 0.1496 0.4038 0.9904 21.70 <.0001 co_70_74 1 0.8184 0.1698 0.4857 1.1512 23.24 <.0001 co_75_79 1 0.4534 0.2332 -0.0036 0.9104 3.78 0.0518 Scale 0 1.0000 0.0000 1.0000 1.0000
Model on page 36 using wheeze data set. First we created dummy variables for variable case so we would be able to choose the same dummy variables in the model as shown in the text. For some of the cases the dependent variable wheeze does not vary. This can be seen from the output of the following proc freq. These observations should be excluded in the analysis because they will cause problem of zero cells.
data wheeze1; set wheeze; array c(16) case_1 - case_16; do i = 1 to 16; c(i) = 0; c(i) = (case=i); end; drop i; run; proc freq data = wheeze1; tables case*wheeze /list nocum nopercent; run;
case wheeze Frequency --------------------------- 1 0 1 1 1 3 2 0 2 2 1 2 3 0 3 3 1 1 4 0 2 4 1 2 5 0 4 6 0 4 7 0 4 8 0 4 9 0 3 9 1 1 10 0 4 11 0 1 11 1 3 12 0 4 13 0 1 13 1 3 14 0 3 14 1 1 15 0 3 15 1 1 16 0 2 16 1 2 proc logistic data = wheeze1; where case ~=5 and case ~=6 and case ~=7 and case ~=8 and case~=10 and case ~=12; model wheeze(event='1') = case_3 case_4 case_9 case_11 case_13 - case_16 kingston age smoke ; run;
Model Fit Statistics
Intercept Intercept and Criterion Only Covariates AIC 57.352 70.908 SC 59.041 91.175 -2 Log L 55.352 46.908
Testing Global Null Hypothesis: BETA=0
Test Chi-Square DF Pr > ChiSq Likelihood Ratio 8.4437 11 0.6731 Score 7.9055 11 0.7217 Wald 6.8185 11 0.8136
Analysis of Maximum Likelihood Estimates
Standard Wald Parameter DF Estimate Error Chi-Square Pr > ChiSq Intercept 1 4.9270 3.8285 1.6562 0.1981 case_3 1 -0.9845 1.9317 0.2598 0.6103 case_4 1 -1.1671 1.5714 0.5516 0.4577 case_9 1 -2.4621 2.2210 1.2289 0.2676 case_11 1 1.3212 2.1094 0.3923 0.5311 case_13 1 1.2532 1.7947 0.4876 0.4850 case_14 1 -2.4468 2.1379 1.3098 0.2524 case_15 1 -1.0733 1.6218 0.4380 0.5081 case_16 1 -1.2842 1.9255 0.4448 0.5048 kingston 1 -1.3416 2.2108 0.3683 0.5440 age 1 -0.3608 0.3399 1.1264 0.2885 smoke 1 0.1154 0.8828 0.0171 0.8960
Conditional Fixed-effects Poisson model on page 39 using the ship data set. When the data is balanced, this model can be estimated in the standard way by including dummy variables for the panel id variable. So here we first create the dummy variables for variable ship in a data step and use proc genmod to estimate the Poisson model. The parameter estimates for the dummy variables are not of interest here.
data ship1; set ship; array myship(5) s1-s5; do i = 1 to 5; myship(i) = (ship=i); end; drop i; run; proc genmod data = ship1 ; model incident = s2-s5 op_75_79 co_65_69 co_70_74 co_75_79 /offset = exposure d = poi; run; quit;
Criteria For Assessing Goodness Of Fit
Criterion DF Value Value/DF
Deviance 25 38.6950 1.5478 Scaled Deviance 25 38.6950 1.5478 Pearson Chi-Square 25 42.2753 1.6910 Scaled Pearson X2 25 42.2753 1.6910 Log Likelihood 768.0131
Algorithm converged.
Analysis Of Parameter Estimates
Standard Wald 95% Confidence Chi- Parameter DF Estimate Error Limits Square Pr > ChiSq
Intercept 1 -5.9525 0.2468 -6.4363 -5.4687 581.49 <.0001 s2 1 -0.5433 0.1776 -0.8914 -0.1953 9.36 0.0022 s3 1 -0.6874 0.3290 -1.3323 -0.0425 4.36 0.0367 s4 1 -0.0760 0.2906 -0.6455 0.4936 0.07 0.7938 s5 1 0.3256 0.2359 -0.1367 0.7879 1.91 0.1675 op_75_79 1 0.3845 0.1183 0.1527 0.6163 10.57 0.0012 co_65_69 1 -0.4534 0.2332 -0.9104 0.0036 3.78 0.0518 co_70_74 1 0.2437 0.2088 -0.1654 0.6529 1.36 0.2430 co_75_79 1 0.3650 0.1995 -0.0259 0.7559 3.35 0.0673 Scale 0 1.0000 0.0000 1.0000 1.0000
NOTE: The scale parameter was held fixed.
Conditional fixed-effects logit model on page 41.