help tostrrp
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Title

    tostrrp -- Test for equivalence of relative risk and unity in paired binary data


Syntax


        tostrrp treatment_1_outcome_variable treatment_2_outcome_variable [if] [in] , delta0(#) [, deltaupper(#) alpha(#) exactchisq treatment1(treatment 1 name) treatment2(treatment 2 name) outcome(positive
              outcome label) nooutcome(negative outcome label) relevance]

        tostrrpi #a #b #c #n #delta0 [, deltaupper(#) alpha(#) exactchisq treatment1(treatment 1 name) treatment2(treatment 2 name) outcome(positive outcome label) nooutcome(negative outcome label) relevance]


    tostrrp options        Description
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Main
      delta0(#)            the value defining an equivalence interval (the lower value, if deltaupper is used)
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    tostrrp and tostrrpi options Description
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Main
      deltaupper(#)        the upper value of a geometrically asymmetric equivalence interval
      alpha(#)             set nominal type I level; default is alpha(0.05)
      exactchisq           use the exact chi-square p-value
      treatment1(string)   The name of the first treatment group
      treatment2(string)   The name of the second treatment group
      outcome(string)      The label for having a positive outcome
      nooutcome(string)    The label for having a negative outcome
      relevance            perform & report combined tests for difference and equivalence
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Description

    tostrrp test for equivalence of the relative risk of a positive outcome and unity in paired (or matched) randomized control trial or paired (or matched) cohort design data.  It calculates an asymptotic z
    test statistic based on a reparameterized multinomial model (Tang, et al., 2003) in a two one-sided tests approach (Schuirmann, 1987).  tostrrpi is the immediate form of tostrrp; see immed.  The
    equivalence interval for the test is defined by a chosen level of tolerance, as specified by delta0, or by #delta0 in the immediate form of the command.

    The two one-sided null hypotheses take on the following form based on the relative risk (RR), and the threshold delta0:

            Ho1: RR <= delta0, or

            Ho2: RR >= 1/delta0,

        where the equivalence interval ranges from delta0 to 1/delta0.

    When a geometrically asymmetric equivalence interval is defined using the deltaupper option the two one-sided null hypotheses become:

 
            Ho1: RR <= delta0, or

            Ho2: RR >= deltaupper,

        where the equivalence interval ranges from delta0 to deltaupper.
 
    The two z test statistics, z1 and z2, are both constructed with rejection probabilities in the upper tails. So p1 = P(Z >= z1), and p2 = P(Z >= z2).

    NOTES: When delta0 = 1, the Tang, Tang and Chan test statistic reduces to McNemar's test statistic (McNemar, 1947).  When a = b = c = 0, there are no positve outcomes in either treatment group, and the RR
    and test statistics become undefined.  If a > 0, and b = c = 0, then there is complete concordance, and z1 = z2, so p1 = p2.  As is standard with two one-sided tests for equivalence, 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 tostrrp and tostrrpi

        +------+
    ----+ Main +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    delta0(#) defines the equivalence threshold for the tests, with the lower boundary of equivalence equal to delta0, and the upper boundary equal to 1/delta0.  For example, delta0 = 0.8 gives an equivalence
        interval of 0.8, 1.25 (because 1.25 = 1/0.8). Researchers are responsible for choosing meaningful values of delta0.

    deltaupper(#) defines the upper equivalence threshold for the test, and restricts the meaning of delta0 to the lower equivalence threshold for the test.  Also, delta0 must be a positive value less than or
        equal to 1, and deltaupper must be a positive value that is greater than or equal to 1.  Taken together, these correspond to geometrically asymmetric equivalence intervals.

    alpha(#) specifies the nominal type I error rate.  The default is alpha(0.05).

    exactchisq calculate and use the exact chi-square p-value for making the rejection decision for the positivist test. The default is the asymptotic p-value because the Tang-Tang-Chan test statistics are
        also asymptotic.

    treatment1(string) labels the name of the first treatment group in the output table.  For tostppr this defaults to the variable label for treatment_1_outcome_variable.

    treatment2(string) labels the name of the second treatment group in the output table.  For tostppr this defaults to the variable label for treatment_2_outcome_variable.

    outcome(string) labels the value corresponding to positive for the outcome.  For tostppr this defaults to the label for the value = 1 in treatment_1_outcome_variable (or in treatment_2_outcome_variable if
        treatment_1_outcome_variable is unlabeled).

    nooutcome(string) labels the value corresponding to negative for the outcome.  For tostppr this defaults to the label for the value = 0 in treatment_1_outcome_variable (or in treatment_2_outcome_variable
        if treatment_1_outcome_variable is unlabeled).

    relevance reports results and inference for combined tests for difference and equivalence of marginal probabilities (of exposure) for a specific alpha, and delta0.  See the end of the Discussion section
        in tost for more details on inference from combined tests.


Examples

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Example 1 setup
    . use hivfluid (requires that you install hivfluid.dta)

    1a Relevance test example from Tang, et al., 2003, Table II, based on data from
    Lachenbruch and Lynch, 1998 with equivalence interval .95 to 1.052632
    . tostrrp plasma alternate, delta0(0.95) rel


    1b Same as above command, but using immediate form
    . tostrrpi 446 5 16 1157 0.95, treatment1("Plasma sample") treatment2("Alternative fluid") outcome("HIV Positive") nooutcome("HIV Negative") rel


    1c Same as above, but using the exact p-value for the positivist test.
    Positivist test and relevance test conclusions change
    . tostrrpi 446 5 16 1157 0.95, exactchisq treatment1("Plasma sample") treatment2("Alternative fluid") outcome("HIV Positive") nooutcome("HIV Negative") rel


    Example 2 from Tang, et al., 2003, Table V, based on data from Tango, 1998.
    Using exact.chisq=TRUE because expected counts are tiny in some cells.
    . tostrrpi 43 0 1 44 0.9, exactchisq treatment1("Thermal") treatment2("Chemical") outcome("Effective") nooutcome("Ineffective")
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Saved results

    tostrrp and tostrrpi save the following in r():

    Scalars   
      r(RR)          relative risk (aka incidence rate ratio) of positive outcome for treatment 2 vs. treatment 1
      r(sdRR)        standard deviation of relative risk based on the score statistic per (Tang, et al., 2003)
      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(delta0)      delta0, tolerance level defining the equivalence interval; OR
      r(deltalower)  delta_lower, tolerance level defining the equivalence interval's lower side; AND
      r(deltaupper)  delta_upper, tolerance level defining the equivalence interval's upper side
      r(relevance)   Relevance test conclusion for given alpha and delta0


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.  2025.  tostrrp: Test for equivalence of relative risk and unity in paired binary data.  In: tost Stata software package.  URL: https://www.alexisdinno.com/stata/tost.html


Reference

    Lachenbruch, P. A., and Lynch, C. J.  1998.  Assessing screening tests: Extensions of McNemar's test.  Statistics In Medicine 17: 2207-2217

    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.  Journal of Pharmacokinetics and
        Biopharmaceutics.  15: 657-680

    Tang, N.-S., Tang, M.-L., and Chan, I. S. F.  2003.  On tests of equivalence via non-unity relative risk for matched-pair design.  Statistics In Medicine 22: 1217-1233.

    Tango, T.  1998.  Equivalence test and confidence interval for the difference in proportions for the paired-sample design.  Statistics In Medicine, 17: 891-908

    Wellek, S.  2010.  Testing Statistical Hypotheses of Equivalence and Noninferiority, second edition.  Chapman and Hall/CRC Press.  p.  31


Also See

      Help: tost, mcc, tostmcc
