Hi all
I have an stcox regression where the event is work exit. I am estimating the impact of diabetes, controlling for a set of confounders, and testing whether certain factors mediate the relationship between diabetes and work exit. The command is as follows:
rdiabe = diabetes yes/no, scworkj = feel supported at work yes/no, ragey_6cat = age in six categories, rcohort_e_waves = study cohort.
This gives a diabetes HR of 1.5 (P=.001), scworkj HR of .868 (P=.005) and the interaction term has a HR of .752 (P=.076).
I have tried plotting margins following this over age using the following command:
Which gives:

This makes intuitive sense. The hazard is distinctly higher for those with diabetes and who don't feel supported at work.
However, I have since read that margins do not make sense with stcox because it depends on the baseline hazard and the purpose with stcox is to avoid this (see: http://www.statalist.org/forums/foru...ns-after-stcox).
Yet, it seems to me that the graph provides a reasonable picture of what is happening in the model.
A further issue. I wondered whether in fact, this should be modelled by producing a three way interaction between diabetes, support at work, and age, since intuitively the graph seems to be showing this relationship. If I run the model again with this three way interaction and graph the result, the following is given:

Is this in fact the more valid way of presenting what is going on?
Are margins even valid at all here? If not, what is the 'proper' way to represent what is going on in the model?
Any advice gratefully received.
Dan
I have an stcox regression where the event is work exit. I am estimating the impact of diabetes, controlling for a set of confounders, and testing whether certain factors mediate the relationship between diabetes and work exit. The command is as follows:
Code:
stcox rdiabe##scworkj i.ragey_6cat ragender i.rcohort_e_waves, efron
This gives a diabetes HR of 1.5 (P=.001), scworkj HR of .868 (P=.005) and the interaction term has a HR of .752 (P=.076).
I have tried plotting margins following this over age using the following command:
Code:
margins if firstobs, at(rdiabe=(0 1) scworkj=(0 1) ragey_6cat=(1 2 3 4 5 6)) marginsplot, xdimension(ragey_6cat) noci
This makes intuitive sense. The hazard is distinctly higher for those with diabetes and who don't feel supported at work.
However, I have since read that margins do not make sense with stcox because it depends on the baseline hazard and the purpose with stcox is to avoid this (see: http://www.statalist.org/forums/foru...ns-after-stcox).
Yet, it seems to me that the graph provides a reasonable picture of what is happening in the model.
A further issue. I wondered whether in fact, this should be modelled by producing a three way interaction between diabetes, support at work, and age, since intuitively the graph seems to be showing this relationship. If I run the model again with this three way interaction and graph the result, the following is given:
Is this in fact the more valid way of presenting what is going on?
Are margins even valid at all here? If not, what is the 'proper' way to represent what is going on in the model?
Any advice gratefully received.
Dan
Comment