Dear Stata users,
I am using mcp command in Stata to estimate hazard ratio after running an stcox model which involves splines of some continuous variable. The issue is that I don’t know how to get mcp to plot hazard ratios (not marginal effects) for different values of a continuous variable. I would greatly appreciate any hint or reference that could resolve this issue.
My syntax are as following:
use "C:\Users\Noori\Desktop\sugar2020.dta", clear
stset fday_dth, f(cvd1_dth==1)
xtile redmeat=RedMeat2_g, nq(20)
mkspline sp=redmeat, nk(4) cubic dis // [the displayed knots were used later]
stcox sp* age i.ASEX i.ATOBUSE i.locat i.ADDIAB i.educ i.physact wealthgn ///
ProcFood_g ENERG_KCAL, shared(CENTID) nolog
range w 1 20 20
mkspline rmsp=w, knots( 1 7 13 19.25) cubic // [the above knots were used here]
mcp redmeat(sp1 sp2 sp3), var1(w(rmsp1 rmsp2 rmsp3)) ci // [This does not plot hazard ratios]
Many thanks in advance,
Noori
I am using mcp command in Stata to estimate hazard ratio after running an stcox model which involves splines of some continuous variable. The issue is that I don’t know how to get mcp to plot hazard ratios (not marginal effects) for different values of a continuous variable. I would greatly appreciate any hint or reference that could resolve this issue.
My syntax are as following:
use "C:\Users\Noori\Desktop\sugar2020.dta", clear
stset fday_dth, f(cvd1_dth==1)
xtile redmeat=RedMeat2_g, nq(20)
mkspline sp=redmeat, nk(4) cubic dis // [the displayed knots were used later]
stcox sp* age i.ASEX i.ATOBUSE i.locat i.ADDIAB i.educ i.physact wealthgn ///
ProcFood_g ENERG_KCAL, shared(CENTID) nolog
range w 1 20 20
mkspline rmsp=w, knots( 1 7 13 19.25) cubic // [the above knots were used here]
mcp redmeat(sp1 sp2 sp3), var1(w(rmsp1 rmsp2 rmsp3)) ci // [This does not plot hazard ratios]
Many thanks in advance,
Noori