Every problem in the chapter beside the book’s answer, a chapter at a time as you scroll.

Chapter 5: Time Series and Forecasting

6 problems · 0 figures

Quantitative Problem 5.1 §5.2 source ↗

A U.S. company located in New Hampshire records weekly sales of its main product for a period of 3 years. If a seasonal variation in sales exists, what would be the most likely period of the seasonal variation?

Answer

Most likely, the period would be 52, as sales probably go through a cycle each year, and there are 52 weeks in the year.

Quantitative Problem 5.2 §5.3 source ↗

Consider the time series given in the table as shown.
a.
Identify the period of the seasonal component.
b.
Using a centered simple moving average (SMA) of window size equal to the period you found in part a, identify a trend-cycle component, t n , in the data.
c.
Detrend the data by subtracting the SMA you found in part b.
d.
Identify the seasonal component, s ^ n , using the method of averaging.
e.
Find the seasonally adjusted time series.
Table 5.9 in the book ↗
Month Value
1 880.7
2 727.2
3 798.5
4 504.1
5 888.4
6 725.8
7 793.4
8 499.0
9 891.7
10 722.0
11 789.1
12 501.6
Time Series

Answer (5 parts)

a.
There are peaks in the data at times 1, 5, and 9 as well as minimum points at times 4, 8, and 12, suggesting a period of 4 months.
b.
(728.6, 729.4, 728.6, 727.3, 727.1, 727.0, 726.0, 725.8)
There will be 8 terms in the centered SMA, as shown. These values form the trend-cycle component.
c.
(69.9, −225.3, 159.8, −1.5, 66.3, −228.0, 165.7, −3.8)
d.
(68.1, −226.65, 162.75, −2.65), repeating in blocks of 4
e.
(812.6, 953.85, 635.75, 506.75, 820.3, 952.45, 630.65, 501.65, 823.6, 948.65, 626.35, 504.25)

Quantitative Problem 5.3 §5.3 source ↗

In Collecting and Preparing Data, the following data was given, as provided in the table, showing daily new cases of COVID-19. Since new cases were not reported on Saturdays and Sundays, those weekend cases were added to the Monday cases. One way to deal with the missing data is to use a centered simple moving average to smooth the time series.
a.
What is the most appropriate window size to use for centered SMA to address the issue of missing data in their analysis of COVID-19 data from the CDC?
b.
Perform the SMA and illustrate the results by a graph.
Table 5.10 in the book ↗
Date Weekday New Case
10/18/2021 Monday 3115
10/19/2021 Tuesday 4849
10/20/2021 Wednesday 3940
10/21/2021 Thursday 4821
10/22/2021 Friday 4357
10/23/2021 Saturday 0
10/24/2021 Sunday 0
10/25/2021 Monday 8572
10/26/2021 Tuesday 4463
10/27/2021 Wednesday 5323
10/28/2021 Thursday 5012
10/29/2021 Friday 4710
10/30/2021 Saturday 0
10/31/2021 Sunday 0
11/1/2021 Monday 10415
11/2/2021 Tuesday 5096
11/3/2021 Wednesday 6882
11/4/2021 Thursday 5400
11/5/2021 Friday 6759
11/6/2021 Saturday 0
11/7/2021 Sunday 0
11/8/2021 Monday 10069
11/9/2021 Tuesday 5297
Sample of COVID-19 Data Cases within 23 Days (source: https://data.cdc.gov/Case-Surveillance)

Answer (2 parts)

a.
Since the missing data is due to different reporting policies on different days of the week, an SMA window of 7 days is most appropriate.
b.
No published answer: OpenStax gives this part only in the instructor’s Solution Manual.

Quantitative Problem 5.4 §5.3 source ↗

Consider the data set USATemps1961-2023.csv.
a.
Use an ACF plot to determine the period of a potential seasonal component.
b.
Use STL to decompose the time series into trend-cycle, seasonal, and noise components.

Answer (2 parts)

a.
Period = 3 from the ACF plot.
b.
No published answer: OpenStax gives this part only in the instructor’s Solution Manual.

Quantitative Problem 5.5 §5.3 source ↗

Use the recursive EMA formula with α = 0.6 to smooth the time series found in USATemps1961-2023.csv, and then use the EMA model to forecast the next value of the series.

Answer

Forecasted value for 2024: 1.2124

Quantitative Problem 5.6 §5.4 source ↗

A very small time series is given in the table, along with a model.
a.
Find error measures MAE, RMSE, MAPE, and sMAPE for the model.
b.
Which of the error measures are scale-dependent? What would this imply about a similar time series and model in which all values are multiplied by 10?
Table 5.12 in the book ↗
x n x ^ n
122 117
108 135
172 152
190 169
167 186
Time Series

Answer (2 parts)

a.
MAE = 421.6 . RMSE = 313 , 168.55 = 559.6 . MAPE = 0.123 , or 12.3%. sMAPE = .0133 , or 13.3%.
b.
No published answer: OpenStax gives this part only in the instructor’s Solution Manual.

Loading chapter 6…

Problems and answers are adapted from Principles of Data Science by Shaun V. Ault, Soohyun Nam Liao and Larry Musolino, OpenStax, and are used under the CC BY-NC-SA 4.0 licence. Access for free at https://openstax.org/books/principles-data-science/pages/1-introduction. Illustrations: Copyright Rice University, OpenStax, under CC BY-NC-SA 4.0 license. This adaptation is released under the same licence, is non-commercial, and is neither affiliated with nor endorsed by OpenStax or Rice University.