# Linear trend with time-series does not fit the data perfectly. Is that OK?

I am new to a time-series model. I try to improve my knowledge by practising. I understand the stationary for the time-series model. I read many papers and tutorials regarding removing the trends. However, sometimes, I see that the authors fit a linear trend to the data. I have provided two examples below. From the plots, there are clear increasing patterns in the data. But the linear trends do not fit the data well. Is that Ok? In other words, the linear trends did not follow the fluctuation in the data. Is that because the focus here is to show the overall trend, which is the increasing one?

Please note that for the first plot, the authors remove the trend!

[Here

But the linear trends do not fit the data well. Is that Ok?

Yes, that is absolutely fine. No one would seriously expect a simple linear model to fit these time series' well.

In other words, the linear trends did not follow the fluctuation in the data. Is that because the focus here is to show the overall trend, which is the increasing one?

The lines you fitted show an overall increasing trend, but you can't say much more than that. There is some limited utility in explaining the data within these time ranges. Extrapolation outside the time range would be not be a good idea.

If you want better fitting modeld you may need to look at autoregressive models, moving average models and conditional heteroskedasticity models.

• Thank you for your help. It is really good. I just found these plots at the published paper (the first) and at stack overflow (the second). So, I just wonder, especially for the first one, why do the authors did not fit more complex trends? NB: the author remove the trend. Jul 20, 2020 at 9:12
• So, what I really would like to understand is, can I fit a linear trend to show an overall increasing trend, especially when I need to remove the trend? Jul 20, 2020 at 9:14
• I can't comment on why the authors didin't fit more complex models. That would be a question for them. Jul 20, 2020 at 9:17
• I don't undestand you 2nd question Jul 20, 2020 at 9:17
• I mean: Suppose I have a data similar to the posted plot. Suppose further I would like to show the trend before removing it. So, is it Ok to only show the overall trend? Or I must apply the best fit model even if I plan to remove the trend. Jul 20, 2020 at 9:31

The linear trends look about right. The issue is you have seasonality in your data (at least in the rental data - there doesn't appear to be seasonality in the stock price data). This is, there is a cyclic effect due to the time of year/day of the week or some other repeating time.For instance, in your rental data there are more rents in the summer months - if this is a holiday let then this makes complete sense, lots of people go for a holiday/vacation in the summer and less so in the winter.

Dealing with seasonality is as simple as including factor terms in your mean function. At the moment, your mean function is $$f(t) = \beta_0 + \beta_1 t.$$ You should add in seasonal components $$f(t) = \beta_0 + \beta_1 t + s_t$$ where $$s_t$$ is the 'season' we are in at time $$t$$. This could be a typical season (summer/winter/spring/autumn), a month, day of the week, or any other sensible cyclic 'time'. You need to define the seasons in a way that makes sense for the data (like in the rental data, using months or standard seasons seems appropriate).

Another important thing to think about is the error structure in the data. Errors in time series are correlated so a linear regression, although good for 'de-trending' the data, isn't the best for prediction. You need to find a suitable error structure for your data too. ARIMA models will be a good starting point for this.

• I am guessing that the latter plot is the closing value of Apple's stocks by judging on the y-axis label. In that case (i.e. if it is a stock value), a seasonal effect will likely not make any sense. Even without knowing this, I have a hard time seeing any seasonal effect in the latter plot like what you are referring to. Jul 20, 2020 at 8:24
• I can't really see seasonality in the first plot, but it is certainly in the first plot. I'll go edit to clarify that I meant seasonality only really present in rental data Jul 20, 2020 at 8:26
• Thre is 2 years of data for the first plot. There probably is seasonality since we know that it is rentals, but there isn't much hope of modelling it with 2 years of data. Jul 20, 2020 at 9:01