

- #DETERMINE THE STATISTICS FOR G FROM YOUR DATA GRAVITY LAB CODE#
- #DETERMINE THE STATISTICS FOR G FROM YOUR DATA GRAVITY LAB TRIAL#
Weighting the observed outcome’s conditional expectation by the conditional probability that Z 1 = z 1 enables us to account for the fact that Z 1 is affected by A 0, but also confounds the effect of A 1 on Y.


In our simple scenario, the expectation E( Y 0,0) can be calculated by summing the mean CD4 count in the never treated with Z 1 = 1 (weighted by the proportion of people with Z 1 = 1 in the A 0 = 0 stratum) and the mean CD4 count in the never treated with Z 1 = 0 (weighted by the proportion of people with Z 1 = 0 in the A 0 = 0 stratum). This equation is the g formula its proof, given in the Supplementary Material, follows from the three identifying assumptions.
#DETERMINE THE STATISTICS FOR G FROM YOUR DATA GRAVITY LAB CODE#
In the Supplementary Material, we provide SAS code (SAS Institue, Cary, NC) in which standard regression and all three g methods are fit to the hypothetical data in Table 1.Į ( Y a 0, a 1 ) = ∑ z 1 E ( Y | A 1 = a 1, Z 1 = z 1, A 0 = a 0 ) P ( Z 1 = z 1 | A 0 = a 0 ). Under these assumptions, g methods can be used to estimate counterfactual quantities with observational data.
#DETERMINE THE STATISTICS FOR G FROM YOUR DATA GRAVITY LAB TRIAL#
Under these three assumptions, our hypothetical observational study can be likened to a sequentially randomized trial in which the exposure was randomized at baseline, and randomized again at time 1 with a probability that depends on Z 1. Positivity is met when there are exposed and unexposed individuals within all confounder and prior exposure levels, which can be evaluated empirically. This latter condition is required so that effects are not defined in strata of a 0 and z 1 that do not exist. The third assumption, known as positivity, 7 requires 0 0. 6 This is the central challenge that g methods were developed to address. However, adjusting for Z 1 using standard methods (restriction, stratification, matching, or conditioning in a linear regression model) would block part of the effect from A 0 through Z 1, and potentially lead to a collider bias of the effect of A 0 through U. Failing to condition for Z 1 will result in uncontrolled confounding of the effect of A 1, and thus a dependence between the actual A 1 value and the potential outcome. Note the correspondence between these two equations and the causal diagram: because in Figure 1, Z 1 is a common cause of A 1 and Y, the assumption in equation 1 must be made conditional on Z 1. Equation 2 says that Y a 0, a 1 does not depend on the assigned values of A 0. Equation 1 says that, within levels of prior viral load ( Z 1) and a given treatment level A 0, Y a 0, a 1 does not depend on the assigned values of A 1. This sequential conditional exchangeability assumption would hold if there were no uncontrolled confounding and no selection bias. For simplicity, we define our effect of interest as ψ = ψ 0 + ψ 1 + ψ 2, and we explore a data example with no effect modification by time-varying confounders. When properly modeled, this conditional effect represents a meaningful answer to the question: what is the effect of A 0 and A 1 in those who receive Z 1 = 1 versus those who receive Z 1 = 0? Modeling such effect measure modification by time-varying covariates is the fundamental issue that distinguishes marginal structural from structural nested models. A conditional effect would arise if, for example, one was specifically interested in effect measure modification by Z 1. This marginal effect ψ is indifferent to whether the A 1 component ( ψ 1 + ψ 2) is modified by Z 1: whether such effect modification is present or absent, the marginal effect represents a meaningful answer to the question: what is the effect of A 0 and A 1 in the entire population?Īlternatively, we may wish to estimate this effect conditional on certain values of another covariate. We can write this effect as E( Y a 0, a 1 − Y 0,0) = ψ 0 a 0 + ψ 1 a 1 + ψ 2 a 0 a 1, which states that our average causal effect ψ may be composed of two exposure main effects (e.g., ψ 0 and ψ 1) and their two-way interaction ( ψ 2). This average causal effect ψ = E( Y a 0, a 1 − Y 0,0) is a marginal effect because it averages (or marginalizes) over all individual-level effects in the population. Causal diagram representing the relation between anti-retroviral treatment at time 0 ( A 0), HIV viral load just prior to the second round of treatment ( Z 1), anti-retroviral treatment status at time 1 ( A 1), the CD4 count measured at the end of follow-up ( Y), and an unmeasured common cause ( U) of HIV viral load and CD4.
