SAS Data Sets for "An Introduction to Categorical Data Analysis"

Summary:

This document contains tables similar to those in the Appendix of "An Introduction to Categorical Data Analysis," by Alan Agresti, published by John Wiley and Sons, Inc., 1996 (2nd edition 2007). The tables show SAS code for the analyses conducted in that text, and contain the major data sets from that text.

Information about software use with other packages is available at software for CDA. In particular, a manual prepared by Laura Thompson that shows how to use S-Plus and R to conduct nearly all the analyses in my categorical data analysis books is at Laura Thompson S manual for CDA. In simpler form, an especially useful resource is the website of Chris Bilder, where the link to R has examples of the use of R for most chapters of the Intro CDA text and the link to Schedule has course notes following that text as well as imbedded R code and output. Also, Brett Presnell has many examples of the use of R for categorical data analyses from teaching a course at the University of Florida from the first edition of this book, at Brett Presnell material on R for CDA.

The text provides an applied introduction to basic methods of categorical data analysis, particularly logistic regression and other generalized linear models. The technical level is appropriate for applied statisticians and nonstatisticians having a background in standard statistical methods such as regression and ANOVA. The Tables show a variety of SAS procedures, with particular emphasis on GENMOD, the SAS procedure for generalized linear modeling.

These tables can be freely used and distributed for non-commercial purposes. Please direct any comments about errors in the tables or in the text itself to Alan Agresti, Dept. of Statistics, Univ. of Florida, Gainesville, Florida 32611-8545, e-mail AA@STAT.UFL.EDU.

A.1 SAS file for chi-squared tests with aspirin data in Table 2.3

data aspirin;
input group mi count @@;
datalines;

```
1 1 189     1 2 10845
2 1 104     2 2 10933
```
;
proc freq order=data; weight count;
tables group*mi / chisq expected measures;
proc genmod;
model count = group mi / dist=poi link=log obstats;
run;

A.2 SAS file for analyses of infant malformation data in Table 2.7

data infants;
input malform alcohol count @@;
datalines;

```
1 0 17066    1 0.5 14464   1 1.5 788    1 4.0 126    1 7.0 37
2 0    48    2 0.5    38   2 1.5   5    2 4.0   1    2 7.0  1
```

;
proc freq; weight count;
tables malform*alcohol / chisq cmh1;
proc freq; weight count;
tables malform*alcohol / cmh1 scores=ridit;
run;

A.3 SAS file for Fisher's exact test with tea-tasting data in Table 2.8

data tea;
input poured guess count @@;
datalines;

```
1  1  3      1  2  1
2  1  1      2  2  3
```

;
proc freq; weight count;
tables poured*guess / exact;
run;

A.4 SAS file for CMH analysis of Chinese smoking data in Table 3.3 of first edition and Table 5.12 of 2nd edition

data cmh;
input center smoke cancer count @@;
datalines;

```
1 1 1 126   1 1 2 100   1 2 1  35   1 2 2  61
2 1 1 908   2 1 2 688   2 2 1 497   2 2 2 807
3 1 1 913   3 1 2 747   3 2 1 336   3 2 2 598
4 1 1 235   4 1 2 172   4 2 1  58   4 2 2 121
5 1 1 402   5 1 2 308   5 2 1 121   5 2 2 215
6 1 1 182   6 1 2 156   6 2 1  72   6 2 2  98
7 1 1  60   7 1 2  99   7 2 1  11   7 2 2  43
8 1 1 104   8 1 2  89   8 2 1  21   8 2 2  36
```

;
proc freq; weight count;
tables center*smoke*cancer / cmh;
run;

A.5 SAS file for binary regression models with snoring data in Table 3.1 of 2nd edition (Table 4.1 of first edition)

data glm;
input snoring disease total;
datalines;
0 24 1379
2 35 638
4 21 213
5 30 254
;
proc genmod; model disease/total = snoring / dist=bin link=identity ;
proc genmod; model disease/total = snoring / dist=bin link=logit ;
proc genmod; model disease/total = snoring / dist=bin link=probit;
run;

A.6 SAS file for analyses of horseshoe crab data in Table 3.2 of 2nd edition (Table 4.2 of first edition)

data crab;
input color spine width satell weight;
if satell>0 then y=1; if satell=0 then y=0; n=1;
weight = weight/1000; color = color - 1;
if color=4 then dark=0; if color < 4 then dark=1;
datalines;

