Functions & Formulae

Each applied formula has its own function page, with a signature, implementations, and tests.

Reading and reusing reported confidence intervals

ci_read(z, SE_1, SE_2, theta_hat, P) = (P_cap, P_ov, C_adj, SE_P, L_P, U_P)

Takes the standard errors behind two reported intervals, or a reported estimate with its two-sided P value, and the critical value of the level in use, and returns three things a reader needs when working from published results. These are the chance that one study's interval holds another study's estimate, the false positive rate of judging a difference by whether two intervals overlap with the interval level that would restore a chosen test level, and a standard error and interval for a result reported with a P value alone. Building an interval is already live and is not repeated here. HE-FM-AN-001 gives the Wald interval from an estimate and its standard error, HE-FM-BINOM-005 the Wald interval for a proportion, HE-FM-HR-006 the log-scale interval for a hazard ratio, HE-FM-HR-007 the standard error recovered from a reported interval for a log hazard ratio, HE-FM-AN-002 and HE-FM-AN-003 the delta-method and Fieller intervals for an ICER, and HE-FM-AN-004 the interval for incremental net benefit, whose variance across paired bootstrap replicates is HE-FM-BSE-003. The z statistic for a difference between two independent estimates has the form of the third part of HE-FM-NMA-003. Notation follows the Confidence Interval article.

  • Chance that a first study's interval holds a second study's estimate

    z_cap = z * SE_1 / sqrt(SE_1^2 + SE_2^2); P_cap = 2 * Phi_cap - 1

    An interval covers the true value at its stated rate, but the chance that it holds the estimate from another study is lower, because the two estimates differ by the sampling error of both. The difference between two independent unbiased estimates has standard deviation sqrt(SE_1^2 + SE_2^2), and the first interval holds the second estimate when that difference is smaller than z SE_1, so z_cap is the half-width of the first interval in units of that standard deviation and P_cap is the two-sided normal probability. Greenland and colleagues give the result for equal standard errors, 83% at the 95% level, and the form for unequal standard errors is derived from the same reasoning. The site's calculator has no normal distribution function, so Phi_cap, its value at z_cap, is entered as a number. The first part has the form of a standardised distance as in HE-FM-MCID-004, whose domain is patient-level change scores, one-tailed; here the quantity is a sampling distribution of two estimates and the probability is two-sided.

  • False positive rate of the no-overlap rule and the interval level that restores a test level

    r_ov = (SE_1 + SE_2) / sqrt(SE_1^2 + SE_2^2); z_ov = z * r_ov; P_ov = 2 * (1 - Phi_ov); z_adj = z / r_ov; C_adj = 2 * Phi_adj - 1

    Two intervals fail to overlap only when the difference between the estimates exceeds z (SE_1 + SE_2), while a test of the difference uses z sqrt(SE_1^2 + SE_2^2), the form of the third part of HE-FM-NMA-003 solved for the difference, so the rule demands more than the test by the factor r_ov. Under no true difference, P_ov is the chance that two intervals fail to overlap, 0.0056 for equal standard errors at the 95% level, well below the 0.05 often assumed. Dividing z by r_ov gives the critical value whose intervals fail to overlap at the rate of a test at the level of z, and C_adj is their confidence level, about 83.4% for equal standard errors. Knol and colleagues print the 0.0056 and the 83.4%, and Payton and colleagues print the general rate, with k the ratio of standard errors so that r_ov equals (1 + k) / sqrt(1 + k^2) (derived), and solve it for the interval level; z_adj is that solution in closed form (derived, and it reproduces their Table 3). The site's calculator has no normal distribution function, so Phi_ov and Phi_adj, its values at z_ov and z_adj, are entered as numbers.

  • Standard error and interval from an estimate and a two-sided P value

    z_P = -0.862 + sqrt(0.743 - 2.404 * log(P)); SE_P = abs(theta_hat) / z_P; L_P = theta_hat - z * SE_P; U_P = theta_hat + z * SE_P

    Some reports give an estimate and a P value but no interval or standard error, so a model cannot take a precision from them directly. Altman and Bland give a closed approximation for the normal test statistic z_P from a two-sided P value, then the standard error as the size of the estimate divided by z_P, ignoring its sign. The standard error takes the form of z_INB in HE-FM-AN-004 solved for its denominator, here for any estimate and fed from a reported P value, and the two limits are HE-FM-AN-001 applied to the result. For a ratio measure theta_hat is the natural log of the ratio and the limits are exponentiated, the form of HE-FM-HR-006. Cochrane reaches almost the same standard error through the exact normal value, =ABS(NORM.S.INV(P/2)) in Excel, and the approximation differs from it by at most 0.032 in z_P for P in the range 0.0001 to 0.9999 (derived on a grid).

This set of formulae is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).

Author: Dr Darrin Baines · Publisher: Intelligent Parameters Ltd · Identifier: https://healtheconomics.wiki/concept/confidence-interval/formulae