time series prediction with linear regression

The model being produced is of little value - it’s certainly not correct. As I mentioned, the model is essentially trying to predict temps using only a single binary variable, with a simple autoregressive approach. Ideally, you would have more features to work with, and you would take measures to identify and deal with trends in your data with methods typical to time series analysis.

That said, if you extend the plot beyond the first 500 observations, you will see that model predictions start to vary again. Here’s the first 6000:

The workflow I posted was mainly to show you how to get a working example, even if the results are quite terrible. But hopefully using your domain knowledge you will be able to find additional ways to improve it.

BTW, if you’re new to time series analysis, we’re teaching an online course on April 6:

4 Likes