![]() | ![]() | ![]() |
A single test of whether any of the group proportions differs from the overall proportion is given by the CHISQ option in PROC FREQ when applied to a G×2 or 2×G table of your data (the two columns or rows being positive and negative response). Significant results indicate that at least one proportion differs from the overall proportion. Tests of each group versus overall can be done in PROC MULTTEST by using the CA test and a set of CONTRAST statements, or in PROC LOGISTIC. PROC MULTTEST additionally enables you to adjust the p-values for the fact that multiple testing is done. The tests from PROC LOGISTIC can be adjusted by importing them into PROC MULTTEST by using the PDATA= option. For a visual display of the unadjusted comparisons, use PROC ANOM in SAS/QC software. Each procedure is illustrated below.
The sample sizes and the number that respond positive in each of five groups are recorded in a SAS data set named P. The chi-square test from PROC FREQ indicates that some proportions might differ from the overall proportion (p=0.0537).
| response | n | group |
|---|---|---|
| 6 | 46 | 1 |
| 9 | 49 | 2 |
| 9 | 52 | 3 |
| 12 | 54 | 4 |
| 17 | 46 | 5 |
| Statistic | DF | Value | Prob |
|---|---|---|---|
| Chi-Square | 4 | 9.3167 | 0.0537 |
| Likelihood Ratio Chi-Square | 4 | 8.7694 | 0.0671 |
| Mantel-Haenszel Chi-Square | 1 | 7.1847 | 0.0074 |
| Phi Coefficient | 0.1942 | ||
| Contingency Coefficient | 0.1907 | ||
| Cramer's V | 0.1942 |
In PROC LOGISTIC, the default coding that is used for CLASS variables (effects coding) causes the parameter estimates to compare each group to the average. Because only k1 parameters can be estimated for k groups, the parameter for the last group is not estimated. A CONTRAST statement can be added to test the last group. As shown in the "Class Level Information" table, the last group is coded as 1 for each of the design variables. The following statements compare the five group proportions to the overall proportion. The CONTRAST statement tests the last group proportion. The results indicate that only the last group differs from overall.
proc logistic data=p;
class group;
model response/n = group;
contrast '5 vs overall' group -1 -1 -1 -1;
run;
| Class Level Information | |||||
|---|---|---|---|---|---|
| Class | Value | Design Variables | |||
| group | 1 | 1 | 0 | 0 | 0 |
| 2 | 0 | 1 | 0 | 0 | |
| 3 | 0 | 0 | 1 | 0 | |
| 4 | 0 | 0 | 0 | 1 | |
| 5 | -1 | -1 | -1 | -1 | |
| Analysis of Maximum Likelihood Estimates | ||||||
|---|---|---|---|---|---|---|
| Parameter | DF | Estimate | Standard Error |
Wald Chi-Square |
Pr > ChiSq | |
| Intercept | 1 | -1.3479 | 0.1628 | 68.5520 | <.0001 | |
| group | 1 | 1 | -0.5492 | 0.3762 | 2.1315 | 0.1443 |
| group | 2 | 1 | -0.1437 | 0.3289 | 0.1910 | 0.6621 |
| group | 3 | 1 | -0.2161 | 0.3273 | 0.4358 | 0.5092 |
| group | 4 | 1 | 0.0952 | 0.3013 | 0.0997 | 0.7522 |
| Contrast Test Results | |||
|---|---|---|---|
| Contrast | DF | Wald Chi-Square |
Pr > ChiSq |
| 5 vs overall | 1 | 8.0295 | 0.0046 |
In PROC MULTTEST, specify the CA test and a set of CONTRAST statements. The ith CONTRAST statement tests the hypothesis H0: pi = Σi pi/k , where pi is the positive response probability for the ith group and k is the number of groups. Note that this hypothesis can be written as (k1)pi Σjpj = 0, where j does not equal i. This suggests the coefficients to be used in the CONTRAST statements as shown below. You can use options in the PROC MULTTEST statement to adjust for the effect of multiple testing on the experimentwise error rate. For example, specify the BON option to use Bonferroni's method. Note that PROC MULTTEST cannot read data summarized as shown above, but by using the FREQ statement it can read data that is summarized so that there is one observation for each combination of group and response values. The following DATA step creates this form of summarized data. The results, both raw and adjusted for multiple testing, again indicate that only the last group differs from overall.
data p2;
set p;
r=1; count=response; output;
r=0; count=n-response; output;
run;
proc multtest data=p2 bon;
class group;
test ca(r);
freq count;
contrast "1 vs overall" 4 -1 -1 -1 -1;
contrast "2 vs overall" -1 4 -1 -1 -1;
contrast "3 vs overall" -1 -1 4 -1 -1;
contrast "4 vs overall" -1 -1 -1 4 -1;
contrast "5 vs overall" -1 -1 -1 -1 4;
run;
| p-Values | |||
|---|---|---|---|
| Variable | Contrast | Raw | Bonferroni |
| r | 1 vs overall | 0.1241 | 0.6204 |
| r | 2 vs overall | 0.5570 | 1.0000 |
| r | 3 vs overall | 0.4129 | 1.0000 |
| r | 4 vs overall | 0.8772 | 1.0000 |
| r | 5 vs overall | 0.0046 | 0.0231 |
Any of the p-value adjustment methods, including the resampling-based adjustments (bootstrap or permutation), can be used when the raw data is analyzed in PROC MULTTEST. The nonresampling methods can be used if you prefer to do the analysis in PROC LOGISTIC. To adjust the p-values from PROC LOGISTIC, specify an ODS OUTPUT statement to create data sets from the tables that contain the p-values. Then create a single data set of the p-values with a variable named RAW_P that contains all of the p-values. Use the PDATA= option in PROC MULTTEST to read the set of p-values and specify the appropriate option for your choice of nonresampling-based adjustment method. The BON option is used again in this example.
proc logistic data=p;
class group;
model response/n = group;
contrast '5 vs overall' group -1 -1 -1 -1;
ods output contrasttest=ctt parameterestimates=pe;
run;
data probs;
set pe ctt;
if variable='Intercept' then delete;
raw_p=probchisq;
keep raw_p;
run;
proc multtest pdata=probs bon;
run;
| p-Values | ||
|---|---|---|
| Test | Raw | Bonferroni |
| 1 | 0.1443 | 0.7215 |
| 2 | 0.6621 | 1.0000 |
| 3 | 0.5092 | 1.0000 |
| 4 | 0.7522 | 1.0000 |
| 5 | 0.0046 | 0.0230 |
PROC ANOM can be used to present a visual display of the comparisons. Use the PCHART statement for comparisons of proportions. If a group's bar extends beyond the upper or lower decision limit (UDL or LDL), then that group's proportion differs significantly from the overall proportion. By default, the significance level is 0.05. The chart visually confirms the conclusions from PROC LOGISTIC and PROC MULTTEST—only the last group differs from the overall proportion (0.21).
proc anom data=p;
pchart response*group / groupn=n;
run;
| Product Family | Product | System | SAS Release | |
| Reported | Fixed* | |||
| SAS System | SAS/STAT | All | n/a | |
| Type: | Usage Note |
| Priority: | low |
| Topic: | Analytics ==> Analysis of Means SAS Reference ==> Procedures ==> FREQ SAS Reference ==> Procedures ==> MULTTEST Analytics ==> Categorical Data Analysis Analytics ==> Descriptive Statistics |
| Date Modified: | 2006-05-10 11:19:08 |
| Date Created: | 2002-12-16 10:56:38 |



