I am beginning a project that will employ regression/covariate adjustment to estimate the average effect of treatment on the treated (ATT) and I realize that I have two questions concerning how one estimates the ATT in such a setting and how one interprets the regression output when using GLMs.

First, I am slightly confused on the specification of a desired treatment effect under a regression adjustment framework. For example, in alternative strategies, such as matching or weighting, syntax for executing these methods typically supports an explicit argument where one specifies the desired treatment effect: effect = ate, qoi = att, something along these lines. However, in a standard regression formula in R y ~ x1 + x2 + ..., data = data I do not know how to effectively specify the argument for the treatment effect that I want to estimate. By default, does regression adjustment estimate the ATE? If so, how does one modify this?

Second, after reading papers by Mood 2010, Hanmer and Kalkan 2012, and Norton and Dowd 2018, it is apparent to me that, when modeling non-continuous outcomes, regression coefficients, odds ratios, IRRs, hazard ratios, etc. may prove problematic in interpretation. One solution is to estimate average marginal effects (AMEs). This leads me to my second question. Suppose that I estimate the ATT for a treatment on a count outcome. I then estimate the AME. Can I effectively interpret this AME as the ATT, or are they fundamentally different quantities of interest?


1 Answer 1


The method to estimate representative treatment effects using regression is called g-computation and works with any outcome type as long as the effect measure can be specified as a contrast between means (e.g., a mean difference, a ratio between marginal probabilities, a ratio between marginal odds, etc.). Here's how this works:

  1. Fit a model for the outcome. Ideally this is a flexible model that includes interactions between the treatment and covariates.
  2. Generate predicted values from this model setting all units' treatment value to "treated"
  3. Generate predicted values from this model setting all units' treatment value to "control"
  4. Compute the mean of the predictions under treatment (2) and the mean of the predictions under control (3)
  5. Compute a contrast between these two means.

This method of g-computation estimates the ATE. To estimate the ATT, steps 2 and 3 should be done using only the treated units. The control units are still used to fit the model in 1, but only the treated units are used to compute the predicted values.

To get standard errors, you can use bootstrapping or the delta method (the latter of which is exactly accurate when the outcome model is linear and the contrast is the difference in means but only an approximation otherwise).

In R, this is really easy using the marginaleffects package:

#Fit the outcome model
fit <- glm(Y ~ A * (X1 + X2 + X3), data = data)

#Generate predictions and contrast them
avg_comparisons(fit, variables = "A",
                newdata = subset(data, A == 1))

This works for any GLM, e.g., logistic regression, Poisson regression etc. To compute contrasts that aren't the difference in means/risk difference, just supply an argument to comparison and transform (e.g., to get the risk ratio/relative risk, you would set comparison = "lnratioavg", transform = "exp").

This quantity is related to an AME, though that term is a bit ambiguous because of the multiple meanings of the word "marginal". The word "marginal" in AME means the instantaneous rate of change when the predictor is changed by a tiny amount. For a binary predictor, we are not changing it by a tiny amount; we are going from 0 to 1 (or whatever values you have). So AME is not an accurate way to describe this contrast, though I often use it because it is very closely related in computation and concept to a true AME. Rather, this is a "contrast between the average adjusted predictions". Kind of a mouthful.

  • $\begingroup$ A quick follow up: Does this approach automatically account for the panel structure of my data (just realized I did not specify this in my question). Or do I need to pair g-computation with marginal structural models. I completely admit that this question may indicate ignorance on my part. I have been having difficulty contextualizing the relationships between g-methods. It is unclear to me if g-computation and IPW are MSMs or if g-computation and IPW are applied to MSMs. $\endgroup$ May 4, 2023 at 14:30
  • 1
    $\begingroup$ The ATT is not really an appropriate estimand for sequential treatments. There is no clear definition of "the treated" when units can receive treatment at various time points. So this is only for point treatments. For sequential treatments, you can estimate the ATE using either a variant of g-computation designed for longitudinal treatments (much more complicated than the method I demonstrated because you need a separate model for each time-varying covariate) or IPW, which is much simpler. Both are used to estimate the parameters of a MSM. $\endgroup$
    – Noah
    May 4, 2023 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.