Bring in the file and look at the structure.
Travel <- read.csv("Sept11Travel.csv")
str(Travel)
## 'data.frame': 172 obs. of 4 variables:
## $ Month: Factor w/ 172 levels "1-Apr","1-Aug",..: 86 75 119 42 130 108 97 53 163 152 ...
## $ Air : int 35153577 32965187 39993913 37981886 38419672 42819023 45770315 48763670 38173223 39051877 ...
## $ Rail : int 454115779 435086002 568289732 568101697 539628385 570694457 618571581 609210368 488444939 514253920 ...
## $ VMT : num 163 153 178 179 189 ...
Air Miles
Plot the Air miles data as a time series. We will pick August 2001 as the end date since we are looking at pre-event data.
library(forecast)
## Warning: package 'forecast' was built under R version 3.4.3
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.4.3
library(ggfortify)
##
## Attaching package: 'ggfortify'
## The following object is masked from 'package:forecast':
##
## gglagplot
Air.ts <- ts(Travel$Air, start=c(1990,1), end=c(2001,8), freq=12)
plot(Air.ts, xlab="Time", ylab="Air Travellers", bty="l")

Before evaluating the time series components, we will add a trend line. We will check the correlation of linear, quadratic, and cubic trend lines to see which fits best.
AirLinear <- tslm(Air.ts ~ trend)
summary(AirLinear)
##
## Call:
## tslm(formula = Air.ts ~ trend)
##
## Residuals:
## Min 1Q Median 3Q Max
## -9466409 -3410590 -681183 3360750 11823514
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 35728435 834749 42.80 <2e-16 ***
## trend 177097 10272 17.24 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4912000 on 138 degrees of freedom
## Multiple R-squared: 0.6829, Adjusted R-squared: 0.6806
## F-statistic: 297.2 on 1 and 138 DF, p-value: < 2.2e-16
AirQuad <- tslm(Air.ts ~ trend + I(trend^2))
summary(AirQuad)
##
## Call:
## tslm(formula = Air.ts ~ trend + I(trend^2))
##
## Residuals:
## Min 1Q Median 3Q Max
## -10706560 -3385499 -494312 3334001 11901573
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.745e+07 1.253e+06 29.897 <2e-16 ***
## trend 1.042e+05 4.102e+04 2.541 0.0122 *
## I(trend^2) 5.169e+02 2.818e+02 1.834 0.0688 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4870000 on 137 degrees of freedom
## Multiple R-squared: 0.6905, Adjusted R-squared: 0.686
## F-statistic: 152.8 on 2 and 137 DF, p-value: < 2.2e-16
AirCube <- tslm(Air.ts ~ trend + I(trend^3))
summary(AirCube)
##
## Call:
## tslm(formula = Air.ts ~ trend + I(trend^3))
##
## Residuals:
## Min 1Q Median 3Q Max
## -10824789 -3360490 -515235 3334962 11766582
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.705e+07 1.110e+06 33.370 < 2e-16 ***
## trend 1.351e+05 2.559e+04 5.279 4.98e-07 ***
## I(trend^3) 2.355e+00 1.315e+00 1.791 0.0754 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4873000 on 137 degrees of freedom
## Multiple R-squared: 0.6902, Adjusted R-squared: 0.6857
## F-statistic: 152.6 on 2 and 137 DF, p-value: < 2.2e-16
We can see from the r-squared values that the quadratic trend line is the closest approximation. Next we plot it.
plot(Air.ts, xlab="Time", ylab="Air Miles", bty="l")
lines(AirQuad$fitted, lwd=2)

Next we will adjust the scale to get a different view of the data by making the y axis logarithmic
plot(Air.ts, log="y", xlab="Time", ylab="Air Miles (log scale)", bty="l")

The log scale doesn’t change the pattern much. We will now try suppressing seasonality by grouping first by quarter then by year.
quarterly <- aggregate(Air.ts, nfrequency=4, FUN=sum)
plot(quarterly, bty="l")

