[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: spline regression

From   Maarten buis <>
Subject   Re: st: spline regression
Date   Fri, 7 Mar 2008 22:19:47 +0000 (GMT)

--- Mohammed El Faramawi <> wrote:
> 1) When should we use it?

If you add a continous variable without spline terms, square terms,
etc. to a model you think that it has a linear effect on the mean of
your dependent variable (-regress-), the logit of success (-logit-),
the log rate (-poisson-, -nbreg-, -zip-), the log hazard rate (-streg-
or -cox-). If you think that that is not true, than you can use a

> 2)What conditions  should be fulfilled before running
> this model. e.g. should the Dependant variable be
> categorical or linear, what about the independent
> variable

You can add a spline to whatever model, so your dependent variable, can
be continous, bounded, discrete, categorical, or whatever else you can
or cannot think of. A spline is added because you think that the effect
of a variable is non-linear, so it makes only sense when the
explanatory variable is continuous.

> 3) How to interpret the results obtained from it.

If you use a linear spline you can interpret the result of the first
spline term as the effect of the variable before the first knot, the
second spline term as the effect between the first and the second knot,
etc. So in the example below: a year extra tenure leads to .22 dollars
extra income if the tenure is less than 10 years, and .11 dollars extra
income if tenure is more than 10 years. This means there is quite a
hard break in the change in effect at the knot. You can let the effect
change more gradually by specifying the -cubic- option (if you have
Stata 10). The interpretation can now best be done using graphs. The
graph below shows the predicted income for a white college graduate in
a union job with an average age.

*--------------------- begin example ------------------------
sysuse nlsw88, clear
gen ln_w = ln(wage)
gen black = race == 2 if race < .

mkspline  ten1 10 ten2 = tenure
reg ln_w ten1 ten2 union age black collgrad

mkspline tens=tenure, cubic nk(3)
reg ln_w tens* union age black collgrad

sum age if e(sample)
replace age = r(mean)
replace union = 1
replace black = 0
replace collgrad = 1
predict yhat
bys tenure: gen byte mark = _n== 1
twoway line yhat1 yhat2 tenure if mark, sort
*-------------------- end example -----------------------------
(For more on how to use examples I sent to the Statalist, see )

Hope this helps,

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

Rise to the challenge for Sport Relief with Yahoo! For Good
*   For searches and help try:

© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index