help tostmcc -------------------------------------------------------------------------------------------------------------------------------------- Title tostmcc -- Paired z test for equivalence of marginal probabilities in binary data Syntax mcc var_exposed_case var_exposed_control [if] [in] [weight] [, eqvtype(type) eqvlevel(#) uppereqvlevel(#) yates edwards alpha(#) relevance] mcci #a #b #c #d [, eqvtype(type) eqvlevel(#) uppereqvlevel(#) yates edwards alpha(#) relevance] tostmcc options Description -------------------------------------------------------------------------------------------------------------------------------- Main eqvtype(string) specify equivalence threshold with Delta or epsilon eqvlevel(#) the level of tolerance defining the equivalence interval uppereqvlevel(#) the upper value of an asymmetric equivalence interval yates include a ya:tes continuity correction edwards include an ed:wards continuity correction alpha(#) set nominal type I level; default is alpha(0.05) relevance perform & report combined tests for difference and equivalence -------------------------------------------------------------------------------------------------------------------------------- fweights are allowed; see weight. Description tostmcc tests for equivalence of the marginal probabilities of exposure in matched case-control data. It calculates a Wald-type asymptotic z test (Liu, et al., 2002) in a two one-sided tests approach (Schuirmann, 1987). tostmcci is the immediate form of tostmcc; see immed. Typically the null hypotheses of the corresponding McNemar's chi-square test (McNemar, 1947) for difference in marginal probabilities are framed from an assumption of equality of marginal probability of exposure between cases and controls (e.g. Ho: P(exposure|case) = P(exposure|controls), rejecting this assumption only with sufficient evidence. When performing tests for equivalence of marginal probabilities, the null hypothesis is framed as the difference in marginal probabilities is at least as much as the equivalence interval as defined by some chosen level of tolerance (as specified by eqvtype and eqvlevel). With respect to a z test, a negativist null hypothesis takes one of the following two forms depending on whether tolerance is defined in terms of Delta (equivalence expressed in the units of the probability of counts of discordant pairs) or in terms of epsilon (equivalence expressed in the units of the z distribution): Ho: |b - c| >= Delta, where the equivalence interval ranges from |b - c|-Delta to |b - c|+Delta, and where b is the count of pairs with cases exposed, but controls unexposed, and and c is the count of pairs with cases unexposed and controls exposed. This null hypothesis translates directly into two one-sided null hypotheses: Ho1: Delta - (b - c) <= 0; and Ho2: (b - c) + Delta <= 0 -OR- Ho: |z| >= epsilon, where the equivalence interval ranges from -epsilon to epsilon. This also translates directly into two one-sided null hypotheses: Ho1: epsilon - Z <= 0; and Ho2: Z + epsilon <= 0 When an asymmetric equivalence interval is defined using the uppereqvlevel option the general negativist null hypothesis becomes: Ho: (b - c) <= Delta_lower, or (b - c) >= Delta_upper, where the equivalence interval ranges from (b - c) + Delta_lower to (b - c) + Delta_upper. This also translates directly into two one-sided null hypotheses: Ho1: Delta_upper - (b - c) <= 0; and Ho2: (b - c) - Delta_lower <= 0 -OR- Ho: Z <= epsilon_lower, or Z >= epsilon_upper, Ho1: epsilon_upper - Z <= 0; and Ho2: Z - epsilon_lower <= 0 NOTE: the appropriate level of alpha is precisely the same as in the corresponding McNemar's test for difference of maginal probabilities, so that, for example, if one wishes to make a type I error %5 of the time, one simply conducts both of the one-sided tests of Ho1 and Ho2 by comparing the resulting p-value to 0.05 (Wellek, 2010). Options for mcc and mcci +------+ ----+ Main +-------------------------------------------------------------------------------------------------------------------- eqvtype(string) defines whether the equivalence interval will be defined in terms of Delta or epsilon (delta, or epsilon). These options change the way that evqlevel is interpreted: when delta is specified, the evqlevel is measured in the units of the variable being tested, and when epsilon is specified, the evqlevel is measured in multiples of the standard deviation of the Z distribution; put another way epsilon = Delta/standard error. The default is delta. Defining tolerance in terms of epsilon means that it is not possible to reject any test of mean equivalence Ho if epsilon <= the critical value of z for a given alpha. Because epsilon = n*Delta/standard error, we can see that it is not possible to reject any Ho if Delta <= the product of the standard error and critical value of z over n for a given alpha. tostmcc reports when either of these conditions obtain. Tolerances should be specified using delta by considering the difference in P(b) and P(c). eqvlevel(#) defines the equivalence threshold for the tests depending on whether eqvtype is delta or epsilon (see above). Researchers are responsible for choosing meaningful values of Delta or epsilon. The default value is .1 when delta is the eqvtype and 2 when epsilon is the eqvtype. uppereqvlevel(#) defines the upper equivalence threshold for the test, and transforms the meaning of eqvlevel to mean the lower equivalence threshold for the test. Also, eqvlevel is assumed to be a negative value. Taken together, these correspond to Schuirmann's (1987) asymmetric equivalence intervals. If uppereqvlevel==|eqvlevel|, then uppereqvlevel will be ignored. yates specifies that the test statistics incorporate a ya:tes continuity correction (help tostmcc##ya:tes1934:ya:tes, 1934) using the term [(b - c)-0.5] for z1, and the term [(b - c)+0.5] for z2. yates is exclusive of edwards edwards specifies that the test statistics incorporate an ed:wards continuity correction (wards1947:ed:wards, 1947) using the term [(b - c)-1] for z1, and the term [(b - c)+1] for z2. edwards is exclusive of yates alpha(#) specifies the nominal type I error rate. The default is alpha(0.05). relevance reports results and inference for combined tests for difference and equivalence of marginal probabilities (of exposure) for a specific alpha, eqvtype, and eqvlevel. See the end of the Discussion section in tost for more details on inference from combined tests. Examples Setup . webuse mccxmpl Relevance test in paired binary data . tostmcc case control [fw=pop], eqvt(delta) eqvlevel(.2) rel Same as above command, but using immediate form . tostmcci 8 8 3 8, eqvt(delta) eqvlevel(.2) rel With asymetric equivalence intervals specified with epsilon . tostmcci 8 8 3 8, eqvt(epsilon) eqvlevel(2) upper(3) rel Saved results tostmcc and tostmcci save the following in r(): Scalars r(z1) z test statistic for Ho1 (upper) r(z2) z test statistic for Ho2 (lower) r(p1) P(Z >= z1) r(p2) P(Z >= z2) r(D_f) difference in proportion with exposure r(Delta) Delta, tolerance level defining the equivalence interval; OR r(Du) Delta_upper, tolerance level defining the equivalence interval's upper side; AND r(Dl) Delta_lower, tolerance level defining the equivalence interval's lower side; OR r(epsilon) epsilon, tolerance level defining the equivalence interval r(eu) epsilon_upper, tolerance level defining the equivalence interval's upper side; AND r(el) epsilon_lower, tolerance level defining the equivalence interval's lower side r(relevance) Relevance test conclusion for given alpha and Delta/epsilon Author Alexis Dinno Portland State University alexis.dinno@pdx.edu Development of tost is ongoing, please contact me with any questions, bug reports or suggestions for improvement. Fixing bugs will be facilitated by sending along (1) a copy of the data (de-labeled or anonymized is fine), (2) a copy of the command used and (3) a copy of the exact output of the command. Suggested citation Dinno A. 2017. tostmcc: Paired z test for equivalence in binary data. Stata software package. URL: https://www.alexisdinno.com/stata/tost.html Reference Edwards, A. 1948. Note on the "correction for continuity" in testing the significance of the difference between correlated proportions. Psychometrika 13: 185–187 Liu, J., et al., 2002. Tests for equivalence or non-inferiority for paired binary data. Statistics In Medicine 21: 231–245. McNemar, Q. 1947. Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika 12: 153–157 Schuirmann, D. A. 1987. A comparison of the two one-sided tests procedure and the power approach for assessing the equivalence of average bioavailability. Pharmacometrics 15: 657-680 Yates, F. 1934. Contingency tables involving small numbers and the Chi-squared test. Supplement to the Journal of the Royal Statistical Society. 1: 217-235 Wellek, S. 2010. Testing Statistical Hypotheses of Equivalence and Noninferiority, second edition. Chapman and Hall/CRC Press. p. 31 Also See Help: tost, pkequiv, mcc