# R in Time Series: Linear Regression With Harmonic Seasonality

This tutorial talks about linear regression with harmonic seasonality.

### 1  Underlying mathematics

In regression modeling with seasonality, we can use one parameter for each season. For instance, 12 parameters for 12 months in one year. However, seasonal effects often vary smoothly over the seasons, so that it may be more parameter-efficient to use a smooth function instead of separate indices. Sine and cosine functions can be used to build smooth variationinto a seasonal model. Read more R in Time Series: Linear Regression With Harmonic Seasonality

# R in Time Series: Linear Regression

This tutorial talks about linear regression on time series and implementations in R.

### 1  Trend: stochastic vs deterministic

• We may consider a trend to be stochastic when it shows inexplicale changes in direction, and we attribute apparent transient trends to high serial correlations with random errors.
• When we have some plausible physical explanation for a trend, we usually wish to model it in some deterministic manner. Deterministic trends and seasonal variations can be modelled using regression.
• The practical difference between stochastic and deterministic trends is that we extrapolate the latter when we make forecasts. We justify short-term extrapolation by claiming that underlying trends will usually change slowly in comparison with the forecast lead time. For the same reason, short-term extrapolation should be based on a line, maybe fitted to the more recent data only, rather than a high-order polynomial.