```
3  3  28.3  8  3050
4  3  22.5  0  1550
2  1  26.0  9  2300
4  3  24.8  0  2100
4  3  26.0  4  2600
3  3  23.8  0  2100
2  1  26.5  0  2350
4  2  24.7  0  1900
3  1  23.7  0  1950
4  3  25.6  0  2150
4  3  24.3  0  2150
3  3  25.8  0  2650
3  3  28.2  11 3050
5  2  21.0  0  1850
3  1  26.0  14 2300
2  1  27.1  8  2950
3  3  25.2  1  2000
3  3  29.0  1  3000
5  3  24.7  0  2200
3  3  27.4  5  2700
3  2  23.2  4  1950
2  2  25.0  3  2300
3  1  22.5  1  1600
4  3  26.7  2  2600
5  3  25.8  3  2000
5  3  26.2  0  1300
3  3  28.7  3  3150
3  1  26.8  5  2700
5  3  27.5  0  2600
3  3  24.9  0  2100
2  1  29.3  4  3200
2  3  25.8  0  2600
3  2  25.7  0  2000
3  1  25.7  8  2000
3  1  26.7  5  2700
5  3  23.7  0  1850
3  3  26.8  0  2650
3  3  27.5  6  3150
5  3  23.4  0  1900
3  3  27.9  6  2800
4  3  27.5  3  3100
2  1  26.1  5  2800
2  1  27.7  6  2500
3  1  30.0  5  3300
4  1  28.5  9  3250
4  3  28.9  4  2800
3  3  28.2  6  2600
3  3  25.0  4  2100
3  3  28.5  3  3000
3  1  30.3  3  3600
5  3  24.7  5  2100
3  3  27.7  5  2900
2  1  27.4  6  2700
3  3  22.9  4  1600
3  1  25.7  5  2000
3  3  28.3  15 3000
3  3  27.2  3  2700
4  3  26.2  3  2300
3  1  27.8  0  2750
5  3  25.5  0  2250
4  3  27.1  0  2550
4  3  24.5  5  2050
4  1  27.0  3  2450
3  3  26.0  5  2150
3  3  28.0  1  2800
3  3  30.0  8  3050
3  3  29.0  10 3200
3  3  26.2  0  2400
3  1  26.5  0  1300
3  3  26.2  3  2400
4  3  25.6  7  2800
4  3  23.0  1  1650
4  3  23.0  0  1800
3  3  25.4  6  2250
4  3  24.2  0  1900
3  2  22.9  0  1600
4  2  26.0  3  2200
3  3  25.4  4  2250
4  3  25.7  0  1200
3  3  25.1  5  2100
4  2  24.5  0  2250
5  3  27.5  0  2900
4  3  23.1  0  1650
4  1  25.9  4  2550
3  3  25.8  0  2300
5  3  27.0  3  2250
3  3  28.5  0  3050
5  1  25.5  0  2750
5  3  23.5  0  1900
3  2  24.0  0  1700
3  1  29.7  5  3850
3  1  26.8  0  2550
5  3  26.7  0  2450
3  1  28.7  0  3200
4  3  23.1  0  1550
3  1  29.0  1  2800
4  3  25.5  0  2250
4  3  26.5  1  1967
4  3  24.5  1  2200
4  3  28.5  1  3000
3  3  28.2  1  2867
3  3  24.5  1  1600
3  3  27.5  1  2550
3  2  24.7  4  2550
3  1  25.2  1  2000
4  3  27.3  1  2900
3  3  26.3  1  2400
3  3  29.0  1  3100
3  3  25.3  2  1900
3  3  26.5  4  2300
3  3  27.8  3  3250
3  3  27.0  6  2500
4  3  25.7  0  2100
3  3  25.0  2  2100
3  3  31.9  2  3325
5  3  23.7  0  1800
5  3  29.3  12 3225
4  3  22.0  0  1400
3  3  25.0  5  2400
4  3  27.0  6  2500
4  3  23.8  6  1800
2  1  30.2  2  3275
4  3  26.2  0  2225
3  3  24.2  2  1650
3  3  27.4  3  2900
3  2  25.4  0  2300
4  3  28.4  3  3200
5  3  22.5  4  1475
3  3  26.2  2  2025
3  1  24.9  6  2300
2  2  24.5  6  1950
3  3  25.1  0  1800
3  1  28.0  4  2900
5  3  25.8  10 2250
3  3  27.9  7  3050
3  3  24.9  0  2200
3  1  28.4  5  3100
4  3  27.2  5  2400
3  2  25.0  6  2250
3  3  27.5  6  2625
3  1  33.5  7  5200
3  3  30.5  3  3325
4  3  29.0  3  2925
3  1  24.3  0  2000
3  3  25.8  0  2400
5  3  25.0  8  2100
3  1  31.7  4  3725
3  3  29.5  4  3025
4  3  24.0  10 1900
3  3  30.0  9  3000
3  3  27.6  4  2850
3  3  26.2  0  2300
3  1  23.1  0  2000
3  1  22.9  0  1600
5  3  24.5  0  1900
3  3  24.7  4  1950
3  3  28.3  0  3200
3  3  23.9  2  1850
4  3  23.8  0  1800
4  2  29.8  4  3500
3  3  26.5  4  2350
3  3  26.0  3  2275
3  3  28.2  8  3050
5  3  25.7  0  2150
3  3  26.5  7  2750
3  3  25.8  0  2200
4  3  24.1  0  1800
4  3  26.2  2  2175
4  3  26.1  3  2750
4  3  29.0  4  3275
2  1  28.0  0  2625
5  3  27.0  0  2625
3  2  24.5  0  2000
```

;
proc genmod; model satell = width / dist=poi link=log;
proc genmod; model satell = width / dist=poi link=identity;
proc genmod;
model satell = width / dist=nor link=identity;
proc genmod;
model y/n = width / dist=bin link=logit obstats ;
proc genmod; class color;
model y/n = color width / dist=bin link=logit;
proc genmod;
model y/n = color width / dist=bin link=logit;
proc genmod; class color spine;
model y/n = color spine width weight / dist=bin link=logit type3;
proc genmod;
model y/n = / dist=bin link=logit ;
proc logistic;
model y = width;
proc logistic;
model y = color weight width / selection=backward;
proc genmod;
model y/n = weight dark / dist=bin link=logit;
run;

A.7 SAS file for Poisson regression with grouped crab data in Table 3.3 of 2nd edition (Table 4.3 of first edition)

data crabs;
input width cases satell;
log_case = log(cases);
datalines;

```
22.69  14  14
23.84  14  20
24.77  28  67
25.84  39 105
26.79  22  63
27.74  24  93
28.67  18  71
30.41  14  72
```

;
proc genmod;
model satell = width / dist=poi link=log offset=log_case obstats ;
run;

A.8 SAS file for logistic regression with Table 4.1 of 2nd edition (Table 5.1 of 1st edition)

data crabs;
input width cases satell;
datalines;

```
22.69 14  5
23.84 14  4
24.77 28 17
25.84 39 21
26.79 22 15
27.74 24 20
28.67 18 15
30.41 14 14
```

;
proc genmod;
model satell/cases = width / dist=bin link=logit waldci lrci alpha=.01;
proc logistic;
model satell/cases = width / influence ;
output out=predict p=pi_hat lower=LCL upper=UCL;
proc print data=predict;
proc logistic;
model satell/cases = / influence ;
run;

A.9 SAS file for analyses of AIDS-AZT data in Table 4.4 of 2nd edition (Table 5.1 of first edition)

data aids;
input race \$ azt \$ yes no @@;
cases = yes + no;
datalines;

```
white  y  14  93  white  n  32  81
black  y  11  52  black  n  12  43
```

;
proc genmod order=data; class race azt;
model yes/cases = race azt / dist=bin link=logit obstats type3;
run;

