# 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 with Seasonal Variables

This tutorial gives a short introduction about linear regression with seasonal variables.

A time series are observations measured sequentially in time, seasonal effects are often present in the data, especially annual cycles caused directly or indirectly by the Earth’s movement around the sun. Here we will present linear regression model with additive seasonal indicator variables included.

Suppose a time series contains s seasons. For example

• For time series measured over each calendar month, s = 12.
• For time series measured in six-month intevals, corresponding to summer and winter, s = 2.

# Autocorrelation Affects Regression on Time Series

This post talks about how autocorrelation affects regressions on time series.

Time series regression usually differs from a standard regression analysis because the residuals form a time series and therefore tend to be serially correlated.

• When the residual correlation is positive, the estimated standard deviation of the parameter estimates, read from the computer output of a standard regression analysis, will tend to be less than their true value. \(\,\Longrightarrow\,\) This will lead to erroneously high statistical significance being attributed to statistical tests in standard computer output. In other words, the obtained p values will be smaller than they should be.