3.2 Just a Bunch of Sines and Cosines

In the temperature data example shown above, we neglected to include any sine terms in our model and focused on the cosine terms. However, we can also include sine terms to produce a more complete model. Again, assuming that \(n\) is even,

\[ y_t = a_0 + \left\{ \sum_{p=1}^{n/2-1} a_p \cos(2\pi t p / n) + b_p \sin(2\pi t p / n) \right\} + a_{n/2}\cos(\pi t) \] Note that technically there is no \(b_{n/2}\) because \(\sin(\pi t)=0\) for all integer \(t\).

In the model above the total number of parameters is \(n\). Now, a model with \(n\) parameters is generally not considered a useful model. It is certainly not parsimonious! But it might be more useful to not think of this as a model, but rather as a transformation of the data from \(n\) observed data points into a series of correlations (\(a_p\) and \(b_p\)) with respect to sines and cosines of different frequencies. In other words, we are presenting the exact same information in a different way.

Standard regression modeling theory tells us that the estimates of the \(a_p\) and \(b_p\) coefficients in the model are

\[\begin{eqnarray*} \hat{a}_0 & = & \bar{y}\\ \hat{a}_p & = & \frac{\sum_{t=1}^n (y_t-\bar{y})\cos(2\pi t p/n)}{\sum_{t=1}^n \cos(2\pi t p/n)^2}\\ & = & \frac{\sum_{t=1}^n (y_t-\bar{y})\cos(2\pi t p/n)}{n/2}\\ & = & \frac{2}{n}\sum_{t=1}^n (y_t-\bar{y})\cos(2\pi t p/n)\\ & = & \frac{2}{n}\sum_{t=1}^n y_t\cos(2\pi t p/n)\\ \hat{b}_p & = & \frac{2}{n}\sum_{t=1}^n y_t\sin(2\pi t p/n) \end{eqnarray*}\]

Each of the \(\hat{a}_p\)s and \(\hat{b}_p\)s are proportional to the covariance between the data \(y_t\) and sines and cosines containing \(p\) cycles per \(n\) data points. We will note that the \(\hat{a}_p\)s and \(\hat{a}_p\)s are also proportional to the Fourier transform coefficients associated with frequency \(p\), although they are generally not computed in this manner.