Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Why does mkspline only have "restricted" cubic splines and what does it mean in practice?
From
Jen Zhen <[email protected]>
To
[email protected]
Subject
st: Why does mkspline only have "restricted" cubic splines and what does it mean in practice?
Date
Tue, 8 Mar 2011 13:33:52 +0100
Dear all,
I've used Stata's -mkspline- to create the 2 kinds of spline it
offers, a linear one:
- mkspline Age_1 50 Age_2 52 Age_3 54 Age_4 56 Age_5 58 Age_6 59 Age_7
60 Age_8 61 Age_9 62 Age_10 63 Age_11 64 Age_12 65 Age_13 66 Age_14 =
Age -
and a restricted cubic one:
- mkspline rcs = Age, cubic knots(50 52 54 56 58 59 60 61 62 63 64 65 66) -
The knot points are given by my context.
What the linear spline maker does is very clear and transparent when I
browse it: For instance, for someone aged 55.04, it will make
Age_1=50, Age_2=2, Age_3=2, Age_4=1.04, Age_5=0, etc.
But I have trouble understanding what the "cubic" one does, where I
get the following:
Age rcs1 rcs2 rcs3 rcs4 rcs5 …
55.04383 55.04383 0.5012364 0.1101598 0.0044428 0 …
Obviously rcs1 is just Age linearly for all elements thrown together,
but I have no idea how rcs2 and higher are computed, and indeed why
-mkspline- allows only for "restricted" and not "unrestricted" cubic
splines.
Searching for answers and literature led me to some great introduction
slides on this by Maarten
(http://www.maartenbuis.nl/presentations/bonn09.pdf). However I am
still puzzled by the commands for cubic spline on page 17, which seems
to make only the cubic term different for each knot interval, wheras
in terms of linear and quadratic terms there is just one each for the
full range. Is that because they would otherwise be collinear?
Thanks a lot for any wisdom you might be able to share on this.
JZ
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/