Cancer Data - Logistic and Loglinear Analyses

2000-01-28


Logistic Analysis

The data are from Bishop, Fienberg & Holland (1975), Discrete Multivariate Analysis, MIT Press, page 103.

Note that there is one case with n = 0 (row 31 in cancer.logit); in GLMStat this row has to be deleted from the data, in Splus it can be removed with the subset command. (The Subset command in GLMStat should do the same thing but doesn't suppress the "n = 0" error.)

Note the rather odd way you give the Binomial n to Splus: the dependent variable is created with cbind() as a matrix with columns survive and n-survive.

You should be able to duplicate these results exactly in GLMStat.

> fitc1 <- glm(cbind(survive, n - survive) ~ city * age, data = cancer.logit,
        subset = n > 0, family = binomial(link = logit))
Call:
glm(formula = cbind(survive, n - survive) ~ city * age, family = binomial(
        link = logit), data = cancer.logit, subset = n > 0)
 
Coefficients:
 (Intercept)      city1       city2       age1       age2 city1age1 city2age1
   0.8829087 -0.2455197 -0.05302903 0.01288113 -0.1247131 0.2337226 0.1101006
 
  city1age2  city2age2
 0.01946304 0.05995766
 
Degrees of Freedom: 35 Total; 26 Residual
Residual Deviance: 34.19691
> anova(fitc1,test="Chisq")
Analysis of Deviance Table
 
Binomial model
 
Response: cbind(survive, n - survive)
 
Terms added sequentially (first to last)
         Df Deviance Resid. Df Resid. Dev   Pr(Chi)
    NULL                    34   57.58802
    city  2 11.26979        32   46.31823 0.0035711
     age  2  3.52566        30   42.79258 0.1715588
city:age  4  8.59567        26   34.19691 0.0720398
>


Stepwise Logistic Analysis

What is the "best" model for these data? In Splus, try the model: city * age * hist - city:age:hist, or, equivalently, city + age + hist + city:age + age:hist + city:hist, that is, all main effects and two-way interactions, then apply step() to reduce the model. Here is what I ended up with. What does it mean?

Analysis of Deviance Table
 
Binomial model
 
Response: cbind(survive, n - survive)
 
Terms added sequentially (first to last)
     Df Deviance Resid. Df Resid. Dev    Pr(Chi)
NULL                    34   57.58802
city  2 11.26979        32   46.31823 0.00357105
hist  3  9.79477        29   36.52346 0.02039370
 


Loglinear Analysis

You can also duplicate the logistic results with the loglinear data structure: in this case, survive is a factor, so city:age in the logistic analysis will be the same as survive:city:age in the loglinear analysis, city in the logistic analysis will be the same as survive:city in the loglinear analysis, etc.

> fitc2 <- glm(count ~ survive * city * age, family = poisson(link = log), data
         = cancer.loglin)
Call:
glm(formula = count ~ survive * city * age, family = poisson(link = log), data
         = cancer.loglin)
 
Coefficients:
 (Intercept)   survive     city1       city2      age1       age2 survivecity1
    2.098911 0.4414557 0.1240612 -0.01666544 0.1663998 -0.2912447   -0.1227575
 
 survivecity2 surviveage1 surviveage2 city1age1   city2age1 city1age2
  -0.02651606 0.006440126 -0.06235573  0.180255 0.002370039 0.2886847
 
  city2age2 survivecity1age1 survivecity2age1 survivecity1age2
 0.01979807        0.1168608       0.05505104      0.009732593
 
 survivecity2age2
       0.02997881
 
Degrees of Freedom: 72 Total; 54 Residual
Residual Deviance: 484.1559
> anova(fitc2,test="Chisq")
Analysis of Deviance Table
 
Poisson model
 
Response: count
 
Terms added sequentially (first to last)
                 Df Deviance Resid. Df Resid. Dev    Pr(Chi)
            NULL                    71   860.0076
         survive  1 160.6009        70   699.4066 0.00000000
            city  2   9.3619        68   690.0447 0.00927008
             age  2 105.5350        66   584.5097 0.00000000
    survive:city  2  11.2698        64   573.2400 0.00357105
     survive:age  2   7.1529        62   566.0871 0.02797536
        city:age  4  73.3356        58   492.7515 0.00000000
survive:city:age  4   8.5957        54   484.1559 0.07203980
>


Data

> cancer.logit
   inflam benign hist city age survive  n
 1      1      1    1    1   1      26 35
 2      1      1    1    1   2      20 29
 3      1      1    1    1   3       1  3
 4      1      1    1    2   1      11 17
 5      1      1    1    2   2      18 26
 6      1      1    1    2   3      15 24
 7      1      1    1    3   1      16 32
 8      1      1    1    3   2      27 41
 9      1      1    1    3   3      12 15
10      1      2    2    1   1      68 75
11      1      2    2    1   2      46 55
12      1      2    2    1   3       6  9
13      1      2    2    2   1      24 31
14      1      2    2    2   2      58 78
15      1      2    2    2   3      26 44
16      1      2    2    3   1      20 27
17      1      2    2    3   2      39 51
18      1      2    2    3   3      11 18
19      2      1    3    1   1      25 29
20      2      1    3    1   2      18 29
21      2      1    3    1   3       5  6
22      2      1    3    2   1       4 10
23      2      1    3    2   2      10 13
24      2      1    3    2   3       1  4
25      2      1    3    3   1       8 11
26      2      1    3    3   2      10 13
27      2      1    3    3   3       4  7
28      2      2    4    1   1       9 12
29      2      2    4    1   2       5  7
30      2      2    4    1   3       1  1
31      2      2    4    2   1       0  0
32      2      2    4    2   2       3  5
33      2      2    4    2   3       1  1
34      2      2    4    3   1       1  1
35      2      2    4    3   2       4  4
36      2      2    4    3   3       1  1
 
> cancer.loglin
   count inflam benign hist city age survive
 1     9      1      1    1    1   1       1
 2    26      1      1    1    1   1       2
 3     9      1      1    1    1   2       1
 4    20      1      1    1    1   2       2
 5     2      1      1    1    1   3       1
 6     1      1      1    1    1   3       2
 7     6      1      1    1    2   1       1
 8    11      1      1    1    2   1       2
 9     8      1      1    1    2   2       1
10    18      1      1    1    2   2       2
11     9      1      1    1    2   3       1
12    15      1      1    1    2   3       2
13    16      1      1    1    3   1       1
14    16      1      1    1    3   1       2
15    14      1      1    1    3   2       1
16    27      1      1    1    3   2       2
17     3      1      1    1    3   3       1
18    12      1      1    1    3   3       2
19     7      1      2    2    1   1       1
20    68      1      2    2    1   1       2
21     9      1      2    2    1   2       1
22    46      1      2    2    1   2       2
23     3      1      2    2    1   3       1
24     6      1      2    2    1   3       2
25     7      1      2    2    2   1       1
26    24      1      2    2    2   1       2
27    20      1      2    2    2   2       1
28    58      1      2    2    2   2       2
29    18      1      2    2    2   3       1
30    26      1      2    2    2   3       2
31     7      1      2    2    3   1       1
32    20      1      2    2    3   1       2
33    12      1      2    2    3   2       1
34    39      1      2    2    3   2       2
35     7      1      2    2    3   3       1
36    11      1      2    2    3   3       2
37     4      2      1    3    1   1       1
38    25      2      1    3    1   1       2
39    11      2      1    3    1   2       1
40    18      2      1    3    1   2       2
41     1      2      1    3    1   3       1
42     5      2      1    3    1   3       2
43     6      2      1    3    2   1       1
44     4      2      1    3    2   1       2
45     3      2      1    3    2   2       1
46    10      2      1    3    2   2       2
47     3      2      1    3    2   3       1
   count inflam benign hist city age survive
48     1      2      1    3    2   3       2
49     3      2      1    3    3   1       1
50     8      2      1    3    3   1       2
51     3      2      1    3    3   2       1
52    10      2      1    3    3   2       2
53     3      2      1    3    3   3       1
54     4      2      1    3    3   3       2
55     3      2      2    4    1   1       1
56     9      2      2    4    1   1       2
57     2      2      2    4    1   2       1
58     5      2      2    4    1   2       2
59     0      2      2    4    1   3       1
60     1      2      2    4    1   3       2
61     0      2      2    4    2   1       1
62     0      2      2    4    2   1       2
63     2      2      2    4    2   2       1
64     3      2      2    4    2   2       2
65     0      2      2    4    2   3       1
66     1      2      2    4    2   3       2
67     0      2      2    4    3   1       1
68     1      2      2    4    3   1       2
69     0      2      2    4    3   2       1
70     4      2      2    4    3   2       2
71     0      2      2    4    3   3       1
72     1      2      2    4    3   3       2
>

Statistics 4P03/6P03