Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

in my question on a load forecast model using temperature data as covariates I was advised to use regression splines. This really seems to be a/the solution.

Now I face the following problem: if I calibrate my model on winter data (for technical reasons calibration can not be done on a daily basis, rather every second month) and slowly spring arises I will have temperature data outside of the calibration set.

Are there good techniques to make the regression spline fit robust for values outside of the calibration range? Any experiences or references? Thanks!

share|improve this question
The general answer is a resounding, emphatic no for reasons Stephan Kolassa has outlined (but perhaps not forcefully enough). Unless you have theoretical reasons to suppose that the spline ought to extrapolate properly--and that seems unlikely, given that splines are general-purpose and therefore arbitrary--then you should expect the spline to fail, perhaps dramatically, outside the calibration region. – whuber Jan 25 '13 at 15:16
Thanks for your comment ... I understand the reasoning very well. I might be faced with a situation where I just have to do something .. . and make the smallest error ... but I have to do something. – Richard Jan 25 '13 at 16:11
What I do is very applied. The forecasts is one of many and there is hope that errors in one forecast do not weigh too much in the aggregate number. Thanks again for your straight comment. Although the situation will not be saved totally applying some flat or linear damped extrapolation could be a very dirty solution. Just, if I have to do something ... and can't do nothing. – Richard Jan 25 '13 at 16:23
I appreciate that at times you have to do something. What that tells us is you should be asking a different question. Rather than seeking for ways to make a spline "robust," you really want to know something more general: what extrapolation procedures can minimize your loss? Under some pretty general conditions, there are procedures that are better than splines--but they are all still horrible (unless you're lucky). To do well, you will want to incorporate as much information about the nature of the extrapolation as you can, perhaps by using a theoretical model and additional "soft" data. – whuber Jan 25 '13 at 16:49
up vote 2 down vote accepted

The first thing to do is to make sure you are using something like natural splines. These are smooth piecewise cubic curves inside your training set - but they are only linear outside the training set, so they can be used in (careful) extrapolation. In R, you can use the ns() function in the splines package for this.

And the second thing to do is to be very careful and think about what you are doing. Quite probably you will need to feed additional assumptions into your model as to how the result will look like in summer. For instance, if I regressed sales of canned soup, apples and ice cream on temperature in winter and used the result to predict sales in summer, I would not anticipate a very good forecast. And there is really no way to get a very good result just from the winter data alone.

share|improve this answer
I would like to use the package SemiPar I will check for natural splines there - but do you already know whether this package can do this? Thanks! – Richard Jan 25 '13 at 10:28
Hm, I don't know. Have you looked into the reference provided in the help page for spm()? Unfortunately, the help page does not clarify whether the penalized splines it uses are restricted to be linear outside the training set (which I certainly could imagine to be the case). – Stephan Kolassa Jan 25 '13 at 10:42
I checked out the manual and unfortunately I didn't find anything there. – Richard Jan 25 '13 at 11:32
I have contacted the authors - maybe they find time to give a short answer. – Richard Jan 25 '13 at 11:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.