Bookmark and Share

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]

Re: st: Why does mkspline only have "restricted" cubic splines and what does it mean in practice?


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Why does mkspline only have "restricted" cubic splines and what does it mean in practice?
Date   Tue, 8 Mar 2011 12:53:45 +0000

There are lots of questions here.

There are many, many kinds of splines and no command can provide more
than a few. Restricted cubic splines are restricted so that the end
segments are linear. This reduces the extent to which the tail can wag
the dog, or the dog can wag its tail, and it usually provides some
welcome resistance to oddities near the extremes of the data.

Stata's implementation of restricted cubic splines follows closely the
recommendation of Frank Harrell in his book "Regression modeling
strategies" (Springer, New York, 2001) and on that and other grounds
it's worth chasing down that book.

I find I never worry about the individual variables. It's the way they
work together that's important.

I am really surprised that you feel you need so many knots, even if
you have ages that aren't integers in your data. I'd experiment with
far fewer, even for something variable like people retiring, or going
through the menopause, at different ages, or whatever your application
is.

Nick

On Tue, Mar 8, 2011 at 12:33 PM, Jen Zhen <[email protected]> wrote

> 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?
>

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index