Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Xblc package (splines)

    Hi all clever people!

    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)
    But how do I choose the levels?

    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)
    But this doesn't stop at 200. Anything I could do?

    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)
    Are there any options, or do I have to drop participants with values over 200?

    Kind regards,
    Julie


  • #2
    It is kind of funny how I manage right after asking Statalist. This is my solution, if anyone else get stuck:

    Added to the graph syntax:
    Code:
    if inrange(pa,0,200)
    Would recommend:
    A procedure to tabulate and plot results after flexible modeling of a quantitative covariate by Orsini and Greeland, Stata journal (2011)

    Comment

    Working...
    X