Should a variable one is interested in examining for effect modification be used in a propensity model to balance covariates? Given I have a binary outcome (Y), binary exposure (A), binary potential effect modifier (Z), and a bunch of covariates (C1-C20).
We would like to examine for effect modification of Z on the treatment effect of A on Y. The treated vs. not treated have different characteristics and we plan to either weight or match treated/not treated using a propensity score.
My question is whether the effect modifier should be included in the propensity model (P(A|C1-C20,Z))? Eeren et al. (2015) seem to indicate no, but I've found little else to back that up. If not, what is the best way to test for effect modification, while still balancing covariates using a propensity score without the effect modifier (P(A|C1-C20))? Possible methods I see:

*

*Make two propensity models within each effect modifier group. Then look at treatment effect within each of these subgroups.

*Make single propensity model excluding effect modifier. Then include effect modifier into effectiveness model as an interaction term with treatment.

Any suggestions with references to published papers would be appreciated.

In general, you should include all pre-treatment causes of the outcome in the propensity score model, even if they don't cause selection into treatment. That said, the answer to your question is less about the propensity score model itself and more about its effect on the resulting samples.
For moderation analysis, you must ensure balance is achieved on the covariates within each level of the moderator. Because the goal of moderation analysis is to compare two (or more) effect estimates, you need to ensure each of those estimates is free from bias due to imbalance. Often, the best way to do this is by estimating subgroup-specific propensity scores (equivalent to including interactions between the moderator and every covariate in the propensity score model if it is a parametric model). It might be possible to let a machine learning algorithm like GBM or BART automatically decide whether moderator-covariate interactions are required.
There is also a method called the subgroup balancing propensity score (SBPS) developed by Dong et al. (2020) that attempts to decide whether an overall propensity score or a subgroup-specific propensity score yields the best balance for each subgroup. For propensity score weighting, this is implemented in R using the sbps() function in the WeightIt package.
For more reading on this matter, I recommend Dong et al. (2020) and Green and Stuart (2014).
If you are doing matching, you should perform exact matching on the moderator. If you are doing weighting, you should ideally estimate weights seperately within each level of the moderator, but this isn't always necessary if you can achieve subgroup-specific balance without doing so.
To estimate the treatment effect, fit a regression of the outcome on the treatment, the moderator, and their interaction in the matched or weighted sample (i.e., including the matching or propensity score weights). You can use regression contrasts or different parameterizations of the model to get subgroup-specific effects, an overall marginal effect, and tests for moderation. See the section in the MatchIt vignette on moderation analysis for more details.
