Announcement

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

  • Restricted Cubic Splines

    Hi there,
    I'm pretty new to STATA, and I was just introduced to Restricted Cubic Splines. Our instructor told us to use the "RCspline" command (she uses SAS, and hasn't been very helpful). I'm trying to predict total hospital costs (logtotcst) based on a few linear variables and a few variables that I need a spline for (one of which is meanbp).

    This was the example that I was given:

    Click image for larger version

Name:	Example.jpg
Views:	1
Size:	41.0 KB
ID:	1356965

    I'm very new to splines, but the spline I created doesn't look anything like the one above.

    The code that I used is:
    twoway lfitci logtotcst meanbp || mspline logtotcst meanbp

    Spline_meanbp_logtotcst.pdf

    Any help would be greatly appreciated!!

  • #2
    mspline just interpolates bandwise medians with cubic splines. It doesn't correspond to anything mainstream and has no direct relation to restricted cubic splines in Harrell's sense.

    Comment


    • #3
      Look at the help file and manual sections for -mkspline-. I think that's the command you want.

      Comment


      • #4
        help mkspline command gives you the information you need to construct restricted cubic splines in the Harrell sense, as Nick mentions. I am also working on hospital costs and am curious about your analysis. Would you care to share some details on what you're doing?

        Comment


        • #5
          Thanks all! I got it to work!

          Sorry this is such a late response - We used the SUPPORT data - which was originally collected to predict death. We used it to predict hospital costs using heart rate, blood pressure, heartrate, pafi, albumin, coma score... ect. It didn't work - Our R2 value was like 0.46. What are you/were you working on with hospital costs?

          Comment

          Working...
          X