Announcement

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

  • why does mkspline results differ from spbase

    Hi I found spbase create different results from mkspline?
    Spbase creates restricted cubic spline but spbase creates a generated truncated power for natural cubic spline. But it seems like a truncated power for natural cubic spline is not available on mkspline?

    In fact the results produced by stata are different ? What am I doing wrong? Also mkspline creates 4 extra variables rather than 3 despite inserting 3 knots.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float experience str12 experiencecat float(spexperience1 spexperience2 spexperience3 try1 try2 try3 try4)
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    1 "1: <50" -.9590495 -.8680485 -.6876896 1 0 0 0
    end


    Code:
    *create quantiles for surgical experience - this leaves surgical experience continous
    * create knots for surgeon experience (will be put at the quartiles)
    quietly centile experience, c(25 50 75)
    local k1 = r(c_1)
    local k2 = r(c_2)
    local k3 = r(c_3)
    
    * create restricted cubic splines
    spbase experience, gen(spexperience) knots(`k1' `k2' `k3')
    
    //trying with mkspine
    
    mkspline try = experience, cubic knots(`k1' `k2' `k3')
    Last edited by Denise Vella; 02 Aug 2023, 06:46.

  • #2
    I don’t suppose anyone knows the answer to this ? Actually no one has posted on spbase in statalist - in fact I emailed the author and spbase was originally published on -Stata Technical Bulletin - and before mkspline

    i just wonder if there’s anyone on here who knows
    1. why the results are different
    2. if mkspline can generate a truncated power and the inability to do so is the reason why there values are different ? ( in my opinion)

    many thanks

    Comment


    • #3
      You don't have to guess about what mkspline or makespline (Stata 18) can and cannot do. Type help mkspline or help makespline depending on your version of Stata, and near the top is a link to the pdf manual. Go there, go to the section "methods and formulas" and you have listed in all its gory details what it can and cannot do. I just don't know what spbase can do. So I cannot make the comparison.
      ---------------------------------
      Maarten L. Buis
      University of Konstanz
      Department of history and sociology
      box 40
      78457 Konstanz
      Germany
      http://www.maartenbuis.nl
      ---------------------------------

      Comment


      • #4
        Thanks for this, I have already used the help manual that is why I have asked the question as I couldn’t find a way to use mkspline to create a truncated power of a restricted cubic spline.

        with regards to spbase - the only information on what it can do is available only via help spbase .


        the only difference I could find between them is that spbase creates a truncated power. However I may be wrong as to why the values in the spline variabales are different to mkspline

        i’m not sure if there’s anyone who can give me a better answer ?

        Comment

        Working...
        X