Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: SPLINE commands

From   Roger Newson <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: SPLINE commands
Date   Fri, 4 Feb 2011 17:33:07 +0000

As it happens, linear splines are a special case of B-splines. The sensible basis for a linear spline (I think) is a basis of fuzzy interval membership functions, also known as tent functions. These fuzzy interval membership functions are both the B-spline basis and the reference-spline basis of the space of linear splines on a given set of knots. So, the corresponding parameters are the values of the spline at the knots. And the values of the spline between any 2 successive knots are linearly interpolated between the values of the spline at the knots. So, as Maarten says, linear splines are easy to interpret, although not expected to be literally true. For some illustrations see Newson (2011), which is the latest version of the -bspline- manual.

Best wishes



Newson R. B-splines and splines parameterized by their values at reference points. Updated 18 January 2011. Downloadable from
as of 04 February 2011

Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page:
Departmental Web page:

Opinions expressed are those of the author, not of the institution.

On 04/02/2011 16:42, Maarten buis wrote:
--- On Fri, 4/2/11, Ronald McDowell wrote:
I'm not familiar with the concept of splines, and am
looking for a gentle introduction to the area, in
order to move beyond using quadratic and cubic etc
terms in my models.

You could look at Marsh, Lawrence C. and David R. Cormier
(2002) "Spline Regression Models". Quantitative Applications
in the Social Sciences, nr. 137. Thousand Oacks: Sage.

I am actually moving back towards linear splines (from
more smooth restricted cubic, B-splines, etc.), as I
find linear splines to have a nicer balance between
interpretability of the parameters and flexibility of the
curve. Anyone who can interpret regular regression
parameters can also interpret the parameters of a linear
spline terms.

Consider the example below:
*--------------- begin example --------------------
sysuse auto, clear
mkspline mpg1 20 mpg2 = mpg
reg price mpg1 mpg2 foreign

// use adjust to predict price while keeping foreign at 0
adjust foreign = 1, by(mpg) generate(yhat)

// graph the predicted price against mpg
twoway line yhat mpg, sort
*---------------- end example ----------------------

The graph illustrates what happend, we basically have
two linear regression: one for cars with an mpg<  20
and one for cars with an mpg>20, and the regression
lines meet at mpg == 20. Moreover, the standard
parameterization, as implemented by -mkspline-, lets
you interpret the coefficients of these splines as
regular regression coefficients. So, for cars with
mpg<  20 and additional mile per gallon leads to a
drop in price of 845 dollars, while for cars with
mpg>  20 the drop in price is a insignificant 70
dollars per mile per gallon.

As always there is a price that needs to be paid for
such convenient interpretability, and for linear
splines it is that sudded change in direction at the
knot and the linearity between the knots. Some people
find this not smooth enough or not realistic enough.
However, I am willing to sacrifice a lot of "realism"
of my model if that helps me to get across what I
have done to my data in order to arrive at my
conclussions. With linear splines one often must view
models as a useful summary/simplification of reality,
but isn't that what a model is supposed to be anyhow?

Having said all that, work has been done on making
the coefficients of other types of splines more
interpretable, but linear splines seems to me a
logical place to start before entering into more
complicated variations of it (and don't be afraid
to move back to linear splines once you have looked
at those variations).

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen

*   For searches and help try:
*   For searches and help try:

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