Table 2.
Stata code to implement independence estimators. ‘y’ denotes patient outcome, ‘z’ denotes treatment allocation, ‘id’ is a unique identifier for patient, ‘m_i’ denotes the number of episodes for which the patient is enrolled in the trial, ‘z_prev’ denotes the patient’s treatment allocation in their previous episode (and is set to 0 if it is the patient’s first episode), ‘x_ep’ is an indicator for episode 2, ‘prop_1st_ep’ and ‘prop_2nd_ep’ represent the proportion of episodes in the trial which are 1st and 2nd episodes respectively, and ‘prop_has_1ep’ and ‘prop_has_2ep’ denote the proportion of patients enrolled in the trial for one and two episodes respectively. In order to run the above code in Stata, ‘prop_1st_ep’, ‘prop_2nd_ep’, ‘prop_has_1ep’, and ‘prop_has_2ep’ must be saved as Stata local macros
| Estimator | Stata code |
|---|---|
| Added-benefit | |
| Per-episode | reg y z, vce (cluster id) |
| Per-patient | reg y z [pw = 1/m_i], vce (cluster id) |
| Policy-benefit | |
| Per-episode |
reg y z##z_prev x_ep, vce (cluster id) lincom `prop_1st_ep’*_b[1.z] + /// `prop_2nd_ep’*(_b[1.z] + _b[1.z_prev] + _b[1.z#1.z_prev]) |
| Per-patient |
reg y z##z_prev x_ep [pw = 1/m_i], vce (cluster id) lincom `prop_has_1ep’*(_b[1.z]) + `prop_has_2ep’*((1/2)*(_b[1.z]) + /// (1/2)*(_b[1.z] + _b[1.z_prev] + _b[1.z#1.z_prev])) |