For male and female children in rural and urban counties, the number of periods (of two) in which subjects report cold symptoms are recorded. So 45 subjects who are female and in rural counties report no cold symptoms, and 71 subjects who are female and from rural counties report colds in both periods.

The question of interest is whether the mean number of periods with colds reported is associated with gender or type of county. There is no reason to believe that the mean number of periods with colds is normally distributed, so a weighted least squares analysis of these data is performed with PROC CATMOD instead of an analysis of variance with PROC ANOVA or PROC GLM.

The input data for categorical data are often recorded in frequency form, with the counts for each particular profile being the input values. For the colds data, the input SAS data set colds is created with the following statements. The variable count contains the frequency of observations that have the particular profile described by the values of the other variables in that input line.

In order to fit a model to the mean number of periods with colds, you have to specify the response function in PROC CATMOD. The default response function is the logit if the response variable has two values, and it is generalized logits if the response variable has more than two values. If you want a different response function, then you specify that function in the RESPONSE statement. To request the mean number of periods with colds, you specify the MEANS option in the RESPONSE statement.

You can request a model consisting of the main effects and interaction of the variables sex and residence just as you would in the GLM procedure. Unlike the GLM procedure, PROC CATMOD does not require you to use a CLASS statement to treat a variable as a classification variable. In the CATMOD procedure, all variables in the MODEL statement are treated as classification variables unless you specify otherwise with a DIRECT statement. To verify that your model is specified correctly, you can specify the DESIGN option in the MODEL statement to display the design matrix.

The PROC CATMOD statements needed to model mean periods of colds with a main-effects and interaction model are as follows:

In Figure 28.1, the CATMOD procedure first displays a summary of the contingency table you are analyzing. The "Population Profiles" table lists the values of the explanatory variables that define each population, or row of the underlying contingency table, and labels each group with a sample number. The number of observations in each population is also displayed. The "Response Profiles" table lists the variable levels that define the response, or columns of the underlying contingency table.

Figure 28.1
Model Information and Profile Tables

The CATMOD Procedure

Data Summary

Response

periods

Response Levels

3

Weight Variable

count

Populations

4

Data Set

COLDS

Total Frequency

1080

Frequency Missing

0

Observations

12

Population Profiles

Sample

sex

residence

Sample Size

1

female

rural

180

2

female

urban

300

3

male

rural

290

4

male

urban

310

Response Profiles

Response

periods

1

0

2

1

3

2

The "Response Functions and Design Matrix" table in Figure 28.2 contains the observed response functions—in this case, the mean number of periods with colds for each of the populations—and the design matrix. The first column of the design matrix contains the coefficients for the intercept parameter. The second column contains the coefficients for the sex parameter. (Note that the sum-to-zero constraint of the default full-rank parameterization PARAM=EFFECT implies that the coefficient for males is the negative of that for females; the parameter is called the differential effect for females.) The third column is similarly set up for residence, and the last column is for the interaction.

Figure 28.2
Observed Response Functions and Design Matrix

Response Functions and Design Matrix

Sample

ResponseFunction

Design Matrix

1

2

3

4

1

1.14444

1

1

1

1

2

1.12000

1

1

-1

-1

3

0.99310

1

-1

1

-1

4

0.93871

1

-1

-1

1

The model-fitting results are displayed in the "Analysis of Variance" table (Figure 28.3), which is similar to an ANOVA table. The effects from the right side of the MODEL statement are listed in the Source column.

Figure 28.3
ANOVA Table for the Saturated Model

Analysis of Variance

Source

DF

Chi-Square

Pr > ChiSq

Intercept

1

1841.13

<.0001

sex

1

11.57

0.0007

residence

1

0.65

0.4202

sex*residence

1

0.09

0.7594

Residual

0

.

.

You can see in Figure 28.3 that the interaction effect is nonsignificant, so the data are reanalyzed using a main-effects model. Since PROC CATMOD is an interactive procedure, you can analyze the main-effects model by simply submitting the new MODEL statement as follows. The resulting tables are displayed in Figure 28.4 and Figure 28.5.

model periods = sex residence / design;
run;

From the ANOVA table in Figure 28.4, you can see that the goodness-of-fit chi-square statistic is 0.09 with one degree of freedom and a p-value of 0.7594; hence, the model fits the data. Note that the chi-square tests in Figure 28.4 check whether all the parameters for a given effect are zero. In this model, each effect has only one parameter and therefore only one degree of freedom.

Figure 28.4
Main-Effects Model

The CATMOD Procedure

Data Summary

Response

periods

Response Levels

3

Weight Variable

count

Populations

4

Data Set

COLDS

Total Frequency

1080

Frequency Missing

0

Observations

12

Population Profiles

Sample

sex

residence

Sample Size

1

female

rural

180

2

female

urban

300

3

male

rural

290

4

male

urban

310

Response Profiles

Response

periods

1

0

2

1

3

2

Response Functions and Design Matrix

Sample

ResponseFunction

Design Matrix

1

2

3

1

1.14444

1

1

1

2

1.12000

1

1

-1

3

0.99310

1

-1

1

4

0.93871

1

-1

-1

Analysis of Variance

Source

DF

Chi-Square

Pr > ChiSq

Intercept

1

1882.77

<.0001

sex

1

12.08

0.0005

residence

1

0.76

0.3839

Residual

1

0.09

0.7594

The "Analysis of Weighted Least Squares Estimates" table in Figure 28.5 lists the parameters and their estimates for the model, as well as the standard errors, Wald statistics, and p-values. These chi-square tests are one-degree-of-freedom tests that the individual parameter is equal to zero. They are equal to the tests shown in Figure 28.4 since each effect is composed of exactly one parameter.

Figure 28.5
Parameter Estimates for the Main-Effects Model

Analysis of Weighted Least Squares Estimates

Parameter

Estimate

StandardError

Chi-Square

Pr > ChiSq

Intercept

1.0501

0.0242

1882.77

<.0001

sex

female

0.0842

0.0242

12.08

0.0005

residence

rural

0.0210

0.0241

0.76

0.3839

You can compute the mean number of periods with colds for the first population (Sample 1, females in rural residences) from Table 28.2 as follows:

This is the same value reported in the Response Function column for Sample 1 in the "Response Functions and Design Matrix" table displayed in Figure 28.4.

PROC CATMOD is fitting a model to the mean number of colds in each population as follows:

where the design matrix is the same one displayed in Figure 28.4, is the mean number of colds averaged over all the populations, is the differential effect for females, and is the differential effect for rural residences. The parameter estimates are shown in Figure 28.5; the expected number of periods with colds for rural females from this model is computed as

and the expected number for rural males from this model is

Notice also, in Figure 28.5, that the differential effect for residence is nonsignificant (). If you continue the analysis by fitting a single-effect model (sex), you need to include a POPULATION statement to maintain the same underlying contingency table: