Announcement

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

  • plotting splines using xblc

    Hi everyone.
    I usually use the xblc command to plot estimation and confidence intervals after running a regression model with my variable of interest modeled as splines.
    I'm using my usual code but this time I get an error message.

    This is my code

    preserve
    replace x = ln(x)
    replace x = round(x, 0.1)
    mkspline index=x, cubic nknot(5)
    regress y index*
    levelsof x
    xblc index*, covname(x) at(`r(levels)') generate(pa or lb ub) pr
    #delimit;
    twoway
    (line or pa , lc(maroon) lp(solid) lw(medthick) lcolor(lime) sort )
    (line lb pa , lw(medthick) lc(maroon) lp(shortdash) lcolor(lime) sort )
    (line ub pa , lw(medthick) lc(maroon) lp(shortdash) lcolor(lime) sort )
    (scatter y x, sort msize(*0.4) mcolor(midblue%40)),
    legend(off)
    scheme(s1color)
    ;
    #delimit cr
    restore


    This is my STATA output


    Click image for larger version

Name:	Screenshot 2022-08-06 at 17.10.32.png
Views:	1
Size:	113.3 KB
ID:	1676684



    Can anyone help me?

    Thanks you very much









Working...
X