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.
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')
Comment