In this example, PROC FREQ computes binomial proportions, confidence limits, and tests. The example uses the eye and hair color data from Example 40.1. By default, PROC FREQ computes the binomial proportion as the proportion of observations in the first level of the one-way table. You can designate a different level by using the LEVEL= binomial-option.
The following PROC FREQ statements compute the proportion of children with brown eyes (from the data set in Example 40.1) and test the null hypothesis that the population proportion equals 50%. These statements also compute an equivalence test for the proportion of children with fair hair.
The first TABLES statement requests a one-way frequency table for the variable Eyes
. The BINOMIAL option requests the binomial proportion, confidence limits, and test. PROC FREQ computes the proportion with
Eyes
= 'brown', which is the first level displayed in the table. The AC, WILSON, and EXACT binomial-options request the following confidence limits types: Agresti-Coull, Wilson (score), and exact (Clopper-Pearson). By default, PROC
FREQ provides Wald and exact (Clopper-Pearson) confidence limits for the binomial proportion. The BINOMIAL option also produces
an asymptotic Wald test that the proportion is 0.5. You can specify a different test proportion in the P= binomial-option. The ALPHA=0.1 option specifies that %, which produces 90% confidence limits.
The second TABLES statement requests a one-way frequency table for the variable Hair
. The BINOMIAL option requests the proportion for the first level, Hair
= 'fair'. The EQUIV binomial-option requests an equivalence test for the binomial proportion. The P=.28 option specifies 0.28 as the null hypothesis proportion,
and the MARGIN=.1 option specifies 0.1 as the equivalence test margin.
proc freq data=Color order=freq; tables Eyes / binomial(ac wilson exact) alpha=.1; tables Hair / binomial(equiv p=.28 margin=.1); weight Count; title 'Hair and Eye Color of European Children'; run;
Output 40.4.1 displays the results for eye color, and Output 40.4.2 displays the results for hair color.
Output 40.4.1: Binomial Proportion for Eye Color
The frequency table in Output 40.4.1 displays the values of Eyes
in order of descending frequency count. PROC FREQ computes the proportion of children in the first level displayed in the
frequency table, Eyes
= 'brown'. Output 40.4.1 displays the binomial proportion confidence limits and test. The confidence limits are 90% confidence limits. If you do not
specify the ALPHA= option, PROC FREQ computes 95% confidence limits by default. Because the value of Z is less than 0, PROC FREQ displays the a left-sided p-value (0.0019). This small p-value supports the alternative hypothesis that the true value of the proportion of children with brown eyes is less than
50%.
Output 40.4.2 displays the equivalence test results produced by the second TABLES statement. The null hypothesis proportion is 0.28 and the equivalence margins are –0.1 and 0.1, which yield equivalence limits of 0.18 and 0.38. PROC FREQ provides two one-sided tests (TOST) for equivalence. The small p-value indicates rejection of the null hypothesis in favor of the alternative that the proportion is equivalent to the null value.
Output 40.4.2: Binomial Proportion for Hair Color