A.9a Data file for Fowlkes et al. data referred to in Exercise 4.33 (s = satisfied and n = not satisfied for response, w = white and o = other for race, m = male and f = female for gender, 1 is less than 35 and 2 is 35-44 and 3 is greater than 44 for age, 1 = NE and 2 = Mid-Atlantic and 3 = Southern and 4 = Midwest and 5 = Northwest and 6 = Southwest and 7 = Pacific for region.

data fowlkes;
input response \$ region race \$ age gender \$ count ;
datalines;

```
s 1 w 1 m 288
u 1 w 1 m 177
s 1 w 1 f  60
u 1 w 1 f  57
s 1 w 2 m 224
u 1 w 2 m 166
s 1 w 2 f  35
u 1 w 2 f  19
s 1 w 3 m 337
u 1 w 3 m 172
s 1 w 3 f  70
u 1 w 3 f  30
s 1 o 1 m  38
u 1 o 1 m  33
s 1 o 1 f  19
u 1 o 1 f  35
s 1 o 2 m  32
u 1 o 2 m  11
s 1 o 2 f  22
u 1 o 2 f  20
s 1 o 3 m  21
u 1 o 3 m   8
s 1 o 3 f  15
u 1 o 3 f  10

s 2 w 1 m  90
u 2 w 1 m  45
s 2 w 1 f  19
u 2 w 1 f  12
s 2 w 2 m  96
u 2 w 2 m  42
s 2 w 2 f  12
u 2 w 2 f   5
s 2 w 3 m 124
u 2 w 3 m  39
s 2 w 3 f  17
u 2 w 3 f   2
s 2 o 1 m  18
u 2 o 1 m   6
s 2 o 1 f  13
u 2 o 1 f   7
s 2 o 2 m   7
u 2 o 2 m   2
s 2 o 2 f   0
u 2 o 2 f   3
s 2 o 3 m   9
u 2 o 3 m   2
s 2 o 3 f   1
u 2 o 3 f   1

s 3 w 1 m 226
u 3 w 1 m 128
s 3 w 1 f  88
u 3 w 1 f  57
s 3 w 2 m 189
u 3 w 2 m 117
s 3 w 2 f  44
u 3 w 2 f  34
s 3 w 3 m 156
u 3 w 3 m  73
s 3 w 3 f  70
u 3 w 3 f  25
s 3 o 1 m  45
u 3 o 1 m  31
s 3 o 1 f  47
u 3 o 1 f  35
s 3 o 2 m  18
u 3 o 2 m   3
s 3 o 2 f  13
u 3 o 2 f   7
s 3 o 3 m  11
u 3 o 3 m   2
s 3 o 3 f   9
u 3 o 3 f   2

s 4 w 1 m 285
u 4 w 1 m 179
s 4 w 1 f 110
u 4 w 1 f  93
s 4 w 2 m 225
u 4 w 2 m 141
s 4 w 2 f  53
u 4 w 2 f  24
s 4 w 3 m 324
u 4 w 3 m 140
s 4 w 3 f  60
u 4 w 3 f  47
s 4 o 1 m  40
u 4 o 1 m  25
s 4 o 1 f  66
u 4 o 1 f  56
s 4 o 2 m  19
u 4 o 2 m  11
s 4 o 2 f  25
u 4 o 2 f  19
s 4 o 3 m  22
u 4 o 3 m   2
s 4 o 3 f  11
u 4 o 3 f  12

s 5 w 1 m 270
u 5 w 1 m 180
s 5 w 1 f 176
u 5 w 1 f 151
s 5 w 2 m 215
u 5 w 2 m 108
s 5 w 2 f  80
u 5 w 2 f  40
s 5 w 3 m 269
u 5 w 3 m 136
s 5 w 3 f 110
u 5 w 3 f  40
s 5 o 1 m  36
u 5 o 1 m  20
s 5 o 1 f  25
u 5 o 1 f  16
s 5 o 2 m   9
u 5 o 2 m   7
s 5 o 2 f  11
u 5 o 2 f   5
s 5 o 3 m  16
u 5 o 3 m   3
s 5 o 3 f   4
u 5 o 3 f   5

s 6 w 1 m 252
u 6 w 1 m 126
s 6 w 1 f  97
u 6 w 1 f  61
s 6 w 2 m 162
u 6 w 2 m  72
s 6 w 2 f  47
u 6 w 2 f  27
s 6 w 3 m 199
u 6 w 3 m  93
s 6 w 3 f  62
u 6 w 3 f  24
s 6 o 1 m  69
u 6 o 1 m  27
s 6 o 1 f  45
u 6 o 1 f  36
s 6 o 2 m  14
u 6 o 2 m   7
s 6 o 2 f   8
u 6 o 2 f   4
s 6 o 3 m  14
u 6 o 3 m   5
s 6 o 3 f   2
u 6 o 3 f   0

s 7 w 1 m 119
u 7 w 1 m  58
s 7 w 1 f  62
u 7 w 1 f  33
s 7 w 2 m  66
u 7 w 2 m  20
s 7 w 2 f  20
u 7 w 2 f  10
s 7 w 3 m  67
u 7 w 3 m  21
s 7 w 3 f  25
u 7 w 3 f  10
s 7 o 1 m  45
u 7 o 1 m  16
s 7 o 1 f  22
u 7 o 1 f  15
s 7 o 2 m  15
u 7 o 2 m  10
s 7 o 2 f  10
u 7 o 2 f   8
s 7 o 3 m   8
u 7 o 3 m   6
s 7 o 3 f   6
u 7 o 3 f   2
```

;

A.10 SAS file for loglinear model (AM, CM) with Table 7.3

data drugs;
input a c m count @@;
datalines;

```
1 1 1 911   1 1 2 538   1 2 1 44   1 2 2 456
2 1 1   3   2 1 2  43   2 2 1  2   2 2 2 279
```

;
proc genmod; class a c m;
model count = a c m a*m c*m / dist=poi link=log obstats;
proc catmod; weight count;
model a*c*m = _response_; loglin a|m c|m;
run;

A.11 SAS file for linear-by-linear association with Table 7.15 of 2nd edition (Table 7.3 of first edition)

data sex;
input premar birth count @@;
assoc = premar*birth;
datalines;

```
1 1  38   1 2  60   1 3 68   1 4 81
2 1  14   2 2  29   2 3 26   2 4 24
3 1  42   3 2  74   3 3 41   3 4 18
4 1 157   4 2 161   4 3 57   4 4 36
```

;
proc genmod; class premar birth;
model count = premar birth assoc / dist=poi link=log;
run;

A.12 SAS file for CMH analyses of Table 6.12 of 2nd edition (Table 7.3 of first edition)

data cmh;
input gender \$ income satisf count @@;
datalines;

```
F  3 1 1    F 3  3 3    F  3 4 11    F  3 5 2
F 10 1 2    F 10 3 3    F 10 4 17    F 10 5 3
F 20 1 0    F 20 3 1    F 20 4  8    F 20 5 5
F 35 1 0    F 35 3 2    F 35 4  4    F 35 5 2
M  3 1 1    M  3 3 1    M  3 4  2    M  3 5 1
M 10 1 0    M 10 3 3    M 10 4  5    M 10 5 1
M 20 1 0    M 20 3 0    M 20 4  7    M 20 5 3
M 35 1 0    M 35 3 1    M 35 4  9    M 35 5 6
```

;
proc freq; weight count;
tables gender*income*satisf / cmh;
run;

A.13 SAS file for baseline-category logit model with Table 6.1 of 2nd edition (Table 8.1 of first edition)

data gator;
input length choice \$ @@;
datalines;

```
1.24 I  1.30 I  1.30 I  1.32 F  1.32 F  1.40 F  1.42 I  1.42 F
1.45 I  1.45 O  1.47 I  1.47 F  1.50 I  1.52 I  1.55 I  1.60 I
1.63 I  1.65 O  1.65 I  1.65 F  1.65 F  1.68 F  1.70 I  1.73 O
1.78 I  1.78 I  1.78 O  1.80 I  1.80 F  1.85 F  1.88 I  1.93 I
1.98 I  2.03 F  2.03 F  2.16 F  2.26 F  2.31 F  2.31 F  2.36 F
2.36 F  2.39 F  2.41 F  2.44 F  2.46 F  2.56 O  2.67 F  2.72 I
2.79 F  2.84 F  3.25 O  3.28 O  3.33 F  3.56 F  3.58 F  3.66 F
3.68 O  3.71 F  3.89 F
```

;
proc catmod; response logits; direct length;
model choice = length / pred=prob pred=freq;
run;

A.14 SAS file for ordinal logit models with Table 8.6 (A similar table in the 2nd edition is Table 6.7 on political ideology)

data ideology;
input party ideology count @@;
datalines;

```
1 1 80   1 2 81   1 3 171   1 4 41   1 5 55
0 1 30   0 2 46   0 3 148   0 4 84   0 5 99
```

;
proc logistic; weight count;
model ideology = party;
proc catmod; weight count; response clogits;
model ideology = _response_ party;
proc catmod; weight count; response alogits;
model ideology = _response_ party;
run;

A.15 SAS file for square-table models with Table 8.14 in 2nd edition (This is Table 9.6 in first edition)

data sex;
input premar extramar symm qi count @@;
datalines;

```
1 1 1 1 144    1 2 2 5  2   1 3 3 5  0   1 4  4 5 0
2 1 2 5  33    2 2 5 2  4   2 3 6 5  2   2 4  7 5 0
3 1 3 5  84    3 2 6 5 14   3 3 8 3  6   3 4  9 5 1
4 1 4 5 126    4 2 7 5 29   4 3 9 5 25   4 4 10 4 5
```

;
proc genmod; class symm;
model count = symm / dist=poi link=log;
proc genmod; class extramar premar symm;
model count = symm extramar premar / dist=poi link=log;
proc genmod; class symm;
model count = symm extramar premar / dist=poi link=log;
proc genmod; class extramar premar qi;
model count = extramar premar qi / dist=poi link=log;
proc freq; weight count;
tables premar*extramar / agree;
data sex2;
input score below above @@; trials = below + above;
datalines;
1 33 2 1 14 2 1 25 1 2 84 0 2 29 0 3 126 0
;
proc genmod;
model above/trials = score / dist=bin link=logit noint;
proc genmod;
model above/trials = / dist=bin link=logit noint;
run;

A.16 SAS file for Bradley-Terry model with Table 9.9 on female tennis players (followed by corresponding code for Table 8.9 in 2nd edition)

data tennis;
input wins matches seles graf sabat navrat sanchez;
datalines;

```
2  5  1 -1  0  0  0
1  1  1  0 -1  0  0
3  6  1  0  0 -1  0
2  2  1  0  0  0 -1
6  9  0  1 -1  0  0
3  3  0  1  0 -1  0
7  8  0  1  0  0 -1
1  3  0  0  1 -1  0
3  5  0  0  1  0 -1
3  4  0  0  0  1 -1
```

;
proc genmod;
model wins/matches = seles graf sabat navrat sanchez /
proc genmod;
model wins/matches = / dist=bin link=logit noint;
run;

data tennis2
input wins matches agassiz federer henman hewitt roddick;
datalines;

```
0  6  1 -1  0  0  0
0  0  1  0 -1  0  0
1  1  1  0  0 -1  0
1  1  1  0  0  0 -1
3  4  0  1 -1  0  0
9  9  0  1  0 -1  0
5  5  0  1  0  0 -1
0  2  0  0  1 -1  0
1  2  0  0  1  0 -1
3  5  0  0  0  1 -1
```

;
proc genmod;
model wins/matches = seles graf sabat navrat sanchez /
proc genmod;
model wins/matches = / dist=bin link=logit noint;
run;

A.16 SAS file for GEE analysis with depression data in Table 9.1 of 2nd edition

data depress;
input case diagnose treat time outcome ; * outcome=1 is normal;
datalines;

```
1  0  0  0  1
1  0  0  1  1
1  0  0  2  1
2  0  0  0  1
2  0  0  1  1
2  0  0  2  1
3  0  0  0  1
3  0  0  1  1
3  0  0  2  1
4  0  0  0  1
4  0  0  1  1
4  0  0  2  1
5  0  0  0  1
5  0  0  1  1
5  0  0  2  1
6  0  0  0  1
6  0  0  1  1
6  0  0  2  1
7  0  0  0  1
7  0  0  1  1
7  0  0  2  1
8  0  0  0  1
8  0  0  1  1
8  0  0  2  1
9  0  0  0  1
9  0  0  1  1
9  0  0  2  1
10  0  0  0  1
10  0  0  1  1
10  0  0  2  1
11  0  0  0  1
11  0  0  1  1
11  0  0  2  1
12  0  0  0  1
12  0  0  1  1
12  0  0  2  1
13  0  0  0  1
13  0  0  1  1
13  0  0  2  1
14  0  0  0  1
14  0  0  1  1
14  0  0  2  1
15  0  0  0  1
15  0  0  1  1
15  0  0  2  1
16  0  0  0  1
16  0  0  1  1
16  0  0  2  1
17  0  0  0  1
17  0  0  1  1
17  0  0  2  0
18  0  0  0  1
18  0  0  1  1
18  0  0  2  0
19  0  0  0  1
19  0  0  1  1
19  0  0  2  0
20  0  0  0  1
20  0  0  1  1
20  0  0  2  0
21  0  0  0  1
21  0  0  1  1
21  0  0  2  0
22  0  0  0  1
22  0  0  1  1
22  0  0  2  0
23  0  0  0  1
23  0  0  1  1
23  0  0  2  0
24  0  0  0  1
24  0  0  1  1
24  0  0  2  0
25  0  0  0  1
25  0  0  1  1
25  0  0  2  0
26  0  0  0  1
26  0  0  1  1
26  0  0  2  0
27  0  0  0  1
27  0  0  1  1
27  0  0  2  0
28  0  0  0  1
28  0  0  1  1
28  0  0  2  0
29  0  0  0  1
29  0  0  1  1
29  0  0  2  0
30  0  0  0  1
30  0  0  1  0
30  0  0  2  1
31  0  0  0  1
31  0  0  1  0
31  0  0  2  1
32  0  0  0  1
32  0  0  1  0
32  0  0  2  1
33  0  0  0  1
33  0  0  1  0
33  0  0  2  1
34  0  0  0  1
34  0  0  1  0
34  0  0  2  1
35  0  0  0  1
35  0  0  1  0
35  0  0  2  1
36  0  0  0  1
36  0  0  1  0
36  0  0  2  1
37  0  0  0  1
37  0  0  1  0
37  0  0  2  1
38  0  0  0  1
38  0  0  1  0
38  0  0  2  1
39  0  0  0  1
39  0  0  1  0
39  0  0  2  0
40  0  0  0  1
40  0  0  1  0
40  0  0  2  0
41  0  0  0  1
41  0  0  1  0
41  0  0  2  0
42  0  0  0  0
42  0  0  1  1
42  0  0  2  1
43  0  0  0  0
43  0  0  1  1
43  0  0  2  1
44  0  0  0  0
44  0  0  1  1
44  0  0  2  1
45  0  0  0  0
45  0  0  1  1
45  0  0  2  1
46  0  0  0  0
46  0  0  1  1
46  0  0  2  1
47  0  0  0  0
47  0  0  1  1
47  0  0  2  1
48  0  0  0  0
48  0  0  1  1
48  0  0  2  1
49  0  0  0  0
49  0  0  1  1
49  0  0  2  1
50  0  0  0  0
50  0  0  1  1
50  0  0  2  1
51  0  0  0  0
51  0  0  1  1
51  0  0  2  1
52  0  0  0  0
52  0  0  1  1
52  0  0  2  1
53  0  0  0  0
53  0  0  1  1
53  0  0  2  1
54  0  0  0  0
54  0  0  1  1
54  0  0  2  1
55  0  0  0  0
55  0  0  1  1
55  0  0  2  1
56  0  0  0  0
56  0  0  1  1
56  0  0  2  0
57  0  0  0  0
57  0  0  1  1
57  0  0  2  0
58  0  0  0  0
58  0  0  1  1
58  0  0  2  0
59  0  0  0  0
59  0  0  1  1
59  0  0  2  0
60  0  0  0  0
60  0  0  1  0
60  0  0  2  1
61  0  0  0  0
61  0  0  1  0
61  0  0  2  1
62  0  0  0  0
62  0  0  1  0
62  0  0  2  1
63  0  0  0  0
63  0  0  1  0
63  0  0  2  1
64  0  0  0  0
64  0  0  1  0
64  0  0  2  1
65  0  0  0  0
65  0  0  1  0
65  0  0  2  1
66  0  0  0  0
66  0  0  1  0
66  0  0  2  1
67  0  0  0  0
67  0  0  1  0
67  0  0  2  1
68  0  0  0  0
68  0  0  1  0
68  0  0  2  1
69  0  0  0  0
69  0  0  1  0
69  0  0  2  1
70  0  0  0  0
70  0  0  1  0
70  0  0  2  1
71  0  0  0  0
71  0  0  1  0
71  0  0  2  1
72  0  0  0  0
72  0  0  1  0
72  0  0  2  1
73  0  0  0  0
73  0  0  1  0
73  0  0  2  1
74  0  0  0  0
74  0  0  1  0
74  0  0  2  1
75  0  0  0  0
75  0  0  1  0
75  0  0  2  0
336  0  0  0  0
336  0  0  1  0
336  0  0  2  0
337  0  0  0  0
337  0  0  1  0
337  0  0  2  0
338  0  0  0  0
338  0  0  1  0
338  0  0  2  0
339  0  0  0  0
339  0  0  1  0
339  0  0  2  0
340  0  0  0  0
340  0  0  1  0
340  0  0  2  0
76  0  1  0  1
76  0  1  1  1
76  0  1  2  1
77  0  1  0  1
77  0  1  1  1
77  0  1  2  1
78  0  1  0  1
78  0  1  1  1
78  0  1  2  1
79  0  1  0  1
79  0  1  1  1
79  0  1  2  1
80  0  1  0  1
80  0  1  1  1
80  0  1  2  1
81  0  1  0  1
81  0  1  1  1
81  0  1  2  1
82  0  1  0  1
82  0  1  1  1
82  0  1  2  1
83  0  1  0  1
83  0  1  1  1
83  0  1  2  1
84  0  1  0  1
84  0  1  1  1
84  0  1  2  1
85  0  1  0  1
85  0  1  1  1
85  0  1  2  1
86  0  1  0  1
86  0  1  1  1
86  0  1  2  1
87  0  1  0  1
87  0  1  1  1
87  0  1  2  1
88  0  1  0  1
88  0  1  1  1
88  0  1  2  1
89  0  1  0  1
89  0  1  1  1
89  0  1  2  1
90  0  1  0  1
90  0  1  1  1
90  0  1  2  1
91  0  1  0  1
91  0  1  1  1
91  0  1  2  1
92  0  1  0  1
92  0  1  1  1
92  0  1  2  1
93  0  1  0  1
93  0  1  1  1
93  0  1  2  1
94  0  1  0  1
94  0  1  1  1
94  0  1  2  1
95  0  1  0  1
95  0  1  1  1
95  0  1  2  1
96  0  1  0  1
96  0  1  1  1
96  0  1  2  1
97  0  1  0  1
97  0  1  1  1
97  0  1  2  1
98  0  1  0  1
98  0  1  1  1
98  0  1  2  1
99  0  1  0  1
99  0  1  1  1
99  0  1  2  1
100  0  1  0  1
100  0  1  1  1
100  0  1  2  1
101  0  1  0  1
101  0  1  1  1
101  0  1  2  1
102  0  1  0  1
102  0  1  1  1
102  0  1  2  1
103  0  1  0  1
103  0  1  1  1
103  0  1  2  1
104  0  1  0  1
104  0  1  1  1
104  0  1  2  1
105  0  1  0  1
105  0  1  1  1
105  0  1  2  1
106  0  1  0  1
106  0  1  1  1
106  0  1  2  1
107  0  1  0  1
107  0  1  1  0
107  0  1  2  1
108  0  1  0  1
108  0  1  1  0
108  0  1  2  1
109  0  1  0  1
109  0  1  1  0
109  0  1  2  1
110  0  1  0  1
110  0  1  1  0
110  0  1  2  1
111  0  1  0  1
111  0  1  1  0
111  0  1  2  1
112  0  1  0  1
112  0  1  1  0
112  0  1  2  1
113  0  1  0  0
113  0  1  1  1
113  0  1  2  1
114  0  1  0  0
114  0  1  1  1
114  0  1  2  1
115  0  1  0  0
115  0  1  1  1
115  0  1  2  1
116  0  1  0  0
116  0  1  1  1
116  0  1  2  1
117  0  1  0  0
117  0  1  1  1
117  0  1  2  1
118  0  1  0  0
118  0  1  1  1
118  0  1  2  1
119  0  1  0  0
119  0  1  1  1
119  0  1  2  1
120  0  1  0  0
120  0  1  1  1
120  0  1  2  1
121  0  1  0  0
121  0  1  1  1
121  0  1  2  1
122  0  1  0  0
122  0  1  1  1
122  0  1  2  1
123  0  1  0  0
123  0  1  1  1
123  0  1  2  1
124  0  1  0  0
124  0  1  1  1
124  0  1  2  1
125  0  1  0  0
125  0  1  1  1
125  0  1  2  1
126  0  1  0  0
126  0  1  1  1
126  0  1  2  1
127  0  1  0  0
127  0  1  1  1
127  0  1  2  1
128  0  1  0  0
128  0  1  1  1
128  0  1  2  1
129  0  1  0  0
129  0  1  1  1
129  0  1  2  1
130  0  1  0  0
130  0  1  1  1
130  0  1  2  1
131  0  1  0  0
131  0  1  1  1
131  0  1  2  1
132  0  1  0  0
132  0  1  1  1
132  0  1  2  1
133  0  1  0  0
133  0  1  1  1
133  0  1  2  1
134  0  1  0  0
134  0  1  1  1
134  0  1  2  1
135  0  1  0  0
135  0  1  1  1
135  0  1  2  0
136  0  1  0  0
136  0  1  1  1
136  0  1  2  0
137  0  1  0  0
137  0  1  1  0
137  0  1  2  1
138  0  1  0  0
138  0  1  1  0
138  0  1  2  1
139  0  1  0  0
139  0  1  1  0
139  0  1  2  1
140  0  1  0  0
140  0  1  1  0
140  0  1  2  1
141  0  1  0  0
141  0  1  1  0
141  0  1  2  1
142  0  1  0  0
142  0  1  1  0
142  0  1  2  1
143  0  1  0  0
143  0  1  1  0
143  0  1  2  1
144  0  1  0  0
144  0  1  1  0
144  0  1  2  1
145  0  1  0  0
145  0  1  1  0
145  0  1  2  1
146  1  0  0  1
146  1  0  1  1
146  1  0  2  1
147  1  0  0  1
147  1  0  1  1
147  1  0  2  1
148  1  0  0  1
148  1  0  1  1
148  1  0  2  0
149  1  0  0  1
149  1  0  1  1
149  1  0  2  0
150  1  0  0  1
150  1  0  1  0
150  1  0  2  1
151  1  0  0  1
151  1  0  1  0
151  1  0  2  1
152  1  0  0  1
152  1  0  1  0
152  1  0  2  1
153  1  0  0  1
153  1  0  1  0
153  1  0  2  1
154  1  0  0  1
154  1  0  1  0
154  1  0  2  1
155  1  0  0  1
155  1  0  1  0
155  1  0  2  1
156  1  0  0  1
156  1  0  1  0
156  1  0  2  1
157  1  0  0  1
157  1  0  1  0
157  1  0  2  1
158  1  0  0  1
158  1  0  1  0
158  1  0  2  0
159  1  0  0  1
159  1  0  1  0
159  1  0  2  0
160  1  0  0  1
160  1  0  1  0
160  1  0  2  0
161  1  0  0  1
161  1  0  1  0
161  1  0  2  0
162  1  0  0  1
162  1  0  1  0
162  1  0  2  0
163  1  0  0  1
163  1  0  1  0
163  1  0  2  0
164  1  0  0  1
164  1  0  1  0
164  1  0  2  0
165  1  0  0  1
165  1  0  1  0
165  1  0  2  0
166  1  0  0  1
166  1  0  1  0
166  1  0  2  0
167  1  0  0  0
167  1  0  1  1
167  1  0  2  1
168  1  0  0  0
168  1  0  1  1
168  1  0  2  1
169  1  0  0  0
169  1  0  1  1
169  1  0  2  1
170  1  0  0  0
170  1  0  1  1
170  1  0  2  1
171  1  0  0  0
171  1  0  1  1
171  1  0  2  1
172  1  0  0  0
172  1  0  1  1
172  1  0  2  1
173  1  0  0  0
173  1  0  1  1
173  1  0  2  1
174  1  0  0  0
174  1  0  1  1
174  1  0  2  1
175  1  0  0  0
175  1  0  1  1
175  1  0  2  1
176  1  0  0  0
176  1  0  1  1
176  1  0  2  0
177  1  0  0  0
177  1  0  1  1
177  1  0  2  0
178  1  0  0  0
178  1  0  1  1
178  1  0  2  0
179  1  0  0  0
179  1  0  1  1
179  1  0  2  0
180  1  0  0  0
180  1  0  1  1
180  1  0  2  0
181  1  0  0  0
181  1  0  1  1
181  1  0  2  0
182  1  0  0  0
182  1  0  1  1
182  1  0  2  0
183  1  0  0  0
183  1  0  1  1
183  1  0  2  0
184  1  0  0  0
184  1  0  1  1
184  1  0  2  0
185  1  0  0  0
185  1  0  1  1
185  1  0  2  0
186  1  0  0  0
186  1  0  1  1
186  1  0  2  0
187  1  0  0  0
187  1  0  1  1
187  1  0  2  0
188  1  0  0  0
188  1  0  1  1
188  1  0  2  0
189  1  0  0  0
189  1  0  1  1
189  1  0  2  0
190  1  0  0  0
190  1  0  1  1
190  1  0  2  0
191  1  0  0  0
191  1  0  1  0
191  1  0  2  1
192  1  0  0  0
192  1  0  1  0
192  1  0  2  1
193  1  0  0  0
193  1  0  1  0
193  1  0  2  1
194  1  0  0  0
194  1  0  1  0
194  1  0  2  1
195  1  0  0  0
195  1  0  1  0
195  1  0  2  1
196  1  0  0  0
196  1  0  1  0
196  1  0  2  1
197  1  0  0  0
197  1  0  1  0
197  1  0  2  1
198  1  0  0  0
198  1  0  1  0
198  1  0  2  1
199  1  0  0  0
199  1  0  1  0
199  1  0  2  1
200  1  0  0  0
200  1  0  1  0
200  1  0  2  1
201  1  0  0  0
201  1  0  1  0
201  1  0  2  1
202  1  0  0  0
202  1  0  1  0
202  1  0  2  1
203  1  0  0  0
203  1  0  1  0
203  1  0  2  1
204  1  0  0  0
204  1  0  1  0
204  1  0  2  1
205  1  0  0  0
205  1  0  1  0
205  1  0  2  1
206  1  0  0  0
206  1  0  1  0
206  1  0  2  1
207  1  0  0  0
207  1  0  1  0
207  1  0  2  1
208  1  0  0  0
208  1  0  1  0
208  1  0  2  1
209  1  0  0  0
209  1  0  1  0
209  1  0  2  1
210  1  0  0  0
210  1  0  1  0
210  1  0  2  1
211  1  0  0  0
211  1  0  1  0
211  1  0  2  1
212  1  0  0  0
212  1  0  1  0
212  1  0  2  1
213  1  0  0  0
213  1  0  1  0
213  1  0  2  1
214  1  0  0  0
214  1  0  1  0
214  1  0  2  1
215  1  0  0  0
215  1  0  1  0
215  1  0  2  1
216  1  0  0  0
216  1  0  1  0
216  1  0  2  1
217  1  0  0  0
217  1  0  1  0
217  1  0  2  1
218  1  0  0  0
218  1  0  1  0
218  1  0  2  0
219  1  0  0  0
219  1  0  1  0
219  1  0  2  0
220  1  0  0  0
220  1  0  1  0
220  1  0  2  0
221  1  0  0  0
221  1  0  1  0
221  1  0  2  0
222  1  0  0  0
222  1  0  1  0
222  1  0  2  0
223  1  0  0  0
223  1  0  1  0
223  1  0  2  0
224  1  0  0  0
224  1  0  1  0
224  1  0  2  0
225  1  0  0  0
225  1  0  1  0
225  1  0  2  0
226  1  0  0  0
226  1  0  1  0
226  1  0  2  0
227  1  0  0  0
227  1  0  1  0
227  1  0  2  0
228  1  0  0  0
228  1  0  1  0
228  1  0  2  0
229  1  0  0  0
229  1  0  1  0
229  1  0  2  0
230  1  0  0  0
230  1  0  1  0
230  1  0  2  0
231  1  0  0  0
231  1  0  1  0
231  1  0  2  0
232  1  0  0  0
232  1  0  1  0
232  1  0  2  0
233  1  0  0  0
233  1  0  1  0
233  1  0  2  0
234  1  0  0  0
234  1  0  1  0
234  1  0  2  0
235  1  0  0  0
235  1  0  1  0
235  1  0  2  0
236  1  0  0  0
236  1  0  1  0
236  1  0  2  0
237  1  0  0  0
237  1  0  1  0
237  1  0  2  0
238  1  0  0  0
238  1  0  1  0
238  1  0  2  0
239  1  0  0  0
239  1  0  1  0
239  1  0  2  0
240  1  0  0  0
240  1  0  1  0
240  1  0  2  0
241  1  0  0  0
241  1  0  1  0
241  1  0  2  0
242  1  0  0  0
242  1  0  1  0
242  1  0  2  0
243  1  0  0  0
243  1  0  1  0
243  1  0  2  0
244  1  0  0  0
244  1  0  1  0
244  1  0  2  0
245  1  0  0  0
245  1  0  1  0
245  1  0  2  0
246  1  1  0  1
246  1  1  1  1
246  1  1  2  1
247  1  1  0  1
247  1  1  1  1
247  1  1  2  1
248  1  1  0  1
248  1  1  1  1
248  1  1  2  1
249  1  1  0  1
249  1  1  1  1
249  1  1  2  1
250  1  1  0  1
250  1  1  1  1
250  1  1  2  1
251  1  1  0  1
251  1  1  1  1
251  1  1  2  1
252  1  1  0  1
252  1  1  1  1
252  1  1  2  1
253  1  1  0  1
253  1  1  1  1
253  1  1  2  0
254  1  1  0  1
254  1  1  1  1
254  1  1  2  0
255  1  1  0  1
255  1  1  1  0
255  1  1  2  1
256  1  1  0  1
256  1  1  1  0
256  1  1  2  1
257  1  1  0  1
257  1  1  1  0
257  1  1  2  1
258  1  1  0  1
258  1  1  1  0
258  1  1  2  1
259  1  1  0  1
259  1  1  1  0
259  1  1  2  1
260  1  1  0  1
260  1  1  1  0
260  1  1  2  0
261  1  1  0  1
261  1  1  1  0
261  1  1  2  0
262  1  1  0  0
262  1  1  1  1
262  1  1  2  1
263  1  1  0  0
263  1  1  1  1
263  1  1  2  1
264  1  1  0  0
264  1  1  1  1
264  1  1  2  1
265  1  1  0  0
265  1  1  1  1
265  1  1  2  1
266  1  1  0  0
266  1  1  1  1
266  1  1  2  1
267  1  1  0  0
267  1  1  1  1
267  1  1  2  1
268  1  1  0  0
268  1  1  1  1
268  1  1  2  1
269  1  1  0  0
269  1  1  1  1
269  1  1  2  1
270  1  1  0  0
270  1  1  1  1
270  1  1  2  1
271  1  1  0  0
271  1  1  1  1
271  1  1  2  1
272  1  1  0  0
272  1  1  1  1
272  1  1  2  1
273  1  1  0  0
273  1  1  1  1
273  1  1  2  1
274  1  1  0  0
274  1  1  1  1
274  1  1  2  1
275  1  1  0  0
275  1  1  1  1
275  1  1  2  1
276  1  1  0  0
276  1  1  1  1
276  1  1  2  1
277  1  1  0  0
277  1  1  1  1
277  1  1  2  1
278  1  1  0  0
278  1  1  1  1
278  1  1  2  1
279  1  1  0  0
279  1  1  1  1
279  1  1  2  1
280  1  1  0  0
280  1  1  1  1
280  1  1  2  1
281  1  1  0  0
281  1  1  1  1
281  1  1  2  1
282  1  1  0  0
282  1  1  1  1
282  1  1  2  1
283  1  1  0  0
283  1  1  1  1
283  1  1  2  1
284  1  1  0  0
284  1  1  1  1
284  1  1  2  1
285  1  1  0  0
285  1  1  1  1
285  1  1  2  1
286  1  1  0  0
286  1  1  1  1
286  1  1  2  1
287  1  1  0  0
287  1  1  1  1
287  1  1  2  1
288  1  1  0  0
288  1  1  1  1
288  1  1  2  1
289  1  1  0  0
289  1  1  1  1
289  1  1  2  1
290  1  1  0  0
290  1  1  1  1
290  1  1  2  1
291  1  1  0  0
291  1  1  1  1
291  1  1  2  1
292  1  1  0  0
292  1  1  1  1
292  1  1  2  1
293  1  1  0  0
293  1  1  1  1
293  1  1  2  0
294  1  1  0  0
294  1  1  1  1
294  1  1  2  0
295  1  1  0  0
295  1  1  1  1
295  1  1  2  0
296  1  1  0  0
296  1  1  1  1
296  1  1  2  0
297  1  1  0  0
297  1  1  1  1
297  1  1  2  0
298  1  1  0  0
298  1  1  1  0
298  1  1  2  1
299  1  1  0  0
299  1  1  1  0
299  1  1  2  1
300  1  1  0  0
300  1  1  1  0
300  1  1  2  1
301  1  1  0  0
301  1  1  1  0
301  1  1  2  1
302  1  1  0  0
302  1  1  1  0
302  1  1  2  1
303  1  1  0  0
303  1  1  1  0
303  1  1  2  1
304  1  1  0  0
304  1  1  1  0
304  1  1  2  1
305  1  1  0  0
305  1  1  1  0
305  1  1  2  1
306  1  1  0  0
306  1  1  1  0
306  1  1  2  1
307  1  1  0  0
307  1  1  1  0
307  1  1  2  1
308  1  1  0  0
308  1  1  1  0
308  1  1  2  1
309  1  1  0  0
309  1  1  1  0
309  1  1  2  1
310  1  1  0  0
310  1  1  1  0
310  1  1  2  1
311  1  1  0  0
311  1  1  1  0
311  1  1  2  1
312  1  1  0  0
312  1  1  1  0
312  1  1  2  1
313  1  1  0  0
313  1  1  1  0
313  1  1  2  1
314  1  1  0  0
314  1  1  1  0
314  1  1  2  1
315  1  1  0  0
315  1  1  1  0
315  1  1  2  1
316  1  1  0  0
316  1  1  1  0
316  1  1  2  1
317  1  1  0  0
317  1  1  1  0
317  1  1  2  1
318  1  1  0  0
318  1  1  1  0
318  1  1  2  1
319  1  1  0  0
319  1  1  1  0
319  1  1  2  1
320  1  1  0  0
320  1  1  1  0
320  1  1  2  1
321  1  1  0  0
321  1  1  1  0
321  1  1  2  1
322  1  1  0  0
322  1  1  1  0
322  1  1  2  1
323  1  1  0  0
323  1  1  1  0
323  1  1  2  1
324  1  1  0  0
324  1  1  1  0
324  1  1  2  1
325  1  1  0  0
325  1  1  1  0
325  1  1  2  1
326  1  1  0  0
326  1  1  1  0
326  1  1  2  1
327  1  1  0  0
327  1  1  1  0
327  1  1  2  1
328  1  1  0  0
328  1  1  1  0
328  1  1  2  1
329  1  1  0  0
329  1  1  1  0
329  1  1  2  1
330  1  1  0  0
330  1  1  1  0
330  1  1  2  0
331  1  1  0  0
331  1  1  1  0
331  1  1  2  0
332  1  1  0  0
332  1  1  1  0
332  1  1  2  0
333  1  1  0  0
333  1  1  1  0
333  1  1  2  0
334  1  1  0  0
334  1  1  1  0
334  1  1  2  0
335  1  1  0  0
335  1  1  1  0
335  1  1  2  0
```

;
proc genmod descending; class case;
model outcome = diagnose treat time treat*time / dist=bin link=logit type3;
repeated subject=case / type=exch corrw;
proc nlmixed qpoints=200;
parms alpha=-.03 beta1=-1.3 beta2=-.06 beta3=.48 beta4=1.02 sigma=.066;
eta = alpha + beta1*diagnose + beta2*treat + beta3*time + beta4*treat*time + u;
p = exp(eta)/(1 + exp(eta));
model outcome ~ binary(p);
random u ~ normal(0, sigma*sigma) subject = case;
run;

A.17 SAS file for fixed and random effects models and GEE analysis with Table 10.8 of 2nd edition

data efron;
input study treat y n @@ ; * y successes out of n trials;
treat2 = treat;
if treat = 1 then treat = .5; else treat = -.5;
datalines;

```
1 1 7 15  1 0 11 13
2 1 8 19  2 0 8 16
3 1 5 34  3 0 4 39
4 1 7 36  4 0 4 31
5 1 3 12  5 0 0 12
6 1 4 7   6 0 4 4
7 1 4 17  7 0 13 24
8 1 1 16  8 0 13 16
9 1 3 14  9 0 7 22
10 1 2 38  10 0 12 32
11 1 6 12  11 0 8 8
12 1 2 7   12 0 7 9
13 1 9 21  13 0 7 24
14 1 7 21  14 0 5 25
15 1 3 25  15 0 11 32
16 1 4 11  16 0 6 10
17 1 2 10  17 0 8 10
18 1 1 31  18 0 4 27
19 1 4 28  19 0 15 31
20 1 7 43  20 0 16 43
21 1 6 40  21 0 13 21
22 1 4 18  22 0 5 39
23 1 14 68 23 0 13 74
24 1 6 21  24 0 8 21
25 1 0 6   25 0 6 6
26 1 1 10  26 0 5 15
27 1 5 17  27 0 5 15
28 1 0 10  28 0 12 14
29 1 0 22  29 0 8 24
30 1 2 18  30 0 10 21
31 1 1 15  31 0 7 13
32 1 8 24  32 0 15 27
33 1 6 12  33 0 7 9
34 1 0 20  34 0 5 23
35 1 4 17  35 0 2 16
36 1 10 40 36 0 12 20
37 1 3 16  37 0 2 16
38 1 4 34  38 0 5 19
39 1 7 38  39 0 15 37
40 1 0 34  40 0 34 34
41 1 0 9   41 0 0 16
```

;
run;

* note strange data for study 40 ;

proc genmod data=efron; * fixed effects, no interaction model;
class study;
model y/n = treat / dist=bin link=logit noint;
repeated subject = study / type = exch corrw;
run;

proc genmod data=efron; * fixed effects, no interaction model;
class study;
model y/n = treat study / dist=bin link=logit noint;
repeated subject = study / type = exch corrw;
run;

proc genmod data=efron; * GEE, no interaction model;
class study;
model y/n = treat study / dist=bin link=logit noint;
run;

proc nlmixed data=efron; * random effects, no interaction;
pi = exp(a + beta*treat)/(1+exp(a + beta*treat)); * logistic formula for prob;
model y ~ binomial(n, pi);
random a ~ normal(alpha, sig*sig) subject=study;
run;

proc nlmixed data=efron; * random effects, interaction, no corr;
pi = exp(a + b*treat)/(1+exp(a + b*treat));
model y ~ binomial(n, pi);
random a b ~ normal([alpha,beta], [sig_a*sig_a,0,sig_b*sig_b]) subject=study;
run;

proc nlmixed data=efron; * correlated random effects, interaction;
pi = exp(a + b*treat)/(1+exp(a + b*treat));
model y ~ binomial(n, pi);
random a b ~ normal([alpha,beta], [sig_a*sig_a, rho ,sig_b*sig_b]) subject=study;
predict a + b*treat out=new;
run;

proc print data=new;
run;

proc nlmixed data=efron; * correlated random effects, interaction;
pi = exp(alpha + a + beta*treat + b*treat)/(1+exp(alpha + a + beta*treat + b*treat));
model y ~ binomial(n, pi);
random a b ~ normal([0,0], [sig_a*sig_a, rho ,sig_b*sig_b]) subject=study;
predict beta + b out=new2;
run;

proc print data=new2;
run;

This page is maintained by Alan Agresti. Last Updated: December 5, 2006.