---
title: "Time Series Homework: Chapter 2 Lesson 3"
subtitle: "Please_put_your_name_here"
format: 
  html:
    embed-resources: true
    toc: true
---

```{r, echo=FALSE, message=FALSE, warning=FALSE}

# Loading R packages
if (!require("pacman")) install.packages("pacman")
pacman::p_load(tidyverse, 
               tsibble, fable,
               feasts, tsibbledata,
               fable.prophet,
               patchwork,
               lubridate, 
               rio,
               ggplot2,
               kableExtra
               )
```

## Data

```{r, message=FALSE}

ind_prod <- rio::import("https://byuistats.github.io/timeseries/data/ind_prod_us.csv")

```

## Questions

### Question 1 - Context and Measurement (10 points)

The first part of any time series analysis is context. You cannot properly analyze data without knowing what the data is measuring. Without context, the most simple features of data can be obscure and inscrutable. This homework assignment will center around the series below.

Please research the time series. In the spaces below, give the data collection process, unit of analysis, and meaning of each observation for the series.

#### **Total US Industrial Production Index**

<https://fred.stlouisfed.org/series/IPB50001N>

::: {.callout-note title="Answer" icon="false"}
<!-- Delete this and put your answer here. The three colons mark the end of your answer. -->
:::

### Question 2 - Total US Industrial Production: Correlogram (20 points)

##### a) Please plot a correlogram of the US Industrial Production Index

::: {.callout-note title="Answer" icon="false"}
```{r}



```
:::

##### b) Please identify evidence of any trend or seasonal component using the correlogram. Please justify your findings.

::: {.callout-note title="Answer" icon="false"}
<!-- Delete this and put your answer here. The three colons mark the end of your answer. -->
:::

### Question 3 - Total US Industrial Production: Decomposition (10 points)

##### a) Please plot a decomposition of the US Industrial Production Index series. Include the original series, trend, seasonal variation, and random component.

::: {.callout-note title="Answer" icon="false"}
```{r}



```
:::

##### b) Justify your choice of decomposition model (additive vs multiplicative)

::: {.callout-note title="Answer" icon="false"}
```{r}



```
:::

### Question 4 - Total US Industrial Production: Stationary Series (20 points)

##### a) Please plot a correlogram of the random component of the US Industrial Production Index

::: {.callout-note title="Answer" icon="false"}
```{r}



```
:::

##### b) Please interpret the correlogram of the random component of the US Industrial Production Index. Include descriptions of the statistical and practical significance of the results. Be careful to justify the cases when a statistically significant correlation is not practically significant.

::: {.callout-note title="Answer" icon="false"}
<!-- Delete this and put your answer here. The three colons mark the end of your answer. -->
:::

### Question 5 - US Industrial Production Index: Introspection (20 points)

##### a) Why is it important to remove trend and seasonal variation before plotting and analyzing correlograms?

::: {.callout-note title="Answer" icon="false"}
<!-- Delete this and put your answer here. The three colons mark the end of your answer. -->
:::

##### b) Please speculate on the importance of autocorrelation analysis of the random component of time series data on its modeling and investigation?

::: {.callout-note title="Answer" icon="false"}
<!-- Delete this and put your answer here. The three colons mark the end of your answer. -->
:::

### Rubric

