Dataplot Vol 2 Vol 1

# BINOMIAL RATIO CONFIDENCE LIMITS

Name:
BINOMIAL RATIO CONFIDENCE LIMITS (LET)
Type:
Let Subcommand
Purpose:
Compute the confidence limits for the ratio of two binomial proportions.
Description:
Given two binomial proportions, p1 and p2, with associated sample sizes, n1 and n2, the formula for the confidence interval for the ratio p1/p2 is

with -1 denoting the normal percent point function.

If p1 and p2 are both 1, the resulting uncertainty is zero. If either p1 or p2 is zero, we have division by zero in the above formula. For that reason, we use the Bayes estimators of p1 and p2:

with V and U denoting the number of successes in the binomial trials. We then use these updated estimates for p1 and p2 in the above formula.

Syntax:
LET <ratio> <lowlim> <upplim> = BINOMIAL RATIO CONFIDENCE LIMITS
<p1> <n1> <p2> <n2> <alpha>
<SUBSET/EXCEPT/FOR qualification>
where <p1> is constant, parameter, or variable that contains the proportion of successes for the first sample;
<n1> is constant, parameter, or variable that contains the number of trials for the first sample;
<p2> is constant, parameter, or variable that contains the proportion of successes for the second sample;
<n2> is constant, parameter, or variable that contains the number of trials for the second sample;
<alpha> is constant or parameter that contains the significance level;
<ratio> is a variable that contains the computed ratio (p1/p2);
<lowlim> is a variable that contains the computed lower confidence limit;
<upplim> is a variable that contains the computed upper confidence limit;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.

The <p1>, <n1>, <p2>, and <n2> arguments can be either parameters or variables. If they are variables, then the variables must have the same number of elements. The <alpha> argument is always assumed to be either a constant or a parameter.

If <p1> <n1> <p2> and <n2> are all parameters, then <ratio> <lowlim> and <upplim> will be parameters. Otherwise, they will be variables.

Examples:
LET RATIO AL AU = BINOMIAL RATIO CONFIDENCE LIMITS ...
P1 N1 P2 N2 ALPHA
Note:
If you would like to use this command on raw data (i.e., you have variables containing a sequence of 0's and 1's), do something like the following

LET YSUM1 = SUM Y1
LET N1 = SIZE Y1
LET P1 = YSUM1/N1
LET YSUM2 = SUM Y2
LET N2 = SIZE Y2
LET P2 = YSUM2/N2
LET RATIO AL AU = BINOMIAL RATIO CONFIDENCE LIMITS ...
P1 N1 P2 N2 ALPHA

If you have group-id variables (X1 and X2), you would do something like

SET LET CROSS TABULATE COLLAPSE
LET YSUM1 = CROSS TABULATE SUM Y1 X1
LET N1 = CROSS TABULATE SIZE Y1 X1
LET P1 = YSUM1/N1
LET YSUM2 = CROSS TABULATE SUM Y2 X2
LET N2 = CROSS TABULATE SIZE Y2 X2
LET P2 = YSUM2/N2
LET RATIO AL AU = BINOMIAL RATIO CONFIDENCE LIMITS ...
P1 N1 P2 N2 ALPHA

In this case, P1, N1, P2, and N2 are now variables rather than parameters.

Default:
None
Synonyms:
None
Related Commands:
 BINOMIAL PRODUCT CONF LIMITS = Compute confidence limits for the product of two binomial proportions. AGRESTI-COULL CONFIDENCE LIMITS = Compute Agresti-Coull confidence limits for binomial proportions. EXACT BINOMIAL CONFIDENCE LIMITS = Compute exact binomial confidence limits for binomial proportions. AGRESTI-COULL = Compute Agresti-Coull confidence limits statistic for binomial proportions. EXACT BINOMIAL = Compute the "exact" confidence limits statistic for binomial proportions. BINOMIAL PROPORTION = Compute the binomial proportion statistic. BINOMIAL PROPORTION TEST = Perform a binomial proportions test. CROSS TABULATE = Perform a cross-tabulation for a specified statistic.
Reference:
Private communication with Andrew Ruhkin and Bill Strawderman.
Applications:
Statistics
Implementation Date:
2009/10
Program:

LET P1 = 8/12
LET N1 = 12
LET P2 = 7/8
LET N2 = 8
LET ALPHA = 0.05
.
LET ARATIO LOWLIM UPPLIM = BINOMIAL RATIO CONFIDENCE LIMIT ...
P1 N1 P2 N2 ALPHA

The values of ARATIO, LOWLIM, and UPPLIM are 0.7846, 0.4687, and 1.3135, respectively.

Date created: 10/5/2010
Last updated: 10/5/2010