help rdciandhelp rdciiVersion 1.2 2010-09-30-------------------------------------------------------------------------------

Title

rdci-- Improved asymptotic confidence interval for the difference between two independent proportionsrdcii

Syntax

rdcivar_case var_exposed[if] [in] [weight] [,options]

rdcii#a #b #c #d[,options]

optionsDescription ------------------------------------------------------------------------- Mainlevel(#)set confidence level; default is prevailing setting (see creturn)zsotallow t-over-two to vary asz²-over-two (Agresti-Caffo confidence interval)ccapply continuity correction (Wallenstein confidence interval)nobruteforceturn off brute-force bracketing for root finding (Miettinen-Nurminen confidence interval)tolerance(#)relative tolerance for root-finding convergence (Miettinen-Nurminen confidence interval)ltolerance(#)absolute tolerance for root-finding convergence (Miettinen-Nurminen confidence interval)verbosedisplays iteration log for root-finding (Miettinen and Nurminen confidence interval)initial(numlist)initial values for root-finding (Miettinen-Nurminen confidence interval) -------------------------------------------------------------------------bymay be used withrdci; seeby.fweights are allowed withrdci; see weight.

Description

rdcicalculates confidence intervals for the difference between two independent proportions by four methods that are considered to be improvements over the conventional Wald method.rdciiis the immediate form of the command.

Options+------+ ----+ Main +-------------------------------------------------------------

levelset confidence level; it must lie between 0.1 and 99.9%, inclusive; default is the Stata level setting.

zsotaddsz²-over-two successes and failures instead of a fixed value of two each for the Agresti-Caffo method

ccapplies Yates's continuity correction in Wallenstein's method; this mimics a so-called exact confidence interval

nobruteforceforgoes brute-force incrementing through parameter space to set brackets on occasions when initial brackets fail to yield roots with Ridders's method

tolerancesets the relative error tolerance for root finding for Ridders's method; default is 1e-6.

ltolerancesets the absolute error tolerance for Ridders's method; not invoked by default.

verbosedisplays iteration history for root finding; helpful in diagnosis of problematic cases.

initialallows manually setting brackets for root finding.

Remarks

rdcicalculates confidence intervals for differences between two independent proportions by four methods: Miettinen-Nurminen, Agresti-Caffo, Newcombe Method 10 (so-called score method or hybrid score method), and Wallenstein. These risk difference confidence intervals are considered to have better statistical properties (i.e., are stabler, more accurate–have better "coverage") than the conventional Wald confidence interval, especially for small- to moderate-sized samples.As with

cs(see epitab), nonzero nonmissing values in thecasesvariable forrdciare cases, and nonzero nonmissing values in theexposurevariable indicate exposure. The sequence of#a,#b,#cand#dinrdciiis identical to that for the analogouscsi(see epitab), as well.The command calls

ridderduring the estimation of Miettinen-Nurminen confidence interval.ridderis a user-written command that will need to be installed forrdcito estimate Miettinen-Nurminen confidence intervals. Because the command callsridder, any global macroS_1that the user has defined will be overwritten.As with any root-finding algorithm, on occasion,

riddercan fail. The affected Miettinen-Nurminen confidence limit will be set to missing when this occurs. Theverboseoption will allow the user to see the iteration log ofridderand diagnose whether a missing confidence limit results from failure of convergence or of bracketing. Adjusting the tolerance (tolerance,ltoleranceor both) if the former and manually setting the bracketsinitial(numlist)if the latter often allows for successful root finding in such cases. One or two numbers are allowed ininitial(numlist). If one number is entered, the root-finding interval will be (-1,#] in the search for the lower confidence limit and [#, +1) for the upper confidence limit. If two numbers are entered, then the second number will form this latter lower bracket in the search for the upper confidence limit.If root finding fails during a first attempt,

rdcidetects this and implements an exhuastive scan of the parameter space on the affected side of the point estimate. This may be turned off with thenobruteforceoption should the the user wish to do so, for example, when setting the bracket points manually or to limit output when the user invokes theverboseoption. The exhaustive scan, however, ought to reduce the need for user intervention.Note that the tolerance settings are for the difference between the objective function's result and the target chi-square statistic for the confidence level; it is not the tolerance for the values of the confidence limits. (Run the ancillary do-file for examples illustrating the meaning of this, and for suggested settings of

ltoleranceto assure reasonably good tolerance for the confidence limits.)When the expectation of successes or failures is fewer than two in either exposure group, Wallenstein's method might lead to a confidence limit that implies that an individual proportion lies outside of the parameter space for proportions.

rdcitests for this and applies adjustments recommended by Wallenstein. The Wallenstein method performs relatively poorly in general when the observed successes (failures) in both exposure groups are zero, especially when the two sample sizes are the same. (Run the ancillary do-file to see examples of this behavior.)When the so-called t-over-two parameter is fixed at two (the default, as suggested by Agresti and Caffo), the Agresti-Caffo method might not be accurate with very small sample sizes when the

levelis set at unusually very low levels (<10%). There will not be a problem when more conventional values forlevelare used (>80%). Allowing the t-over-two parameter to vary with level (which is done by invoking thezsotoption) might also aid accuracy.The subroutine for the Wallenstein method is recursive, as is the main program (calling itself indirectly via

ridder), but the recursion depth is only one, and so there is scant chance of exhausting memory.

Examples

. rdcii 7 12 9 2, level(90)

. rdci case exp [freq=pop]

ReferencesA. Agresti and B. Caffo, Simple and effective confidence intervals for proportions and differences of proportions result from adding two successes and two failures.

The American Statistician54:280-88, 2000.O. Miettinen and M. Nurminen, Comparative analysis of two rates.

Statistics in Medicine4:213-26, 1985.R. G. Newcombe, Interval estimation for the difference between independent proportions: comparison of eleven methods.

Statistics inMedicine17:873-90, 1998.S. Wallenstein, A non-iterative accurate asymptotic confidence interval for the difference between two proportions.

Statistics in Medicine16:1329-36, 1997.

AcknowledgementsCode for calculating Wilson intervals of the individual proportions (used in calculation of Newcombe's Method 10 confidence intervals) is adapted from

ciwiby Nicholas J. Cox.

AuthorJoseph Coveney jcoveney@bigplanet.com

Also seeManual:

[ST] epitab