The quarterly data looks very similar but a bit smoother.
yearly <- aggregate(Air.ts, nfrequency=1, FUN=sum)
plot(yearly, bty="l")

Here we can see that the seasonal adjustments are gone and the resulting graphs shows that the trend is upward exponential. One final plot will be a seasonal plot of the data for each year.
ggseasonplot(Air.ts)

This confirms the seasonality and that it’s additive.
(a) For the Air data, the time series components include level, noise, and thanks to the trend line we see that the trend is upward exponential. The fact that the seasonality seems be constant between different periods would mean that it is additive.
(b) After using the trend lines and suppressing the seasonality, we can see that the trend is upward exponential.
Rail Miles
First we plot the time series.
Rail.ts <- ts(Travel$Rail, start=c(1990,1), end=c(2001,8), freq=12)
plot(Rail.ts, xlab="Time", ylab="Rail Travellers", bty="l")

We will try fitting linear, quadratic, and cubic trend lines to see which has the strongest correlation.
RailLinear <- tslm(Rail.ts ~ trend)
summary(RailLinear)
##
## Call:
## tslm(formula = Rail.ts ~ trend)
##
## Residuals:
## Min 1Q Median 3Q Max
## -142225897 -40750574 -4370229 41272192 133135874
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 547632872 10511773 52.097 < 2e-16 ***
## trend -837744 129357 -6.476 1.53e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 61860000 on 138 degrees of freedom
## Multiple R-squared: 0.2331, Adjusted R-squared: 0.2275
## F-statistic: 41.94 on 1 and 138 DF, p-value: 1.532e-09
RailQuad <- tslm(Rail.ts ~ trend + I(trend^2))
summary(RailQuad)
##
## Call:
## tslm(formula = Rail.ts ~ trend + I(trend^2))
##
## Residuals:
## Min 1Q Median 3Q Max
## -137634923 -37327572 -1559409 41652351 125112936
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 576828666 15618390 36.93 < 2e-16 ***
## trend -2071369 511394 -4.05 8.52e-05 ***
## I(trend^2) 8749 3513 2.49 0.014 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 60720000 on 137 degrees of freedom
## Multiple R-squared: 0.2663, Adjusted R-squared: 0.2556
## F-statistic: 24.86 on 2 and 137 DF, p-value: 6.14e-10
RailCube <- tslm(Rail.ts ~ trend + I(trend^3))
summary(RailCube)
##
## Call:
## tslm(formula = Rail.ts ~ trend + I(trend^3))
##
## Residuals:
## Min 1Q Median 3Q Max
## -137779487 -36088332 -2979367 42425943 122227602
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.764e+08 1.366e+07 42.201 < 2e-16 ***
## trend -1.749e+06 3.147e+05 -5.559 1.37e-07 ***
## I(trend^3) 5.107e+01 1.617e+01 3.158 0.00195 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 59940000 on 137 degrees of freedom
## Multiple R-squared: 0.2851, Adjusted R-squared: 0.2747
## F-statistic: 27.32 on 2 and 137 DF, p-value: 1.035e-10
Looking at the data, the cubic trend appeared to be closest, and the r-squared value confirms this. This will be added to the plot.
plot(Rail.ts, xlab="Time", ylab="Rail Miles", bty="l")
lines(RailCube$fitted, lwd=2)

We will change the scale to be logarithmic to see how that effects the trend.
plot(Rail.ts, log="y", xlab="Time", ylab="Rail Miles (log scale)", bty="l")

Here we see no real change in the trend. Next we will group by quarter to remove some of the seasonality.
quarterly <- aggregate(Rail.ts, nfrequency=4, FUN=sum)
plot(quarterly, bty="l")

This plot looks closer to the cubic trend line. Lastly we will add a seasonal plot.
ggseasonplot(Rail.ts)

