If I have $n$ measured and interdependent time series $M_1, M_2, M_3..., M_n$ and have $n-1$ forecast time series $P_1, P_2, P_3..., P_{n-1}$, how can I predict the last forecast time series $P_n$?

Background: Me and some friends are avid river swimmers and we would like to forecast the water temperature. I have logged the past water temperature along with air temperature, wind conditions and solar radiation for the last couple of years. I also have access to the forecast of all these other parameters.

What I know so far is to filter out seasonality by only operating on the difference from the averages of the historical measurements.

But I lack the the mathematical knowledge to now generate a model which predicts the last time series. Can you give me some indication on what is left to do?

The result is ideally a model which given the past data, current conditions and other parameters forecasts for a given time in the future, gives me the water temperature for this point in the future.

  • $\begingroup$ A series is a set of observations, not a single observation. It sounds as if you have just a single series for water temperature and single series for other predictive variables. The detail on temperature for swimming still leaves this as a very general question, how to predict a time series given various predictors? There are probably hundreds of books on time series and forecasting and there is no easy way to digest the advice there for you. By the way, it is not obvious to me that you should remove seasonality, even if you add it back in later. $\endgroup$
    – Nick Cox
    Commented Jun 22, 2015 at 9:43
  • 1
    $\begingroup$ Is it possible for you to give an example dataset? $\endgroup$
    – Zhubarb
    Commented Jun 22, 2015 at 13:40
  • $\begingroup$ Please post the example dataset. $\endgroup$
    – forecaster
    Commented Jun 22, 2015 at 13:44
  • $\begingroup$ Generally speaking there is no correct way to do this. Make assumptions which you consider to be valid and go from there. It's unusual to use forecasts to make predictions - but it might be a reasonable thing to do. I'd only be able to tell you what to do after I had a look at what the data looks like. The advice I got from my stats professor was 'always plot the data first'. $\endgroup$
    – AnthonyC
    Commented Jun 26, 2015 at 18:25

2 Answers 2


If you want to forecast one time series (water temperature) based not only on its previous values but also on another time series (eg air temperature), you should try linear regression with ARIMA errors. Here is a good start: https://www.otexts.org/fpp/9/1

  • 1
    $\begingroup$ here is another paper written by me and my colleague that looks simpler that regression-ARIMA (r-package is also provided). Note the word moving average in this paper points to residuals not white noise. arxiv.org/abs/1412.5870 $\endgroup$
    – TPArrow
    Commented Jun 26, 2015 at 9:39
  • $\begingroup$ After 8 years, are Long Short-Term Memory models for time series forecasting better than these solutions or not? @TPArrow $\endgroup$
    – M. Chris
    Commented Jul 27, 2023 at 8:18

I guess there are many ways to tackle your problem, but in general predicting physical conditions is a very difficult problem. However, if you still wanted to use Machine Learning to solve it these would be the frist two attempts that I would try:

First of all, you will need a lot of past-data and just to make it clear you want to predict let's say the next $d$ days given the $x$ previous days (where $d$ is a reasonable value). In both cases, apart from the weather data I would add the month of the year as a one-of-K parameter in my dataset. (this means you will have a vector of 12 zeros and you will fill a one at the corresponding month).

1) Autoregressive integrated moving average (ARIMA) model

ARIMA models are indisputably some of the most powerful moving average model used in statistics and econometrics for time-series prediction. If it can forecast financial time-series then it will fit your case as well.

A very helpful start would be: http://a-little-book-of-r-for-time-series.readthedocs.org/en/latest/src/timeseries.html, the examples are close to your case as well.

2) Recurrent Neural Network model (bonus)

Although it might be an overkill for your task, I would try to train a recurrent neural network (RNN) on your data. RNNs are very flexible and powerful machine learning models able to model any kind of time-series. More specifically, you would need a many-to-many with delay RNN. Furthermore, there are even more powerful variations of RNNs such LSTMs that also have memory cells in the neurons.

In case you would like to read more about implementing such a model, I would suggest Torch7, which is considered the state-of-the-art in Deep Learning. You can start with the introduction of http://karpathy.github.io/2015/05/21/rnn-effectiveness/ and then in order to set it running I would use the Recurrent module from https://github.com/clementfarabet/lua---nnx.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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