+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Criteria**                                     | **Mastery (10)**                                                                                                                                                                                                                                                                                                                                                                                         | **Incomplete (0)**                                                                                                                                                                                                                                                                                                                                                                                                                                    |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Question 1: Context and Measurement**          | The student thoroughly researches the data collection process, unit of analysis, and meaning of each observation for both the requested time series. Clear and comprehensive explanations are provided.                                                                                                                                                                                                  | The student does not adequately research or provide information on the data collection process, unit of analysis, and meaning of each observation for the specified series.                                                                                                                                                                                                                                                                           |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                  | **Mastery (5)**                                                                                                                                                                                                                                                                                                                                                                                          | **Incomplete (0)**                                                                                                                                                                                                                                                                                                                                                                                                                                    |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Question 2a: Correlogram**                     | The student plots a correlogram of the time series requested. The plot accurately displays autocorrelation values at various lags. If code is well-commented, providing clarity on the plotting process. The labels, title, and legends are appropriate and match the quality of the illustrations in the Time Series notebook.                                                                          | The student attempts to plot a correlogram of the time series requested but encounters significant errors or lacks clarity in their plot. If code is used, it may lack sufficient commenting or coherence, making it challenging to understand the plotting process. Overall, the plot may lack detail or accuracy, highlighting areas for improvement in time series visualization skills.                                                           |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                  | **Mastery (15)**                                                                                                                                                                                                                                                                                                                                                                                         | **Incomplete (0)**                                                                                                                                                                                                                                                                                                                                                                                                                                    |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Question 2b: Interpretation**                  | The student effectively interprets the correlogram to identify evidence of trend or seasonal components in the time series. Their description matches the textbook description in page 37.                                                                                                                                                                                                               | The student attempts to interpret the correlogram but encounters errors or lacks clarity in their analysis. There may be inaccuracies in interpreting autocorrelation values or misinterpretation of the findings, indicating a limited understanding of correlogram analysis techniques. Overall, the justification for findings may lack depth or accuracy.                                                                                         |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                  | **Mastery (5)**                                                                                                                                                                                                                                                                                                                                                                                          | **Incomplete (0)**                                                                                                                                                                                                                                                                                                                                                                                                                                    |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Question 3a: Decomposition**                   | The student plots a decomposition of the US Industrial Production Index series, including the original series, trend, seasonal variation, and random component. The code is well-commented, providing clarity on the decomposition process. The labels, title, and legends are appropriate and enhance the understanding of the plot, matching the quality of illustrations in the Time Series notebook. | The student attempts to plot a decomposition of the US Industrial Production Index series but encounters significant errors or lacks clarity in their plot. The code lacks sufficient commenting or coherence, making it challenging to understand the decomposition process. Overall, the plot may lack detail or accuracy.                                                                                                                          |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                  | **Mastery (5)**                                                                                                                                                                                                                                                                                                                                                                                          | **Incomplete (0)**                                                                                                                                                                                                                                                                                                                                                                                                                                    |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Question 3b: Modeling Justification**          | Provides a well-reasoned justification for choosing either the additive or multiplicative decomposition model, clearly explaining how the data's characteristics (e.g., seasonality, trend) influence the choice.	                                                                                                                                                                                        | Fails to provide a clear or logical justification, or the explanation is incorrect or unsupported by the data's characteristics.                                                                                                                                                                                                                                                                                                                      |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                  | **Mastery (5)**                                                                                                                                                                                                                                                                                                                                                                                          | **Incomplete (0)**                                                                                                                                                                                                                                                                                                                                                                                                                                    |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Question 4a: Correlogram of random component** | The student plots a correlogram of the time series requested. The plot accurately displays autocorrelation values at various lags. If code is well-commented, providing clarity on the plotting process. The labels, title, and legends are appropriate and match the quality of the illustrations in the Time Series notebook.                                                                          | The student attempts to plot a correlogram of the time series requested but encounters significant errors or lacks clarity in their plot. If code is used, it may lack sufficient commenting or coherence, making it challenging to understand the plotting process. Overall, the plot may lack detail or accuracy, highlighting areas for improvement in time series visualization skills.                                                           |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                  | **Mastery (15)**                                                                                                                                                                                                                                                                                                                                                                                         | **Incomplete (0)**                                                                                                                                                                                                                                                                                                                                                                                                                                    |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Question 4b: Interpretation**                  | Clearly interprets the correlogram, explaining the statistical significance of correlations and addressing practical significance. Provides well-reasoned justification for when statistically significant correlations are not practically important.	                                                                                                                                                   | Fails to interpret the correlogram accurately, does not explain statistical or practical significance clearly, or provides weak justification for distinguishing between statistical and practical significance.                                                                                                                                                                                                                                      |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                  | **Mastery (10)**                                                                                                                                                                                                                                                                                                                                                                                         | **Incomplete (0)**                                                                                                                                                                                                                                                                                                                                                                                                                                    |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Question 5a: Introspection**                   | The student explains the importance of removing trend and seasonal variation before analyzing correlograms, showing an understanding of stationarity assumptions in time series analysis. They recognize that trend and seasonality violate these assumptions, potentially distorting autocorrelation patterns.                                                                                          | The student attempts to explain the importance of removing trend and seasonal variation before analyzing correlograms but may struggle with clarity or accuracy. Their understanding of stationarity assumptions in time series analysis might be limited, leading to inconsistencies or inaccuracies. Overall, their explanation may lack depth, indicating areas for improvement in understanding preprocessing steps and stationarity assumptions. |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                  | **Mastery (10)**                                                                                                                                                                                                                                                                                                                                                                                         | **Incomplete (0)**                                                                                                                                                                                                                                                                                                                                                                                                                                    |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Question 5b: Introspection**                   | The student effectively speculates on the importance of autocorrelation analysis of the random component in time series data for modeling, investigation, and forecasting. Their discussion shows understanding of the topics we have already covered in class. The submission shows effort.                                                                                                             | Overall, their explanation may lack depth,\                                                                                                                                                                                                                                                                                                                                                                                                           |
|                                                  |                                                                                                                                                                                                                                                                                                                                                                                                          | or clarity.\                                                                                                                                                                                                                                                                                                                                                                                                                                          |
|                                                  |                                                                                                                                                                                                                                                                                                                                                                                                          | \                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|                                                  |                                                                                                                                                                                                                                                                                                                                                                                                          | \                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|                                                  |                                                                                                                                                                                                                                                                                                                                                                                                          | \                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|                                                  |                                                                                                                                                                                                                                                                                                                                                                                                          | \                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|                                                  |                                                                                                                                                                                                                                                                                                                                                                                                          | \                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Total Points**                                 | **80**                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
