Comparing Marginal effects across sets of explanatory variables in the same model

I am new to datamethods forum. I apologize if my post here is not appropriate. Please let me know if there are sets of rules which I should follow (other than what is stated on FAQs).

I am currently working with count data with overdispersion. A count data outcome (Length of Hospital Stay) and sets of explanatory variables (both continuous and categorical). I am trying to interpret the post estimate adjusted marginal effect (Average adjusted marginal/partial effect, AME) after a negative binomial regression.

I understand the AME for a binary variable X is the incremental effect of 1.X compared to 0.X (reference). However, I am not sure if the AME (average marginal or partial effects) can be compared across covariates in a single model. I had read articles such as Norton et al. and Williams, but was not able to find explanation. It might also be most likely that I have not fully understood the concept of marginal effect.

For illustrative purpose, I present a fictitious case.
For example, let’s say, for an overdispersed count outcome variable (e.g., count of LOS) and 4 independent variables (age, race[black/ white], gender [man/woman], presence of comorbidity [0 , 1 , 2+]), I conduct negative binomial regression using Stata (simple analysis)

nbreg LOS age i.race i.gender i.comorbidity, irr

margins, dydx(race gender)

lets say the AME for race (white vs black) is 4.1 days with 95%CI (3.8-4.3) and the AME for gender (woman vs man) is 6 days with 95% CI(5.8-6.1).
Can I state that the AME of gender on LOS is greater than that of race?

Thank you for your kind advice.

1 Like

Welcome to the site. I hope that someone will be able to directly answer your question. For background purposes what about the problem makes you want to get a marginal effect estimate, since covariate-conditional effects will vary so much depending on covariate values? Isn’t the marginal estimate hiding too much?

Thank you @f2harrell for your welcome and quick response.
In my analyses some of the independent variables are binary codes of diagnoses. For example the Incidence rate ratio, for diagnosis A (y/n) is 1.41; for diagnosis B(y/n) it is 2.03. But I also want to estimate the number of days, hence the margins postestimation.

For diagnosis A: while holding all other covariates at their observed value the AME (yes vs No) is 2.28 (1.57-2.99) the Average adjusted predicted values for having diagnosis A and not having diag. A are 7.81 and 5.53 respectively. AME is the difference of the two. So I interpret the result as the incremental effect of having diagnosis A being 2.28 days.
For diagnosis B: the predicted values for LOS are 6.38 (no) and 12.91 (yes), hence the incremental effect of having diagnosis B being 6.54 days with 95% CI (4.66-8.41). I thought this analysis makes the interpretation easier.
Currently I do not go beyond these conclusions. But I was wondering if it is possible to also say the incremental effect of diagnosis B is higher than diagnosis A (instead of comparing the predicted values for B(yes)= 12.91 days vs A(yes)= 7.81 days, which I thought is faulty)

Edit (added)… I also make analysis for the marginal effects of diagnoses A and B at representative values of age to see if the partial effect varies with increasing age (continuous variable)

On the one point, I’m still not clear why it is OK to cover up outcome variation by marginalization. For example if the difference (across diagnoses or some other variable) in mean LOS for males is 2 days and for females is 4 days, marginalizing to get a difference in mean LOS of, say, 2.8 days gives us an estimate that doesn’t apply to anyone and makes the reader miss an important difference between sexes. On the other hand, providing estimates of mean differences for representative covariate settings (single values), or even just for varying one covariate at a time (setting all others to median/mode) provides more information.

1 Like

There are two separate issues that are being conflated into one here:

  1. Should there be a main term for the covariate? (the purpose of this is to control for confounding)
  2. Should there be an interaction term for the covariate? (the purpose of this is to allow for effect modification)

When we talk about “marginal models”, for example in the setting of inverse probability weighting, the idea is that we can control for confounding without a main term for the confounder. It is therefore “marginal” relative to the confounder. You are still allowed to include interaction terms, so semantically “marginal model” may be misleading; if one wanted to be completely precise it might be better to call it “marginalized over confounders”.

In fact, in marginal structural models it is even recommended to include baseline covariates in the model, as this leads to more efficient estimation. As used in practice (and as recommended by its developers), marginal structural models are therefore almost always conditional on all baseline covariates. The only thing they are unconditional with respect to, are the post-baseline confounders. However, this recommendation is purely to improve efficiency. There is nothing wrong methodologically with using a true marginal model, you just get unnecessarily wide confidence intervals.

If the true effect is 2 days in men and 4 days in women, the marginal effect parameter is a valid estimate of the population level average effect. However, knowing the true population level average effect is much less useful than knowing the true conditional effect. Again, this is not a matter of validity. Anyone in causal inference would tell you to include an interaction term if effect modification is suspected.

1 Like

Useful thoughts. On the last paragraph, since the model is nonlinear, different effects for males and females will arise even with zero interaction. And you’re right it’s not so much a matter of validity; it’s a matter of why would one ever be interested in the 2.8 which applies to no one and hides valuable information.

Thank you @f2harrell and @AndersHuitfeldt for your thoughtful points. I hope I have understood some of your points correctly. If not, please let
With the point regarding the necessity on using marginal/incremental effect after regression, is because the Incident rate ratio does not give much information if one wants to translate it into length of hospital stay since it is a ratio. The marginal effects are, in other hand, in the natural metric of the dependent variable. They can also handle and plot interaction effects even if the initial regression model does not include interaction term (in Stata, through the options pwcompare and mcompare*(bonferroni)* ).
For example, in a model which contains the binary variables (female[0,1] and SUD [0,1]) if I have IRR for female 2 and for SUD diagnosis 2, I cannot conclude the LOS for female patients equals to patients with SUD diagnosis. From the margins command I could see for example men have 2.1 days in (adjusted) average and women 4.2 days in hospital stay while the number for SUD vs non-SUD diagnosis are 8 and 4 days respectively. even if the IRR for both variables is 2 I could see the adjusted incremental effect of being woman is 2.1 (4.2-2.1) and that of SUD diagnoses is 4.0 days (8-4). I assume that I could also say the incremental effect of SUD is greater than that of being a female patient (since both are binary variables) . For this reason, I think the average predicted values for each level of discrete variable and the average adjusted marginal effect/incremental effect might give a more detailed picture of the outcome variation. As Frank noted in post 3/6, marginal effects for representative values of a variable are even more detailed.
But regarding the one point raised by both Anders and Frank, (mean LOS 2 days for men and 4 days for women), what approach would you take if you want to know if this difference between men and women is the same across age groups or diagnoses groups?
Apologies again if I misunderstood your points.

@AndersHuitfeldt I could not understand what you mean by the following. Can you also suggest me a paper detailing the points you raised? Thnx

I was responding more to Frank than to you, my comment arose in the context of a pre-existing disagreement about causal inference and marginal structural models that has been going on for a long time across different blogs and Twitter. I am not sure how relevant my comment is to your question, but if you are interested in marginal structural models, a good place to start would be with Hernan & Robins textbook “Causal Inference: What if?” which is available for free at Causal Inference Book | Miguel Hernan's Faculty Website | Harvard T.H. Chan School of Public Health


I may be missing something but I’m still not convinced of the need of any marginalization in this context.