powerrxc | Power analysis for Chi-sqare tests of independence | powerrxc |

York University

The `powerrxc` macro was written by SAS Institute.
It requires Version 6.10 or later of SAS.

power = 1 - probchi(cinv(1-alpha,df), df, noncent);

The arguments may be listed within parentheses in any order, separated by commas. For example:

%powerrxc(data=inputdataset, row=age, col=improved, ..., )

- DATA=_LAST_
- Specifies the SAS data set to be analyzed. If the DATA= option is not supplied, the most recently created SAS data set is used.
- ROW=
- REQUIRED. Specifies the variable defining the rows of the table.
- COL=
- REQUIRED. Specifies the variable defining the columns of the table.
- COUNT=
- Specifies a variable containing the cell counts of the table. Omit this option if each observation in the DATA= data set represents only a single entry in the table. This variable, if specified, is used on the WEIGHT statement in PROC FREQ.
- LEVEL=
- Specifies the significance level of the test.
- ALPHA=
- NRANGE= Specifies the sample size or list of sample sizes for
which approximate power is to be computed. If
omitted, the actual sample size is used. You may
specify a list of values separated by commas, a range
of the form x TO y BY z, or a combination of these.
However, you must surround the NRANGE= value with
%STR() if any commas appear in it. For example,
nrange=20 to 200 by 20 nrange=%str(20,50,100,140) nrange=%str(10, 20, 50 to 100 by 10)

- FREQOPT= Specifies options for PROC FREQ. Default=NOROW NOCOL NOPERCENT.
- OUT= Specifies the name of the output dataset.

Approximate Power of Chi-square Tests for Independence Test Level=.05 Power of Power Pearson of L.R. N Chi-square Chi-square 20 0.06570 0.06735 30 0.07393 0.07650 40 0.08241 0.08592 50 0.09111 0.09562 60 0.10003 0.10558 70 0.10916 0.11577 80 0.11847 0.12619 90 0.12797 0.13681 100 0.13763 0.14762

%include macros(powerrxc); *-- or include in an autocall library; data a; do row=1 to 2; do col=0,1; input freq @@; output; end; end; cards; 3 11 6 2 ; %powerRxC(row=row, col=col, count=freq)Example from Agresti (1990) pp 241-243. Column 1 probabilities for each row are hypothesized to be .63 and .57. Row sample sizes are to be equal, so the marginal row probabilities are both 0.5. The cell probabilities (e.g., .315 = .63 * .5) are entered as the value of the COUNT= variable.

data c; do row=1 to 2; do col=0,1; input freq @@; output; end; end; cards; .315 .185 .285 .215 ; %powerRxC(data=c, row=row, col=col, count=freq, nrange=%str(20,50 to 200 by 50))

fpower Power computations for ANOVA designs

mpower Retrospective power analysis for multivariate GLMs

power Power calculations for general linear models