We can see the seasonality and the additive nature of the pattern.
(a)For this time series, there is level, noise, and third level polynomial trend. For seasonality, it looks like the values in each season stay constant, making the seasonality additive.
(b) After analyzing the trend data, we see this is a third level polynomial trend.
Vehicle Miles
Plot the time series
VMT.ts <- ts(Travel$VMT, start=c(1990,1), end=c(2001,8), freq=12)
plot(VMT.ts, xlab="Time", ylab="Auto Miles", bty="l")

This looks pretty upward linear as a trend, but we will compare linear, quadratic, and cubic trend lines to see which has the strongest correlation.
VMTLinear <- tslm(VMT.ts ~ trend)
summary(VMTLinear)
##
## Call:
## tslm(formula = VMT.ts ~ trend)
##
## Residuals:
## Min 1Q Median 3Q Max
## -32.554 -9.185 0.559 11.087 23.272
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 173.17137 2.42094 71.53 <2e-16 ***
## trend 0.44249 0.02979 14.85 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 14.25 on 138 degrees of freedom
## Multiple R-squared: 0.6152, Adjusted R-squared: 0.6124
## F-statistic: 220.6 on 1 and 138 DF, p-value: < 2.2e-16
VMTQuad <- tslm(VMT.ts ~ trend + I(trend^2))
summary(VMTQuad)
##
## Call:
## tslm(formula = VMT.ts ~ trend + I(trend^2))
##
## Residuals:
## Min 1Q Median 3Q Max
## -33.503 -8.745 0.798 10.974 23.752
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.745e+02 3.674e+00 47.487 < 2e-16 ***
## trend 3.867e-01 1.203e-01 3.214 0.00163 **
## I(trend^2) 3.956e-04 8.266e-04 0.479 0.63297
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 14.29 on 137 degrees of freedom
## Multiple R-squared: 0.6158, Adjusted R-squared: 0.6102
## F-statistic: 109.8 on 2 and 137 DF, p-value: < 2.2e-16
VMTCube <- tslm(VMT.ts ~ trend + I(trend^3))
summary(VMTCube)
##
## Call:
## tslm(formula = VMT.ts ~ trend + I(trend^3))
##
## Residuals:
## Min 1Q Median 3Q Max
## -33.632 -8.783 0.801 10.878 23.848
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.742e+02 3.255e+00 53.523 < 2e-16 ***
## trend 4.091e-01 7.500e-02 5.455 2.22e-07 ***
## I(trend^3) 1.869e-06 3.854e-06 0.485 0.629
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 14.29 on 137 degrees of freedom
## Multiple R-squared: 0.6158, Adjusted R-squared: 0.6102
## F-statistic: 109.8 on 2 and 137 DF, p-value: < 2.2e-16
The correlations are close, but the linear trend line has the best r-squared value. We’ll add the trend line to the plot.
plot(VMT.ts, xlab="Time", ylab="Auto Miles", bty="l")
lines(VMTLinear$fitted, lwd=2)

(a) Based on this plot, besides level and noise, the trend is upward linear and given that the values seem uniform between the seasons, it is additive seasonality.
We will change the y values to logarithmic to see how it changes the trend.
plot(VMT.ts, log="y", xlab="Time", ylab="Auto Miles (log scale)", bty="l")

The trend for auto miles appears to be the same. Next to see the seasonality we will group the data by quarter.
quarterly <- aggregate(VMT.ts, nfrequency=4, FUN=sum)
plot(quarterly, bty="l")

yearly <- aggregate(VMT.ts, nfrequency=1, FUN=sum)
plot(yearly, bty="l")

Removing the seasonality further points to the trend being upward linear. We will add a seasonal plot to confirm the pattern.
ggseasonplot(VMT.ts)

This plot confirms the additive nature of the seasonality.
(a)Based on this plot, besides level and noise, the trend is upward linear and given that the values seem uniform between the seasons, it is additive seasonality.
(b) Our work on supressing seasonality and using trend lines shows that the trend is upward linear.