Analyzing time series data with linear regression
You learned how to predict responses using linear regression in Chapter 4, Linear Regression for Business; however, this technique is less useful and sometimes not even appropriate to analyzing time series data. Why? This question is the catalyst to understand the proper application of time series models.
Before working with the data from the use case, we will use a dataset already in R. The TSA
package contains a dataset called airpass. This dataset provides the total monthly count of international airline passengers covering the period from January 1960 to December 1971. This represents twelve years of monthly passenger data, which is 144 observations. After loading the library, the airpass
dataset is available using the data()
function. You can examine the dataset using methods discussed in the previous chapters:
library(TSA) data(airpass) str(airpass) summary(airpass)
The output is as follows:
Time-Series [1:144] from 1960 to 1972...