I would like to make a smooth spline graph using the xblc package (for cox regression), stopping at 200.
I have values in my outcome variable that exceed 200, but they are few (so the CIs are massive), and I don't want the graph to run all the way to 600 for 80 people (of ca 250,000). But I also don't want to remove them from the analysis. But including them makes the graph very hard to read!
I manage to get the values I need if I specify it here (at( 0 50 100 150 200)):
Code:
quietly xblc avg_spline*, covname(avg_spline1) at(0 50 100 150 200) reference(0) eform gen(ptavg hr lb ub)
I'd rather use the smoother version to get a nicer curve (at(levels)):
Code:
quietly xblc avg_spline*, covname(avg_spline1) at(`levels') reference(0) eform gen(ptavg hr lb ub)
Can I amend the graph somehow? I tried to make the X axis end at 150, but it doesn't do that.
Code:
twoway (line hr ptavg, sort) (line lb ub ptavg, sort lc(black black) lp(- -)), /// legend(off) /// xtitle(Alcohol g/week) ytitle(HR of menopause) yline(1) /// title(Model 1) note("{it:Note.} N= 250,231") yscale(r(0.85 0.90 0.95 1 1.05 1.10)) xscale(r(0 25 50 75 100 125 150)) name(model1, replace)
Kind regards,
Julie
0 Response to Xblc package (splines)
Post a Comment