Dear all,

I use stcox to estimate the probability of an event, which is predicted by two variables x1 (continuous) and x2 (binary variable). It is a requirement in my field to include visuals (in the case of interactions, plotting marginal effects) to demonstrate the significance of the interaction. I used the following model:

stcox c.x1##i.x2, robust nohr

The coefficient of the interaction between the two variables is significant (p<0.005). For plotting the interaction term, I use the following code (I have used a variety of variations of the code but the issue I describe below remains):

margins, at (x2=( 0 1) x1=(0(1)3) (to plot the interaction effect)

marginsplot

margins , dydx (x2) at (x1=(0(1)3)) (to plot the marginal effect)

marginsplot

While the interaction effect in the model is significant and remains significant in all the sensitivity analysis regarding choice of measures, control variable, etc., and the significance makes sense theoretically as well. However, when I use for example

Can someone help me understand what is happening here, and why the marginal effects are super-insignificant while the interaction term in the output of stcox is super significant? I have read a lot of posts neighboring my query and this post came close to answering my question as Maarten Buis suggests that "Marginal effects in a Cox model is problematic, as it depends on the baseline hazard, and the whole purpose of Cox regression is to avoid estimating the baseline hazard". This suggests that I am on the wrong path but my reviewers insist to visually show the marginal effect and I have no idea how to show it (if its there) after searching different books and statalist posts for a few days now. Can someone suggest me how to correct (if its wrong) my approach to plotting interaction or marginal effects after stcox, and give other ideas of how to visually show the effect (of course, if its there)?

Link to the post I mention above: https://www.statalist.org/forums/for...ns-after-stcox

I use stcox to estimate the probability of an event, which is predicted by two variables x1 (continuous) and x2 (binary variable). It is a requirement in my field to include visuals (in the case of interactions, plotting marginal effects) to demonstrate the significance of the interaction. I used the following model:

stcox c.x1##i.x2, robust nohr

The coefficient of the interaction between the two variables is significant (p<0.005). For plotting the interaction term, I use the following code (I have used a variety of variations of the code but the issue I describe below remains):

margins, at (x2=( 0 1) x1=(0(1)3) (to plot the interaction effect)

marginsplot

margins , dydx (x2) at (x1=(0(1)3)) (to plot the marginal effect)

marginsplot

While the interaction effect in the model is significant and remains significant in all the sensitivity analysis regarding choice of measures, control variable, etc., and the significance makes sense theoretically as well. However, when I use for example

*margins , dydx(x1) at(x2=(0 1))*to calculate the marginal effect of x2 on x1, the marginal effects are insignificant at all the values with very wide confidence intervals. This implies, according to the output, that there is no marginal effect. The results are shown below (I have used different versions of the margin codes described above and used below and all result in the same/similar results).Can someone help me understand what is happening here, and why the marginal effects are super-insignificant while the interaction term in the output of stcox is super significant? I have read a lot of posts neighboring my query and this post came close to answering my question as Maarten Buis suggests that "Marginal effects in a Cox model is problematic, as it depends on the baseline hazard, and the whole purpose of Cox regression is to avoid estimating the baseline hazard". This suggests that I am on the wrong path but my reviewers insist to visually show the marginal effect and I have no idea how to show it (if its there) after searching different books and statalist posts for a few days now. Can someone suggest me how to correct (if its wrong) my approach to plotting interaction or marginal effects after stcox, and give other ideas of how to visually show the effect (of course, if its there)?

Link to the post I mention above: https://www.statalist.org/forums/for...ns-after-stcox

**Results: Please note that scandal is x2 while status_yasir_0 is x1.***. margins , dydx(scandal) at(status_yasir_0=(0.0(01)3))*

Average marginal effects Number of obs = 3,790

Model VCE : Robust

Expression : Relative hazard, predict()

dy/dx w.r.t. : 1.scandal

1._at : status_ya~_0 = 0

2._at : status_ya~_0 = 1

3._at : status_ya~_0 = 2

4._at : status_ya~_0 = 3

Delta-method

dy/dx Std. Err. z P>z [95% Conf. Interval]

1.scandal

_at

1 1.645644 2.325978 0.71 0.479 -2.913189 6.204478

2 2.321236 3.173698 0.73 0.465 -3.899099 8.54157

3 3.07329 4.16958 0.74 0.461 -5.098936 11.24552

4 3.917197 5.325377 0.74 0.462 -6.52035 14.35475

Note: dy/dx for factor levels is the discrete change from the base level.Average marginal effects Number of obs = 3,790

Model VCE : Robust

Expression : Relative hazard, predict()

dy/dx w.r.t. : 1.scandal

1._at : status_ya~_0 = 0

2._at : status_ya~_0 = 1

3._at : status_ya~_0 = 2

4._at : status_ya~_0 = 3

Delta-method

dy/dx Std. Err. z P>z [95% Conf. Interval]

1.scandal

_at

1 1.645644 2.325978 0.71 0.479 -2.913189 6.204478

2 2.321236 3.173698 0.73 0.465 -3.899099 8.54157

3 3.07329 4.16958 0.74 0.461 -5.098936 11.24552

4 3.917197 5.325377 0.74 0.462 -6.52035 14.35475

Note: dy/dx for factor levels is the discrete change from the base level.