3.8 Exercises

  1. Consider the GDP information in global_economy. Plot the GDP per capita for each country over time. Which country has the highest GDP per capita? How has this changed over time?

  2. For each of the following series, make a graph of the data. If transforming seems appropriate, do so and describe the effect.

    • United States GDP from global_economy
    • Slaughter of Victorian “Bulls, bullocks and steers” in aus_livestock
    • Victorian Electricity Demand from vic_elec.
    • Gas production from aus_production
  3. Why is a Box-Cox transformation unhelpful for the canadian_gas data?

  4. What Box-Cox transformation would you select for your retail data (from Exercise 6 in Section 2.10)?

  5. For the following series, find an appropriate Box-Cox transformation in order to stabilise the variance. Tobacco from aus_production, Economy class passengers between Melbourne and Sydney from ansett, and Pedestrian counts at Southern Cross Station from pedestrian.

  6. Show that a \(3\times5\) MA is equivalent to a 7-term weighted moving average with weights of 0.067, 0.133, 0.200, 0.200, 0.200, 0.133, and 0.067.

  7. The fma::plastics data set consists of the monthly sales (in thousands) of product A for a plastics manufacturer for five years.
    1. Plot the time series of sales of product A. Can you identify seasonal fluctuations and/or a trend-cycle?
    2. Use a classical multiplicative decomposition to calculate the trend-cycle and seasonal indices.
    3. Do the results support the graphical interpretation from part a?
    4. Compute and plot the seasonally adjusted data.
    5. Change one observation to be an outlier (e.g., add 500 to one observation), and recompute the seasonally adjusted data. What is the effect of the outlier?
    6. Does it make any difference if the outlier is near the end rather than in the middle of the time series?
  8. Recall your retail time series data (from Exercise 6 in Section 2.10). Decompose the series using X11. Does it reveal any outliers, or unusual features that you had not noticed previously?

  9. Figures 3.16 and 3.17 show the result of decomposing the number of persons in the civilian labour force in Australia each month from February 1978 to August 1995.

    #> Registered S3 method overwritten by 'quantmod':
    #>   method            from
    #>   as.zoo.data.frame zoo
    Decomposition of the number of persons in the civilian labour force in Australia each month from February 1978 to August 1995.

    Figure 3.16: Decomposition of the number of persons in the civilian labour force in Australia each month from February 1978 to August 1995.

    Seasonal component from the decomposition shown in the previous figure.

    Figure 3.17: Seasonal component from the decomposition shown in the previous figure.

    1. Write about 3–5 sentences describing the results of the decomposition. Pay particular attention to the scales of the graphs in making your interpretation.
    2. Is the recession of 1991/1992 visible in the estimated components?
  10. This exercise uses the canadian_gas data (monthly Canadian gas production in billions of cubic metres, January 1960 – February 2005).
    1. Plot the data using autoplot(), gg_subseries() and gg_season() to look at the effect of the changing seasonality over time. What do you think is causing it to change so much?1
    2. Do an STL decomposition of the data. You will need to choose a seasonal window to allow for the changing shape of the seasonal component.
    3. How does the seasonal shape change over time? [Hint: Try plotting the seasonal component using gg_season().]
    4. Can you produce a plausible seasonally adjusted series?
    5. Compare the results with those obtained using SEATS and X11. How are they different?

  1. This is possibly due to changes in the regulation of gas prices — thanks to Lewis Kirvan for pointing this out.