├── .gitignore ├── _images ├── acfguess-1.png └── quarto_chunk_output.png ├── _data ├── cleaned │ ├── ccharts.rds │ ├── sgcpi.rds │ ├── diabetes.rds │ ├── globtemp.rds │ ├── sg-births.rds │ ├── sunspots.rds │ ├── beijing_pm25.rds │ └── GOOG.csv └── raw │ └── metadata.txt ├── assignments ├── assignment1.pdf ├── assignment2.pdf ├── assignment3.pdf ├── assignment4.pdf ├── assignment5.pdf ├── assignment3.qmd ├── assignment1.qmd ├── assignment4.qmd ├── assignment5.qmd └── assignment2.qmd ├── demonstrations ├── causal_ar2.png ├── week9-questions.qmd ├── week8-questions.qmd ├── week6-questions.qmd ├── week5-questions.qmd ├── week3-questions.qmd ├── week4-questions.qmd ├── week2.qmd ├── week1.qmd ├── week8.qmd ├── week7-questions.qmd ├── week6.qmd ├── week9.qmd ├── week4.qmd ├── week3.qmd ├── week7.qmd └── week5.qmd ├── _code ├── plot_util.R └── clean_data.R └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .Rproj.user 3 | *.Rproj 4 | *.Rhistory 5 | *.html 6 | *_files/ -------------------------------------------------------------------------------- /_images/acfguess-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/_images/acfguess-1.png -------------------------------------------------------------------------------- /_data/cleaned/ccharts.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/_data/cleaned/ccharts.rds -------------------------------------------------------------------------------- /_data/cleaned/sgcpi.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/_data/cleaned/sgcpi.rds -------------------------------------------------------------------------------- /_data/cleaned/diabetes.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/_data/cleaned/diabetes.rds -------------------------------------------------------------------------------- /_data/cleaned/globtemp.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/_data/cleaned/globtemp.rds -------------------------------------------------------------------------------- /_data/cleaned/sg-births.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/_data/cleaned/sg-births.rds -------------------------------------------------------------------------------- /_data/cleaned/sunspots.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/_data/cleaned/sunspots.rds -------------------------------------------------------------------------------- /assignments/assignment1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/assignments/assignment1.pdf -------------------------------------------------------------------------------- /assignments/assignment2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/assignments/assignment2.pdf -------------------------------------------------------------------------------- /assignments/assignment3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/assignments/assignment3.pdf -------------------------------------------------------------------------------- /assignments/assignment4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/assignments/assignment4.pdf -------------------------------------------------------------------------------- /assignments/assignment5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/assignments/assignment5.pdf -------------------------------------------------------------------------------- /_data/cleaned/beijing_pm25.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/_data/cleaned/beijing_pm25.rds -------------------------------------------------------------------------------- /demonstrations/causal_ar2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/demonstrations/causal_ar2.png -------------------------------------------------------------------------------- /_images/quarto_chunk_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanshuotan/st5209-2024/HEAD/_images/quarto_chunk_output.png -------------------------------------------------------------------------------- /_data/raw/metadata.txt: -------------------------------------------------------------------------------- 1 | 1. Google Stock information 2 | filename: GOOG.csv 3 | summary: stock price and volume over 5 year period ending 1 Jan 2024. 4 | source: https://finance.yahoo.com/quote/GOOG/, 5 | 6 | # 7 | 8 | 2. ECG data 9 | filename: ecg.csv 10 | source: https://www.timeseriesclassification.com/description.php?Dataset=ECG5000 11 | post process: save ECG5000_TRAIN.txt as ecg.csv -------------------------------------------------------------------------------- /_code/plot_util.R: -------------------------------------------------------------------------------- 1 | require(rlang) 2 | 3 | gg_custom_season <- function(data, y, period, start = 1) { 4 | # Make a seasonal plot with period specified in integer 5 | # start argument specifies the row number that will be the first season 6 | # in the period 7 | y <- enquo(y) 8 | data |> 9 | mutate(Season = (row_number() - start) %% period + start, 10 | Iteration = as.factor((row_number() - start) %/% period + 1)) |> 11 | ggplot(aes(x = Season, y = !!y, color = Iteration)) + 12 | geom_line() 13 | } 14 | -------------------------------------------------------------------------------- /demonstrations/week9-questions.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 9 Demonstration" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | ```{r} 10 | #| message: FALSE 11 | library(fpp3) 12 | library(tidyverse) 13 | library(slider) 14 | library(gridExtra) 15 | ``` 16 | 17 | ## 1. Sample trajectories 18 | 19 | Read Chapter 10.8 of the course notes. 20 | 21 | a. Sample a time series from a causal AR(2) model of length 50. You may choose your favorite parameters. 22 | b. In R, how can you choose different methods of estimators for fitting the model parameters? 23 | 24 | ## 2. AR(1) 25 | 26 | In Chapter 10.3 of the course notes, we showed how to compute forecasts and estimate model parameters for AR(1). 27 | 28 | a. Show directly that the AR(1) forecast is a best linear predictor. 29 | 30 | b. Show that the estimator we introduced was a method of moments estimator. 31 | 32 | c. What is the conditional maximum likelihood estimate for AR(1)? 33 | 34 | ## 3. Limiting forecast distribution 35 | 36 | What does the forecast distribution for AR(p) models converge to as $n \to \infty$? 37 | 38 | ## 4. Difference between estimators 39 | 40 | a. For AR(1), compute the difference between the mean estimators from the method of moments and conditional least squares approaches. 41 | b. How does the difference change as $n \to \infty$? 42 | 43 | ## 5. Nonlinear autoregressive models 44 | 45 | Fit a nonlinear AR model on the `globtemp` dataset. Compute its sum of squared residuals and compare it to that of a linear AR model. 46 | -------------------------------------------------------------------------------- /demonstrations/week8-questions.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 8 Demonstration" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | ```{r} 10 | #| message: FALSE 11 | library(fpp3) 12 | library(tidyverse) 13 | library(slider) 14 | library(gridExtra) 15 | ``` 16 | 17 | ## 1. AR(2) 18 | 19 | Consider the AR(2) equation $$ 20 | X_t = 1.5 X_{t-1} - 0.75 X_{t-2} + W_t. 21 | $$ 22 | 23 | a. What is the autoregressive polynomial? 24 | 25 | b. What are its roots? 26 | 27 | c. What patterns does its ACF exhibit? 28 | 29 | d. Compute the general form of its ACF. 30 | 31 | e. Confirm d) using `ARMAacf()`. 32 | 33 | f. What times series pattern does this correspond to? 34 | 35 | g. Confirm this by simulating from this time series model. 36 | 37 | ## 2. AR(2) Part 2 38 | 39 | Consider the AR(2) equation $$ 40 | X_t = \phi_1 X_{t-1} + \phi_2 X_{t-2} + W_t. 41 | $$ 42 | 43 | a. Under what conditions on $\phi_1$ and $\phi_2$ is the model causal? 44 | b. Under what conditions on $\phi_1$ and $\phi_2$ does the ACF have periodic behavior? 45 | c. The conditions on a) are equivalent to $$ 46 | \phi_1 + \phi_2 < 1, \quad \phi_2 - \phi_1 < 1, \quad |\phi_2| < 1. 47 | $$ What region in 2D does this correspond to? 48 | 49 | ## 3. Linear process coefficients. 50 | 51 | Given an AR(p) model $$ 52 | X_t = \sum_{j=0}^\infty \psi_j W_{t-j}, 53 | $$ write the coefficients in terms of the parameters $\phi_1,\phi_2,\ldots,\phi_p$. 54 | 55 | ## 4. AR(1) ACF 56 | 57 | Verify the formula for the ACVF and ACF of AR(1). 58 | 59 | ## 5. AR(p) theorems 60 | 61 | Understand the proofs of the theorems. 62 | -------------------------------------------------------------------------------- /demonstrations/week6-questions.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 6 Demonstration" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | ```{r} 10 | #| message: FALSE 11 | library(fpp3) 12 | library(tidyverse) 13 | library(slider) 14 | library(gridExtra) 15 | ``` 16 | 17 | ## 1. ACVF, ACF, and stationarity 18 | 19 | Consider the time series defined as $$ 20 | X_t = U_1 \sin(2\pi \omega t) + U_2\cos(2\pi\omega t), 21 | $$ where $U_1$ and $U_2$ are independent random variables with zero mean and variance 1. 22 | 23 | a. Compute the ACVF of $(X_t)$. 24 | b. Is $(X_t)$ weakly stationary? 25 | c. Is $(X_t)$ strictly stationary? If not, what conditions can we put on $U_1$ and $U_2$ to make it stationary? 26 | 27 | ## 2. ACF vs sample ACF 28 | 29 | Consider the linear trend model $$ 30 | X_t = \beta_0 + \beta_1 t + W_t. 31 | $$ 32 | 33 | a. Compute the ACF of $(X_t)$. 34 | b. Simulate a time series drawn from this model and plot its sample ACF. 35 | c. Why does the sample ACF not look like the population ACF function? 36 | d. Why does the asymptotic normality theorem for the ACF not apply? 37 | 38 | ## 3. Forecasting 39 | 40 | Let $(X_t)$ be a zero mean stationary process with $\rho_X(h) \neq 0$ for some $h$ 41 | 42 | a. Find $A$ minimizing $\mathbb{E}\lbrace (X_{n+h} - A X_n)^2 \rbrace$. 43 | b. Use this to make a forecast for $X_{n+h}$ given $X_1,\ldots,X_n$. 44 | c. What is the MSE for the forecast? 45 | d. What is the consequence of this for ACF values? 46 | 47 | ## 4. Residual analysis 48 | 49 | a. What is the difference between innovation residuals and regular residuals? Why do we perform residual analysis on the former rather than the latter? 50 | b. Starting with the following code snippet, fit several models to the Australian takeaway turnover time series and analyze their residuals. Which models have a good fit? Compare this with their CV error. 51 | 52 | ```{r} 53 | takeaway <- aus_retail |> 54 | filter(Industry == "Takeaway food services") |> 55 | summarise(Turnover = sum(Turnover)) 56 | ``` 57 | -------------------------------------------------------------------------------- /demonstrations/week5-questions.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 5 Demonstration" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | ```{r} 10 | #| message: FALSE 11 | library(fpp3) 12 | library(tidyverse) 13 | library(slider) 14 | library(gridExtra) 15 | library(broom) 16 | ``` 17 | 18 | ## 1. Train test split 19 | 20 | ```{r} 21 | takeaway <- aus_retail |> 22 | filter(Industry == "Takeaway food services") |> 23 | summarise(Turnover = sum(Turnover)) 24 | ``` 25 | 26 | a. Starting with the above snippet, create a training set for Australian takeaway food turnover (`aus_retail`) by withholding the last four years as a test set. 27 | 28 | b. Fit all the appropriate benchmark methods to the training set and forecast the periods covered by the test set. 29 | 30 | c. Compute the accuracy of your forecasts. Which method does best? 31 | 32 | d. Make a time plot of the forecasts to verify this. 33 | 34 | e. Which error metrics are preferred and why? How to interpret them? 35 | 36 | f. If RMSSE or MASE are larger than 1, does it mean that the forecast method is worse than the naive method? 37 | 38 | g. What is a problem with doing a train test split? 39 | 40 | ## 2. Cross-validation 41 | 42 | a. Perform cross-validation for Australian takeaway food turnover with $h=4$. 43 | 44 | b. Why is the error smaller compared to a single train-test split? 45 | 46 | c. Why might we want to set `.step` to a larger value? What goes wrong if we set it to be too large a value? 47 | 48 | d. If we are mostly interested in forecast accuracy 4 months ahead, how should we change the code to focus on this task? How do these errors compare to before? 49 | 50 | ## 3. Holt linear method and transformations 51 | 52 | Forecast the Chinese GDP from the `global_economy` data set using the Holt linear trend method. Experiment with damping and Box-Cox transformations. Try to develop an intuition of what each is doing to the forecasts. 53 | 54 | ## 4. Comparing exponential smoothing methods 55 | 56 | Fit ETS models to the following datasets. 57 | 58 | - `globtemp` 59 | - `fma::sheep` 60 | - `diabetes` 61 | - `gafa_stock` 62 | - `pelt` 63 | 64 | a. What happens when no formula is provided to `ETS`? 65 | 66 | b. When are multiplicative errors chosen? 67 | 68 | c. How can we identify the model coefficients? 69 | -------------------------------------------------------------------------------- /demonstrations/week3-questions.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 3 Demonstration" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | ```{r} 10 | #| message: FALSE 11 | library(fpp3) 12 | library(tidyverse) 13 | library(slider) 14 | ``` 15 | 16 | ## Computing classical decomposition 17 | 18 | Compute a classical decomposition for the following time series without using the `classical_decomposition()` function. 19 | 20 | ```{r} 21 | aus_arrivals_jap <- aus_arrivals |> 22 | filter(Origin == "Japan") |> 23 | select(Quarter, Arrivals) 24 | ``` 25 | 26 | ## Classical vs STL decomposition 27 | 28 | Start with the following code snippet creating a time series of passengers flying on Ansett Airlines. Perform classical and STL decompositions and comment on their differences. Which do you trust more? 29 | 30 | ```{r} 31 | melsyd_economy <- ansett |> 32 | filter(Airports == "MEL-SYD", Class == "Economy") |> 33 | mutate(Passengers = Passengers/1000) 34 | autoplot(melsyd_economy, Passengers) + 35 | labs(y = "Passengers ('000)") 36 | ``` 37 | 38 | ## White noise and ACF plots 39 | 40 | Create a time series of length 200 comprising i.i.d. standard Gaussian measurements. Make a time plot of the time series as well as an ACF plot. Compare this with the remainder term from an STL decomposition of `aus_arrivals_jap`. What do you observe? 41 | 42 | ## Summary statistics 43 | 44 | Glance through the summary statistics described in [Chapter 4.4](https://otexts.com/fpp3/other-features.html) of Hyndman and Athanasopoulos (2021). What do the following summary statistics compute? 45 | 46 | - Strength of trend 47 | - Strength of seasonality 48 | - `shift_level_max` 49 | - `shift_level_index` 50 | - `var_tiled_var` 51 | 52 | When would they be useful? 53 | 54 | ## EDA with summary statistics 55 | 56 | The follow code snippet generates summary statistics for the various time series in the `tourism` dataset. 57 | 58 | ```{r} 59 | #| eval: FALSE 60 | tourism_features <- tourism |> 61 | features(Trips, feature_set(pkgs = "feasts")) 62 | ``` 63 | 64 | Make a scatter plot of seasonal strength against trend strength and color the points according to `Purpose`. What can you tell from the plot? 65 | 66 | Perform PCA on the `tourism_features` dataframe and make a scatter plot of the first two PCs. What do you observe? 67 | 68 | ## Time series clustering using summary statistics 69 | 70 | Use summary statistics to create a model for classifying the time series in this [dataset](https://kdd.ics.uci.edu/databases/synthetic_control/synthetic_control.html). 71 | -------------------------------------------------------------------------------- /demonstrations/week4-questions.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 4 Demonstration" 3 | format: html 4 | editor: visual 5 | markdown: 6 | wrap: 72 7 | --- 8 | 9 | ## Set up 10 | 11 | ```{r} 12 | #| message: FALSE 13 | library(fpp3) 14 | library(tidyverse) 15 | library(slider) 16 | library(gridExtra) 17 | library(broom) 18 | ``` 19 | 20 | ## 1. Simple forecasting strategies and statistical models 21 | 22 | ### Mean method 23 | 24 | Show that the mean method is derived from the statistical model shown in the video, i.e. $$ 25 | x_t = \theta + \epsilon_t 26 | $$ with $\epsilon_1,\epsilon_2,\ldots,\epsilon_n \sim_{i.i.d.} \mathcal{N}(0,\sigma^2)$. 27 | 28 | ### Naive method 29 | 30 | Show that the naive method is derived from the statistical model shown in the video, i.e. $$ 31 | x_t = x_{t-1} + \epsilon_t 32 | $$ with $\epsilon_1,\epsilon_2,\ldots,\epsilon_n \sim_{i.i.d.} \mathcal{N}(0,\sigma^2)$. 33 | 34 | ### Seasonal naive method 35 | 36 | What is the statistical model associated with the seasonal naive method? 37 | 38 | ### Linear trend method 39 | 40 | What is the statistical model for the linear trend method? 41 | 42 | ### Drift method 43 | 44 | Consider the statistical model $$ 45 | x_t = \theta + x_{t-1} + \epsilon_t. 46 | $$ This is a random walk with drift $\theta$. What is the conditional distribution $p_\theta(x_t|x_{t-1})$? What is maximum likelihood estimate for $\theta$? If we use this for forecasting, what is the formula for the $h$-step ahead forecast? 47 | 48 | ## 2. Drift vs linear trend method 49 | 50 | The drift method can be fit using the code `RW(y ~ drift())`. Starting with the following code snippet, compute forecasts using the drift method and the linear trend method for the population of Australia for the next 50 years . 51 | 52 | ```{r} 53 | global_economy |> filter(Country == "Australia") 54 | ``` 55 | 56 | Which forecast looks better? Which prediction intervals are more realistic? 57 | 58 | Can you explain the connection between this and the statistical modeling assumptions? 59 | 60 | ## 3. Seasonal naive method with drift 61 | 62 | We have learnt one way to model both linear trend and seasonality by using time series decomposition. Here, we introduce another method. 63 | 64 | Think of a modification of the seasonal naive model to incorporate drift. What is the statistical model? What is the forecast equation? 65 | 66 | The method can be fit using the code `SNAIVE(y ~ drift())`. 67 | 68 | ## 4. Forecasting 69 | 70 | Which of `NAIVE`, `SNAIVE`, `NAIVE(y ~ drift())` and `SNAIVE(y ~ drift())` are most appropriate for the following datasets? 71 | 72 | - Bricks (`aus_production`) 73 | 74 | - Household wealth (`hh_budget`) 75 | 76 | ## 5. Prediction intervals 77 | 78 | Consider the `aus_arrivals` dataset. Filter the time series of arrivals from Japan to before 1995, and fit `NAIVE`, `SNAIVE`, `NAIVE(y ~ drift())` and `SNAIVE(y ~ drift())` . Use the fitted models to forecast the rest of the time series. Do their prediction intervals contain the truth? 79 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NUS ST5209/X in Semester II 2023/2024 2 | 3 | ## Instructor 4 | **Name**: Tan Yan Shuo 5 | 6 | **Email**: yanshuo@nus.edu.sg 7 | 8 | **Office**: S16 06-112 9 | 10 | 11 | ## Course Description 12 | This course provides an introduction to the analysis of time series data. Time series data is encountered in various fields such as finance, economics, engineering, and environmental sciences. The course covers fundamental concepts, techniques, and models for analyzing and forecasting time series data. 13 | 14 | ## Course Format and Meeting Times 15 | This course will have a [blended learning](https://cit.nus.edu.sg/blended-learning-2-0-2/) format, which means that half the weekly lecture content will be delivered via online lecture videos. 16 | Students are expected to have viewed and understood the lecture video before coming for in-person class. 17 | 18 | **Section 1**: Thursdays 7-8:30pm, LT28 19 | 20 | 21 | **Section 2**: Tuesdays 7-8:30pm, LT28 22 | 23 | ## Course Outline 24 | 1. Introduction to Time Series Analysis 25 | - Definition and characteristics of time series data 26 | - Time series components: trend, seasonality, and noise 27 | - Time series visualization and exploratory data analysis 28 | 29 | 2. Time Series Decomposition 30 | - Trend estimation and removal 31 | - Seasonal adjustment techniques 32 | - Residual analysis 33 | 34 | 3. Time Series Forecasting and Modeling 35 | - Exponential Smoothing 36 | - Autoregressive Integrated Moving Average (ARIMA) models 37 | - Seasonal ARIMA (SARIMA) models 38 | 39 | 4. Model Evaluation and Selection 40 | - Model diagnostics and residual analysis 41 | - Model selection criteria: AIC, BIC, and cross-validation 42 | - Forecast accuracy measures 43 | 44 | 5. Advanced Topics in Time Series Analysis 45 | - State space models 46 | - Nonlinear time series models 47 | - Multivariate time series analysis 48 | - Time series regression models 49 | 50 | ## Assessment 51 | - Assignments: 40% 52 | - Midterm Exam: 25% 53 | - Final Exam: 35% 54 | 55 | ## Assignment Policy 56 | - There will be assignments due once every two weeks 57 | - Assignments are due 23.59 on Mondays two weeks after they are uploaded 58 | - No late sumbmissions will be accepted 59 | - The lowest scoring assignment will be dropped 60 | 61 | ## Midterm Exam 62 | - The midterm exam will be take home and open book. It will be released at noon on 8 March 2024 (Friday) and due at noon on 15 March 2024 (Friday). 63 | 64 | ## Final Exam 65 | - The final exam will take place on 30 April 2024, 5-7pm at MPSH 6. It will be closed book, but you are allowed one doubled-sided A4-sized help sheet. 66 | 67 | ## Prerequisites 68 | - Basic knowledge of statistics, probability, and linear algebra 69 | - Familiarity with R and Python programming 70 | 71 | ## References 72 | - Class notes/textbook: https://yanshuo.quarto.pub/nus-ts-book 73 | - Hyndman, R.J., & Athanasopoulos, G. (2021) Forecasting: principles and practice, 3rd edition, OTexts: Melbourne, Australia. OTexts.com/fpp3 74 | - Shumway, R. H., & Stoffer, D. S. (2017). Time Series Analysis and Its Applications (4th ed.). Springer. -------------------------------------------------------------------------------- /assignments/assignment3.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "ST5209/X Assignment 3" 3 | format: pdf 4 | editor: visual 5 | author: "Due 4 Mar, 11.59pm" 6 | --- 7 | 8 | ## Set up 9 | 10 | 1. Make sure you have the following installed on your system: $\text{\LaTeX}$, R4.2.2+, RStudio 2023.12+, and Quarto 1.3.450+. 11 | 2. Pull changes from the course [repo](https://github.com/yanshuotan/st5209-2024). 12 | 3. Create a separate folder in the root directory of the repo, label it with your name, e.g. `yanshuo-assignments` 13 | 4. Copy the assignment1.qmd file over to this directory. 14 | 5. Modify the duplicated document with your solutions, writing all R code as code chunks. 15 | 6. When running code, make sure your working directory is set to be the folder with your assignment .qmd file, e.g. `yanshuo-assignments`. This is to ensure that all file paths are valid.[^1] 16 | 17 | [^1]: You may view and set the working directory using `getwd()` and `setwd()`. 18 | 19 | ## Submission 20 | 21 | 1. Render the document to get a .pdf printout. 22 | 2. Submit both the .qmd and .pdf files to Canvas. 23 | 24 | ```{r} 25 | #| message: FALSE 26 | #| echo: FALSE 27 | library(tidyverse) 28 | library(fpp3) 29 | ``` 30 | 31 | ## 1. Holt-Winters, residuals, and forecast accuracy 32 | 33 | Consider the antidiabetic drug sales time series which can be loaded using the following code snippet. 34 | 35 | ```{r} 36 | diabetes <- read_rds("../_data/cleaned/diabetes.rds") |> 37 | select(TotalC) 38 | ``` 39 | 40 | a. Fit the following exponential smoothing models on the entire time series: 41 | - Holt-Winters with multiplicative noise and seasonality, 42 | - Holt-Winters with a log transformation, with additive noise and seasonality, 43 | - Holt-Winters with multiplicative noise and seasonality, and damping. 44 | b. Make ACF plots for the innovation residuals of these three models. What can you say about stationarity of the residuals from the plot? 45 | c. Calculate the p-value from a Ljung-Box test on the residuals with lag $h=8$. What can you say about the stationarity of the residuals from the p-value? What does this mean about the model? 46 | d. Perform time series cross-validation for the three methods, using `.init = 50` and `.step = 10`, and with the forecast horizon $h=4$. Which method has the best RMSSE? How many data points is the error averaged over in total? 47 | 48 | ## 2. Moving averages and differences 49 | 50 | Consider the linear trend model $$ 51 | X_t = \beta_0 + \beta_1 t + W_t. 52 | $$ Define a time series $(Y_t)$ by taking a moving average of $(X_t)$ with a symmetric window of size 7. Define another times series $(Z_t)$ by taking a difference of $(X_t)$. 53 | 54 | a. What is the mean function for $(Y_t)$? What is the ACVF for $(Y_t)$? 55 | b. What is the mean function for $(Z_t)$? What is its ACVF? 56 | c. What is the CCF of $(Y_t)$ and $(Z_t)$? 57 | d. Are $(Y_t)$ and $(Z_t)$ jointly stationary? 58 | 59 | ## 3. Sample vs population ACF 60 | 61 | Consider the signal plus noise model $$ 62 | X_t = \sin(2\pi t/5) + W_t. 63 | $$ 64 | 65 | a. What is the ACF of $(X_t)$? 66 | b. Simulate a time series $X_1,X_2,\ldots,X_{200}$ from this model and plot its sample ACF. 67 | c. Why does the sample ACF not look like the population ACF function? 68 | d. Why does the asymptotic normality theorem for the ACF not apply? 69 | -------------------------------------------------------------------------------- /_code/clean_data.R: -------------------------------------------------------------------------------- 1 | require(tidyverse) 2 | require(fpp3) 3 | 4 | RAW_DIR <- "../_data/raw/" 5 | CLEANED_DIR <- "../_data/cleaned/" 6 | 7 | process_sgcpi <- function(save = FALSE) { 8 | # Return cleaned dataset for SG CPI data. 9 | sgcpi <- read_csv(str_c(RAW_DIR, "sg-cpi.csv"), skip = 10, n_max = 152) 10 | col_names <- sgcpi$`Data Series` 11 | time_index <- colnames(sgcpi)[-1] 12 | sgcpi <- sgcpi |> 13 | select(-`Data Series`) |> 14 | t() |> 15 | as_tibble() 16 | colnames(sgcpi) <- col_names 17 | selected_cols <- c("All Items", "Food", "Clothing & Footwear", "Health Care", 18 | "Transport", "Education") 19 | sgcpi <- sgcpi |> 20 | select(all_of(selected_cols)) |> 21 | mutate_all(as.double) |> 22 | mutate(Month = yearmonth(time_index)) 23 | sgcpi <- sgcpi |> 24 | as_tsibble() |> 25 | pivot_longer(cols = all_of(selected_cols), names_to = c("Type")) 26 | if (save) { 27 | saveRDS(sgcpi, file = str_c(CLEANED_DIR, "sgcpi.rds")) 28 | } 29 | sgcpi 30 | } 31 | 32 | process_diabetes <- function(save = FALSE) { 33 | # Return diabetes drug sales in Australia 34 | diabetes <- PBS |> 35 | filter(ATC2 == "A10") |> 36 | select(Month, Concession, Type, Cost) |> 37 | summarise(TotalC = sum(Cost)) |> 38 | mutate(Cost = TotalC / 1e6) 39 | if (save) { 40 | saveRDS(diabetes, file = str_c(CLEANED_DIR, "diabetes.rds")) 41 | } 42 | diabetes 43 | } 44 | 45 | process_bejing <- function(save = FALSE) { 46 | beijing_pm25 <- read_csv(str_c(RAW_DIR, "beijing-pm25.csv")) 47 | beijing_pm25$Datetime <- as.POSIXct( 48 | paste(beijing_pm25$year, beijing_pm25$month, beijing_pm25$day, 49 | beijing_pm25$hour, sep = " "), format = "%Y %m %d %H") 50 | if (save) { 51 | saveRDS(beijing_pm25, file = str_c(CLEANED_DIR, "beijing_pm25.rds")) 52 | } 53 | beijing_pm25 54 | } 55 | 56 | process_rice <- function(save = FALSE) { 57 | rice_price <- read_csv( 58 | str_c(RAW_DIR, "retail_prices.csv"), 59 | skip=9, n_max = 162, na="na") |> 60 | select(1, 2) |> 61 | rename("Month" = `Data Series`, 62 | "thai_rice" = `Premium Thai Rice (Per 5 Kilogram) (Dollar)`) |> 63 | mutate(Month = yearmonth(Month)) |> 64 | as_tsibble(index = Month) 65 | if (save) { 66 | saveRDS(rice_price, file = str_c(CLEANED_DIR, "rice_price.rds")) 67 | } 68 | rice_price 69 | } 70 | 71 | process_control_charts <- function(save = FALSE) { 72 | ccharts <- read_table(str_c(RAW_DIR, "synthetic_control.data"), 73 | col_names = FALSE) 74 | chart_type <- as.factor(rep(c("Normal", "Cyclic", "Increasing", "Decreasing", 75 | "Upward", "Downward"), each = 100)) 76 | ccharts <- ccharts |> 77 | mutate(Type = chart_type, 78 | id = 1:600) |> 79 | pivot_longer(cols = contains("X"), 80 | values_to = "value") |> 81 | mutate(Time = rep(1:60, 600)) |> 82 | select(Time, value, id, Type) |> 83 | as_tsibble(index = Time, 84 | key = c(id, Type)) 85 | ccharts_train <- ccharts |> 86 | filter((id %% 100) <= 80) 87 | ccharts_test <- ccharts |> 88 | filter((id %% 100) > 80) 89 | ccharts = list("train" = ccharts_train, "test" = ccharts_test) 90 | if (save) { 91 | saveRDS(ccharts, file = str_c(CLEANED_DIR, "ccharts.rds")) 92 | } 93 | ccharts 94 | } 95 | -------------------------------------------------------------------------------- /assignments/assignment1.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "ST5209/X Assignment 1" 3 | format: pdf 4 | editor: visual 5 | author: "Due 29 Jan, 11.59pm" 6 | --- 7 | 8 | ## Set up 9 | 10 | 1. Make sure you have the following installed on your system: $\text{\LaTeX}$, R4.2.2+, RStudio 2023.12+, and Quarto 1.3.450+. 11 | 2. Clone the course [repo](https://github.com/yanshuotan/st5209-2024). 12 | 3. Create a separate folder in the root directory of the repo, label it with your name, e.g. `yanshuo-assignments` 13 | 4. Copy the assignment1.qmd file over to this directory. 14 | 5. Modify the duplicated document with your solutions, writing all R code as code chunks. 15 | 6. When running code, make sure your working directory is set to be the folder with your assignment .qmd file, e.g. `yanshuo-assignments`. This is to ensure that all file paths are valid.[^1] 16 | 17 | [^1]: You may view and set the working directory using `getwd()` and `setwd()`. 18 | 19 | ## Submission 20 | 21 | 1. Render the document to get a .pdf printout. 22 | 2. Submit both the .qmd and .pdf files to Canvas. 23 | 24 | ## Question 1 (Quarto) 25 | 26 | Read the [guide](https://quarto.org/docs/computations/r.html) on using Quarto with R and answer the following questions: 27 | 28 | a) Write a code chunk that imports `tidyverse` and `fpp3`. 29 | b) Modify the chunk so that only the following output is shown (i.e. the usual output about attaching packages and conflicts is not shown.) 30 | 31 | \includegraphics[width=0.9\textwidth]{../_images/quarto_chunk_output.png} 32 | 33 | c) Modify the chunk so that it is executed but no code is shown at all when rendered to a pdf. 34 | d) Modify the document so that your name is printed on it beneath the title. 35 | 36 | ## Question 2 (Livestock) 37 | 38 | Consider the `aus_livestock` dataset loaded in the `fpp3` package. 39 | 40 | a) Use `filter()` to extract a time series comprising the monthly total number of pigs slaughtered in Victoria, Australia, from Jul 1972 to Dec 2018. 41 | b) Make a time plot of the resulting time series. 42 | 43 | ## Question 3 (Data cleaning) 44 | 45 | Inspect the function `process_sgcpi()` located in `_code/clean_data.R`. 46 | This function is used to convert the raw Consumer Price Index (CPI) data in `_data/raw/sg-cpi.csv` into a tsibble, stored in `_data/cleaned/sgcpi.rds`. 47 | 48 | a) In line 9, what does `skip = 10` and `n_max = 152` do? Why do we need to do this when reading the csv file? 49 | b) In line 14, what does `t()` do? Why do we need to do this in order to make a tsibble? 50 | 51 | ## Question 4 (Beer production) 52 | 53 | Consider the `aus_production` dataset loaded in the `fpp3` package. 54 | We will study the column measuring the production of beer. 55 | 56 | a) Make a time plot of the beer production time series. 57 | b) Describe the observed trend. 58 | c) Make a seasonal plot. 59 | d) What is the period of the seasonality? 60 | e) Describe the seasonal behavior. 61 | 62 | ## Question 5 (Pelts) 63 | 64 | Consider the `pelt` dataset loaded in the `fpp3` package, which measures the Hudson Bay Company trading records for Snowshoe Hare and Canadian Lynx furs from 1845 to 1935. 65 | 66 | a) Plot both time series on the same axes. *Hint: Use `pivot_longer()` to create a key column*. 67 | b) What happens when you try to use ``gg_season()`` to the lynx fur time series? What is producing the error? 68 | c) Make a lag plot with the first 20 lags. Which lags display strong positive correlation? Which lags display strong negative correlation? Verify this with the time plot. 69 | d) If you were to guess the seasonality period based on the lag plot, what would it be? 70 | e) Use the provided function ``gg_custom_season()` in `_code/plot_util.R`[^2] to make a seasonal plot for lynx furs with the period that you guessed.[^3] Does the resulting plot suggest seasonality? Why or why not? 71 | 72 | [^2]:You can load this function using `source("../_code/plot.util.R")`. 73 | [^3]: Unfortunately, it seems ``gg_season()` does not allow this functionality. -------------------------------------------------------------------------------- /assignments/assignment4.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "ST5209/X Assignment 4" 3 | format: pdf 4 | editor: visual 5 | author: "Due 1 Apr, 11.59pm" 6 | --- 7 | 8 | ## Set up 9 | 10 | 1. Make sure you have the following installed on your system: $\text{\LaTeX}$, R4.2.2+, RStudio 2023.12+, and Quarto 1.3.450+. 11 | 2. Pull changes from the course [repo](https://github.com/yanshuotan/st5209-2024). 12 | 3. Create a separate folder in the root directory of the repo, label it with your name, e.g. `yanshuo-assignments` 13 | 4. Copy the assignment1.qmd file over to this directory. 14 | 5. Modify the duplicated document with your solutions, writing all R code as code chunks. 15 | 6. When running code, make sure your working directory is set to be the folder with your assignment .qmd file, e.g. `yanshuo-assignments`. This is to ensure that all file paths are valid.[^1] 16 | 17 | [^1]: You may view and set the working directory using `getwd()` and `setwd()`. 18 | 19 | ## Submission 20 | 21 | 1. Render the document to get a .pdf printout. 22 | 2. Submit both the .qmd and .pdf files to Canvas. 23 | 24 | ```{r} 25 | #| message: FALSE 26 | #| echo: FALSE 27 | library(tidyverse) 28 | library(fpp3) 29 | ``` 30 | 31 | ## 1. AR polynomial 32 | 33 | Consider the AR(2) model $$ 34 | X_t = 4 + 0.5 X_{t-1} - 0.25 X_{t-2} + W_t. 35 | $$ {#eq-ar2} 36 | 37 | a. What is the autoregressive polynomial? 38 | 39 | b. What are its roots? 40 | 41 | c. Is this model causal? Why? 42 | 43 | d. What is the period of the sinusoidal portion of its ACF? 44 | 45 | e. Given the representation $$ 46 | X_t = \sum_{j=0}^\infty \psi_j W_{t-j}, 47 | $$ solve for $\psi_0, \psi_1, \psi_2, \psi_3$. 48 | 49 | ## 2. Likelihood 50 | 51 | Consider the AR(1) model $$ 52 | X_t = 1-0.6X_{t-1} + W_t, 53 | $$ where $W_t \sim WN(0, 0.25)$ is Gaussian white noise. We are given observations $x_1 = 0.2, x_2 = -0.3, x_3 = 0.4$. 54 | 55 | a. What is the mean of $X_t$? 56 | 57 | b. Write the full likelihood of this model. 58 | 59 | c. Write the conditional likelihood of this model, when conditioning on the value of $x_1$. 60 | 61 | ## 3. Reversibility 62 | 63 | a. Create a sample trajectory of length $n = 200$ from the AR(2) model from Problem 1 using `arima.sim()`. 64 | 65 | b. Reverse the time index of the vector you obtain using `rev()`. 66 | 67 | c. Fit an AR(2) model to the reversed time series using `fable`. Hint: You may use the code snippet `model(AR(X ~ order(2)))`. 68 | 69 | d. Inspect the model parameters using `tidy()`. Why are they similar to the those in @eq-ar2? 70 | 71 | e. Make a forecast with $h = 10$. What does this correspond to in terms of the original time series? 72 | 73 | ## 4. Yule-Walker 74 | 75 | a. Write the Yule-Walker equations for the AR(2) model from Problem 1. 76 | 77 | b. Arrange the equations in the following matrix form (i.e. fill in the missing entries): $$ 78 | \left[\begin{matrix} ? & ? & ? \\ ? & ? & ? \\ 79 | ? & ? & ? 80 | \end{matrix}\right] \left[\begin{matrix} \gamma(0) \\ \gamma(1) \\ \gamma(2) 81 | \end{matrix}\right] = \left[\begin{matrix} \sigma^2 \\ 0 \\ 0 82 | \end{matrix}\right]. 83 | $$ 84 | 85 | c. Solve the system from part b) for $\gamma(0), \gamma(1), \gamma(2)$ numerically using `solve()`. 86 | 87 | d. Given $$ 88 | \Gamma_2 = \left[\begin{matrix} \gamma(0) & \gamma(1) \\ \gamma(1) & \gamma(0) 89 | \end{matrix}\right], 90 | $$ what is the top left entry of $\Gamma_2^{-1}$ in terms of $\gamma(0)$ and $\gamma(1)$? 91 | 92 | e. Write a 95% confidence interval for $\phi_1$ using your answers for d) and 3d). 93 | 94 | ## 5. Real data analysis 95 | 96 | a. Load the dataset `globtemp.rds` in `_data/cleaned` and convert it into a tsibble. 97 | 98 | b. Filter the time series to include measurements only up to 1960. 99 | 100 | c. Fit an AR model using `model(AR(X))`. 101 | 102 | d. What is order of the model selected? What are the fitted parameters? 103 | 104 | e. Inspect the model residuals using `gg_tsresiduals()`. What can you say about the model fit? 105 | -------------------------------------------------------------------------------- /demonstrations/week2.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 2 Demonstration" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | We always load the following packages. 10 | 11 | ```{r} 12 | #| message: FALSE 13 | library(fpp3) 14 | library(tidyverse) 15 | ``` 16 | 17 | ## Lags and differencing 18 | 19 | Let's consider the `aus_arrivals` dataset and try to plot lagged arrival values. 20 | 21 | ```{r} 22 | aus_arrivals |> 23 | mutate(LaggedArrivals = lag(Arrivals)) |> 24 | autoplot(LaggedArrivals) 25 | ``` 26 | 27 | Something seems a bit odd about this plot, especially the UK value. 28 | What is happening is that the lag function has treated the entire column as a 29 | single time series even though it contains 4 separate time series. 30 | To avoid this, we need to do a `group_by()` before applying mutate 31 | 32 | ```{r} 33 | aus_arrivals |> 34 | group_by(Origin) |> 35 | mutate(LaggedArrivals = lag(Arrivals)) |> 36 | ungroup() |> 37 | autoplot(LaggedArrivals) 38 | ``` 39 | 40 | ## Moving averages 41 | 42 | Let's focus on the arrivals from Japan time series and compute moving averages. 43 | 44 | ```{r} 45 | library(slider) 46 | 47 | aus_jap_arrivals <- aus_arrivals |> 48 | filter(Origin == "Japan") |> 49 | mutate(MA2 = slide_dbl(Arrivals, mean, .before = 1, .after = 0), 50 | MA2_alt = (Arrivals + lag(Arrivals)) / 2) 51 | aus_jap_arrivals 52 | ``` 53 | 54 | Manually computing the moving average shows that the formula is correct. 55 | We now compute moving averages with a few different window sizes to see the 56 | effect of varying the window size. 57 | 58 | ```{r} 59 | library(slider) 60 | library(viridis) 61 | 62 | aus_jap_arrivals <- aus_arrivals |> 63 | filter(Origin == "Japan") |> 64 | mutate(ArrivalsMA2 = slide_dbl(Arrivals, mean, .before = 1, .after = 0), 65 | ArrivalsMA4 = slide_dbl(Arrivals, mean, .before = 2, .after = 1), 66 | ArrivalsMA6 = slide_dbl(Arrivals, mean, .before = 3, .after = 2), 67 | ArrivalsMA8 = slide_dbl(Arrivals, mean, .before = 4, .after = 3)) 68 | ``` 69 | 70 | We can plot them individually, or plot all versions on the same plot. 71 | 72 | ```{r} 73 | aus_jap_arrivals |> select(-Origin) |> 74 | pivot_longer(cols = contains("Arrivals"), names_to = "Type") |> 75 | autoplot(value) + scale_color_viridis(discrete = TRUE) 76 | ``` 77 | 78 | There's a bit of overplotting here, but we generally see that the time series 79 | becomes smoother as we increase the window size. 80 | This is similar to bandwidth selection for kernel smoothing. 81 | On the other hand, MA4 seems to be smoother than MA6 (see the figure below). 82 | This is because the seasonality has period 4, which is averaged out when the 83 | window size of the moving average is a multiple of 4, but not otherwise. 84 | 85 | ```{r} 86 | aus_jap_arrivals |> select(-Origin) |> 87 | pivot_longer(cols = all_of(c("Arrivals", "ArrivalsMA4", "ArrivalsMA6")), 88 | names_to = "Type") |> 89 | autoplot(value) + scale_color_viridis(discrete = TRUE) 90 | ``` 91 | 92 | ## Log transform and differencing 93 | 94 | Let's consider the turnover for clothes sales in Victoria, Australia. 95 | 96 | ```{r} 97 | diabetes <- read_rds("../_data/cleaned/diabetes.rds") 98 | diabetes |> autoplot() 99 | ``` 100 | 101 | The seasonal fluctuations grow with the level of the time series, so we shall 102 | apply a log transformation. 103 | 104 | ```{r} 105 | diabetes |> 106 | mutate(logTotalC = log(TotalC)) |> 107 | autoplot(logTotalC) 108 | ``` 109 | 110 | This is much better now. Let us now take differences 111 | 112 | ```{r} 113 | diabetes |> 114 | mutate(logTotalC = log(TotalC)) |> 115 | mutate(logDiffTotalC = difference(logTotalC)) |> 116 | autoplot(logDiffTotalC) 117 | ``` 118 | 119 | This measures the percentage *month-on-month* increase in sales of diabetes drugs. 120 | The time series still seems to be quite seasonal. 121 | 122 | What happens if we take a seasonal difference? 123 | 124 | ```{r} 125 | diabetes |> 126 | mutate(logTotalC = log(TotalC)) |> 127 | mutate(logSeasonalDiffTotalC = difference(logTotalC, 12)) |> 128 | autoplot(logSeasonalDiffTotalC) 129 | ``` 130 | 131 | It measures the *year-on-year* percentage increase in sales of diabetes drugs. 132 | The seasonality has disappeared! This series is also much more stable, see the 133 | y-axis limits. -------------------------------------------------------------------------------- /assignments/assignment5.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "ST5209/X Assignment 5" 3 | format: pdf 4 | editor: visual 5 | author: "Due 22 Apr, 11.59pm" 6 | --- 7 | 8 | ## Set up 9 | 10 | 1. Make sure you have the following installed on your system: $\text{\LaTeX}$, R4.2.2+, RStudio 2023.12+, and Quarto 1.3.450+. 11 | 2. Pull changes from the course [repo](https://github.com/yanshuotan/st5209-2024). 12 | 3. Create a separate folder in the root directory of the repo, label it with your name, e.g. `yanshuo-assignments` 13 | 4. Copy the assignment1.qmd file over to this directory. 14 | 5. Modify the duplicated document with your solutions, writing all R code as code chunks. 15 | 6. When running code, make sure your working directory is set to be the folder with your assignment .qmd file, e.g. `yanshuo-assignments`. This is to ensure that all file paths are valid.[^1] 16 | 17 | [^1]: You may view and set the working directory using `getwd()` and `setwd()`. 18 | 19 | ## Submission 20 | 21 | 1. Render the document to get a .pdf printout. 22 | 2. Submit both the .qmd and .pdf files to Canvas. 23 | 24 | ```{r} 25 | #| message: FALSE 26 | #| echo: FALSE 27 | library(tidyverse) 28 | library(fpp3) 29 | ``` 30 | 31 | ## 1. Modeling with ARIMA (Q9.7 in Hyndman & Athanasopoulos) 32 | 33 | Consider `aus_airpassengers`, the total number of passengers (in millions) from Australian air carriers for the period 1970-2016. 34 | 35 | a. Use `ARIMA()` to find an appropriate ARIMA model. What model was selected. Check that the residuals look like white noise. Plot forecasts for the next 10 periods. 36 | 37 | b. Write the model in terms of the backshift operator. 38 | 39 | c. Plot forecasts from an ARIMA(0,1,0) model with drift and compare these to part a. 40 | 41 | d. Plot forecasts from an ARIMA(2,1,2) model with drift and compare these to part b. Remove the constant and see what happens. 42 | 43 | e. Plot forecasts from an ARIMA(0,2,1) model with a constant. What happens? 44 | 45 | ## 2. Recursive forecasting for ARMA(1, 1) 46 | 47 | Consider the $ARMA(1,1)$ model $$ 48 | X_t - 0.5X_{t-1} = W_t + 0.5W_{t-1}. 49 | $$ In this question, we will investigate recursive forecasting. The following code snippet generates a sequence of length $n=50$ drawn from the above model. 50 | 51 | ```{r} 52 | set.seed(5209) 53 | n <- 50 54 | wn <- rnorm(n) 55 | xt <- arima.sim(model = list(ar = 0.5, ma = 0.5), innov = wn, n = n) 56 | ``` 57 | 58 | a. Fill in the following code snippet using equation (11.14) to generate a sequence `wn_hat`. 59 | 60 | ```{r} 61 | wn_hat <- rep(0, n) 62 | wn_hat[[1]] <- xt[[1]] 63 | for (i in 2:n) { 64 | # FILL IN 65 | } 66 | ``` 67 | 68 | b. Make a time plot of the log absolute difference between `wn` and `wn_hat`. 69 | 70 | c. What consequence does this have for truncated forecasts? 71 | 72 | d. Compute the truncated forecast for $X_{53}$. 73 | 74 | ## 3. Seasonal ARIMA 75 | 76 | a. Load `diabetes.rds` from the directory `_data/cleaned`. 77 | 78 | b. Perform the following transformation of the column `Cost`: Apply a log transform followed by a seasonal difference. Label the resulting time series `Y`. 79 | 80 | c. Apply the KPSS test to `Y`. What is its p-value? What can you conclude about `Y`? 81 | 82 | d. Make a time plot of `log(Cost)`. Why does the trend disappear when we consider `Y`? 83 | 84 | e. Fit an ARIMA model to `log(Cost)` and report the order of the fitted model. 85 | 86 | f. How many fitted parameters are there in the model? 87 | 88 | ## 4. Model selection 89 | 90 | a. What are the null hypothesis and assumptions of the ADF test? 91 | 92 | b. Is it possible for both the ADF and KPSS test applied to a dataset to have large p-values? Explain why or why not. 93 | 94 | c. What are the AIC and AICc penalties for the model fitted in Q3? 95 | 96 | d. Fit an exponential smoothing model of your choice to `diabetes.rds`. Use `glance()` to view the log likelihood and AICc values of both this model and the ARIMA model from Q3. 97 | 98 | e. Can we say which method is a better fit to the data by comparing their log likelihood or AICc? Explain why or why not. 99 | 100 | ## 5. ACF, PACF, and BLPs 101 | 102 | Let $(X_t)$ be a mean zero stationary process with the following autocovariance values: 103 | 104 | $$ 105 | \gamma_X(0) = 2, \gamma_X(1) = 1.4, \gamma_X(2) = 0.6, \gamma_X(3) = 0.4, \gamma_X(4) = 0.2. 106 | $$ 107 | 108 | a. Can $(X_t)$ be an MA(2) process? Explain why or why not. 109 | 110 | b. Can $(X_t)$ be an AR(1) process? Explain why or why not. 111 | 112 | c. What is the best linear predictor $\hat X_4$ for $X_4$ given only $X_3 = 2$? 113 | 114 | d. Using the notation in part c), what is the variance of $X_4 - \hat X_4$? 115 | 116 | e. What is the best linear predictor $\hat X_4$ for $X_4$ given only $X_2 = 2$? 117 | 118 | f. f\. Using the notation in part e), what is the variance of $X_4 - \hat X_4$? 119 | 120 | g. Let $\alpha_X$ denote the partial autocorrelation function of $(X_t)$. What is $\alpha_X(1)$? 121 | 122 | h. What is $\alpha_X(3)$? 123 | -------------------------------------------------------------------------------- /demonstrations/week1.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 1 Demonstration" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | We always load the following packages. 10 | 11 | ```{r} 12 | #| message: FALSE 13 | library(fpp3) 14 | library(tidyverse) 15 | ``` 16 | 17 | ## Downloading and wrangling data 18 | 19 | Let's start by downloading a [dataset](https://www.kaggle.com/datasets/robikscube/hourly-energy-consumption) on energy consumption from Kaggle. 20 | Save it into the raw data folder. 21 | Assuming that it is already saved, we can load it as follows. 22 | 23 | ```{r} 24 | elec_consumption <- read_csv("../_data/raw/AEP_hourly.csv") 25 | ``` 26 | 27 | Try turning this into a tsibble. 28 | 29 | ```{r} 30 | #| eval: FALSE 31 | elec_consumption |> as_tsibble() 32 | ``` 33 | 34 | Something went wrong... why? Let's try to parse the error message: 35 | 36 | ```{r} 37 | #| eval: FALSE 38 | Using `Datetime` as index variable. 39 | Error in `validate_tsibble()`: 40 | ! A valid tsibble must have distinct rows identified by key and index. 41 | ℹ Please use `duplicates()` to check the duplicated rows. 42 | Run `rlang::last_trace()` to see where the error occurred. 43 | ``` 44 | 45 | Seems like there may be multiple entries with the same datetime. Let us check: 46 | 47 | ```{r} 48 | duplicates(elec_consumption) 49 | ``` 50 | 51 | The duplicate entries all occur in early November at 2am. This must be because of daylight savings. 52 | 53 | How to deal with the duplicates? Probably the most "correct" way would be to "undo" daylight savings, but there is no built-in functionality for this, so we will just perform a stop-gap and take the mean of all measurements with the same datetime. 54 | 55 | ```{r} 56 | elec_consumption <- elec_consumption |> 57 | group_by(Datetime) |> 58 | summarise(AEP_MW = mean(AEP_MW)) |> 59 | as_tsibble(index = Datetime) 60 | ``` 61 | 62 | ## Plots 63 | 64 | ### Time plot 65 | 66 | Let us now compute a time plot: 67 | 68 | ```{r} 69 | elec_consumption |> autoplot() 70 | ``` 71 | 72 | There is clearly too much going on here. What can we do to visualize the time series better? 1. Filter the time series so that it is over a shorter time period. 2. Decompose the time series into seasonal, trend, and remainder components (next lesson) 3. Make a seasonal plot. 4. Aggregate the time series so that the duration between measurements is larger (e.g. days instead of hours). 73 | 74 | Let's try to perform a filter 75 | 76 | ```{r} 77 | #| eval: FALSE 78 | elec_consumption |> 79 | filter(Datetime < 2010) |> 80 | autoplot() 81 | ``` 82 | 83 | What went wrong? Turns out inequality operations don't work naturally with datetime objects. We first need to extract the year number using the `year()` function. 84 | 85 | ```{r} 86 | elec_consumption |> 87 | filter(year(Datetime) < 2010 & year(Datetime) > 2006) |> 88 | autoplot() 89 | ``` 90 | 91 | There's actually a function from `tsibble` called `filter_index()` that provides more convenient ways of filtering based on the time index. 92 | 93 | This plot is still quite noisy, so let's make seasonal plots. 94 | 95 | ## Seasonal plots 96 | 97 | ```{r} 98 | #| eval: FALSE 99 | elec_consumption |> 100 | gg_season() 101 | ``` 102 | 103 | Oops, there's an error again. Let's inspect the error message. 104 | 105 | ```{r} 106 | #| eval: FALSE 107 | Plot variable not specified, automatically selected `y = AEP_MW`Error in `check_gaps()`: 108 | ! data contains implicit gaps in time. You should check your data and convert implicit gaps into explicit missing values using `tsibble::fill_gaps()` if required. 109 | Backtrace: 110 | 1. feasts::gg_season(elec_consumption) 111 | 2. feasts:::check_gaps(data) 112 | ``` 113 | 114 | It says that there are gaps in the time index. This is unsurprising, because of daylight savings. 115 | 116 | ```{r} 117 | elec_consumption |> 118 | fill_gaps() |> 119 | gg_season() 120 | ``` 121 | 122 | What period did ``gg_season()`` automatically select? It selected a period of a year (i.e. 365 * 24). 123 | 124 | ```{r} 125 | elec_consumption |> 126 | fill_gaps() |> 127 | gg_season(period = "year") 128 | ``` 129 | 130 | Manually setting the period to a year gives the same plot. 131 | We can try to interpret this seasonality. 132 | The highest energy consumption occurs in January and August, corresponding to the middle of Winter and Summer respectively. 133 | This is when people make the most of heaters or air-conditioning. 134 | 135 | ```{r} 136 | elec_consumption |> 137 | fill_gaps() |> 138 | filter(year(Datetime) == 2006) |> 139 | gg_season(period = "day") 140 | ``` 141 | 142 | There seems to be daily seasonality. 143 | Energy consumption decreases after 9pm, bottoming out around 5am, when people are sleeping. 144 | It then increases again during the day. 145 | Note also the different patterns for Summer months (blue) and Winter months (pink/orange). 146 | 147 | 148 | ```{r} 149 | elec_consumption |> 150 | fill_gaps() |> 151 | filter(year(Datetime) == 2006) |> 152 | gg_season(period = "week") 153 | ``` 154 | 155 | There seems to be weekly seasonality too. 156 | Energy consumption is lower on the weekends than on weekdays. 157 | Note that the fluctuations over each day is part of the daily seasonality, not the weekly seasonality. -------------------------------------------------------------------------------- /assignments/assignment2.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "ST5209/X Assignment 2" 3 | format: pdf 4 | editor: visual 5 | author: "Due 19 Feb, 11.59pm" 6 | --- 7 | 8 | ## Set up 9 | 10 | 1. Make sure you have the following installed on your system: $\text{\LaTeX}$, R4.2.2+, RStudio 2023.12+, and Quarto 1.3.450+. 11 | 2. Clone the course [repo](https://github.com/yanshuotan/st5209-2024). 12 | 3. Create a separate folder in the root directory of the repo, label it with your name, e.g. `yanshuo-assignments` 13 | 4. Copy the assignment1.qmd file over to this directory. 14 | 5. Modify the duplicated document with your solutions, writing all R code as code chunks. 15 | 6. When running code, make sure your working directory is set to be the folder with your assignment .qmd file, e.g. `yanshuo-assignments`. This is to ensure that all file paths are valid.[^1] 16 | 17 | [^1]: You may view and set the working directory using `getwd()` and `setwd()`. 18 | 19 | ## Submission 20 | 21 | 1. Render the document to get a .pdf printout. 22 | 2. Submit both the .qmd and .pdf files to Canvas. 23 | 24 | ```{r} 25 | #| message: FALSE 26 | #| echo: FALSE 27 | library(tidyverse) 28 | library(fpp3) 29 | ``` 30 | 31 | ## Question 1 (ACF plots, Q2.9 in FPP) 32 | 33 | The following time plots and ACF plots correspond to four different time series. Match each time plot in the first row with one of the ACF plots in the second row. 34 | 35 | ![](../_images/acfguess-1.png) 36 | 37 | ## Question 2 (Box-Cox, Q3.3 in FPP) 38 | 39 | Why is the Box-Cox transform unhelpful for the `canadian_gas` data? 40 | 41 | ## Question 3 (Decomposition with outliers, Q3.7 in FPP) 42 | 43 | Consider the last five years of the Gas data from `aus_production` . 44 | 45 | ```{r} 46 | gas <- tail(aus_production, 5*4) |> select(Gas) 47 | ``` 48 | 49 | a. Plot the time series. Can you identify seasonal fluctuations and/or a trend-cycle? 50 | 51 | b. Use `classical_decomposition` with `type=multiplicative` to calculate the trend-cycle and seasonal indices. 52 | 53 | c. Do the results support the graphical interpretation from part a? 54 | 55 | d. Compute and plot the seasonally adjusted data. 56 | 57 | e. Change one observation to be an outlier by running the following snippet: 58 | 59 | ```{r} 60 | #| eval: FALSE 61 | # Change to eval: TRUE in order to run 62 | gas |> 63 | mutate(Gas = if_else(Quarter == yearquarter("2007Q4"), Gas + 300, Gas)) 64 | ``` 65 | 66 | Recompute the decomposition. What is the effect of the outlier on the seasonally adjusted data? 67 | 68 | f. Does it make any difference if the outlier is near the end rather than in the middle of the time series? 69 | 70 | ## Question 4 (STL decomposition, Q3.10 in FPP) 71 | 72 | Consider the `canadian_gas` dataset. 73 | 74 | a. Do an STL decomposition of the data. 75 | 76 | b. How does the seasonal shape change over time? \[Hint: Try plotting the seasonal component using `gg_season()`.\] 77 | 78 | c. Apply a calendar adjustment and compute the STL decomposition again. What is the effect on the seasonal shape? 79 | 80 | ## Question 5 (Time series classification) 81 | 82 | We continue out investigations of this [dataset](https://kdd.ics.uci.edu/databases/synthetic_control/synthetic_control.html), which contains 600 synthetic control charts for an industrial process. There are 6 types of control charts, and our goal is to build a model to classify them correctly. 83 | 84 | We have already processed the raw data into a convenient, labeled form. Run the following code snippet to load it and create train and test sets. 85 | 86 | ```{r} 87 | ccharts <- read_rds("../_data/CLEANED/ccharts.rds") 88 | ccharts_train <- ccharts[["train"]] 89 | ccharts_test <- ccharts[["test"]] 90 | ``` 91 | 92 | a. Make a time plot of one time series from each category in the training set. Note that the category is recorded under the `Type` column. 93 | 94 | b. Compute all time series features for both the training and test set using the snippet. What is the difference between `acf1` and `stl_e_acf1` for Increasing, Decreasing, Upward, and Downward types? Why is there a difference? 95 | 96 | ```{r} 97 | #| eval: FALSE 98 | # Change to eval: TRUE in order to run 99 | train_feats <- ccharts_train |> features(value, feature_set(pkgs = "feasts")) 100 | test_feats <- ccharts_test |> features(value, feature_set(pkgs = "feasts")) 101 | ``` 102 | 103 | c. Investigate the relationship between the following features and `Type`. Pick two features whose scatter plot gives a good separation between all 6 chart types. 104 | 105 | i. `linearity` 106 | 107 | ii. `trend_strength` 108 | 109 | iii. `acf1` 110 | 111 | iv. `stl_e_acf1` 112 | 113 | v. `shift_level_max` 114 | 115 | vi. `shift_var_max` 116 | 117 | vii. `n_crossing_points` 118 | 119 | Make the scatter plot and explain why these features are able to separate the different chart types. 120 | 121 | d. Install the `caret` package and use the following snippet to fit a $k$-nearest neighbors model on the two features you have selected (substitute `X` and `Y` for the two features you selected in b), and then predict on the test set. What percentage of the test examples are correctly classified? Write code to compute this value. (You should get \> 90% accuracy) 122 | 123 | ```{r} 124 | #| eval: FALSE 125 | # Change to eval: TRUE in order to run 126 | library(caret) 127 | knn_fit <- train(Type ~ X + Y, data = train_feats, method = "knn") 128 | predict(knn_fit, newdata = test_feats) 129 | ``` 130 | -------------------------------------------------------------------------------- /demonstrations/week8.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 8 Demonstration" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | ```{r} 10 | #| message: FALSE 11 | library(fpp3) 12 | library(tidyverse) 13 | library(slider) 14 | library(gridExtra) 15 | ``` 16 | 17 | ## 1. AR(2) 18 | 19 | Consider the AR(2) equation $$ 20 | X_t = 1.5 X_{t-1} - 0.75 X_{t-2} + W_t. 21 | $$ 22 | 23 | a. What is the autoregressive polynomial? 24 | 25 | b. What are its roots? 26 | 27 | c. What patterns does its ACF exhibit? 28 | 29 | d. Compute the general form of its ACF. 30 | 31 | e. Confirm d) using `AMRAacf()`. 32 | 33 | f. What times series pattern does this correspond to? 34 | 35 | g. Confirm this by simulating from this time series model. 36 | 37 | ------------------------------------------------------------------------ 38 | 39 | The AR polynomial is 40 | 41 | $$ 42 | \phi(z) = 1 - 1.5z +0.75z^2 43 | $$ 44 | 45 | The roots are 46 | 47 | $$ 48 | \frac{1.5 \pm \sqrt{(1.5)^2 - 4\cdot 0.75}}{2\cdot 0.75} = 1 \pm i/\sqrt{3}. 49 | $$ 50 | 51 | Since the roots are complex, the ACF is a damped sinusoid. 52 | 53 | The general form is 54 | 55 | $$ 56 | cz_1^h + \bar c \bar z_1^h = a|z_1|^{-h}\cos(h\theta+b) 57 | $$ 58 | 59 | where $a$ and $b$ are constants depend on initial conditions, and 60 | 61 | $$ 62 | \begin{split} 63 | \theta & = \arctan(Im(z_1)/Re(z_1)) \\ 64 | & = \arctan(1/\sqrt{3}) \\ 65 | & = \pi/6. 66 | \end{split} 67 | $$ 68 | 69 | Hence, the period of the sinusoid is 12 units. 70 | 71 | ```{r} 72 | ARMAacf(ar = c(1.5, -0.75), lag.max = 30) |> plot() 73 | ``` 74 | 75 | The ACF corresponds to a cyclic time series pattern with an approximate period of 12. 76 | 77 | ```{r} 78 | arima.sim(model = list(ar = c(1.5, -0.75)), n = 100) |> 79 | as_tsibble() |> 80 | autoplot() 81 | ``` 82 | 83 | ------------------------------------------------------------------------ 84 | 85 | ## 2. AR(2) Part 2 86 | 87 | Consider the AR(2) equation $$ 88 | X_t = \phi_1 X_{t-1} + \phi_2 X_{t-2} + W_t. 89 | $$ 90 | 91 | a. Under what conditions on $\phi_1$ and $\phi_2$ is the model causal? 92 | b. Under what conditions on $\phi_1$ and $\phi_2$ does the ACF have periodic behavior? 93 | c. The conditions on a) are equivalent to[^1] $$ 94 | \phi_1 + \phi_2 < 1, \quad \phi_2 - \phi_1 < 1, \quad |\phi_2| < 1. 95 | $$ What region in 2D does this correspond to? 96 | 97 | [^1]: See Example 3.9 and Problem 3.5 in Shumway and Stoffer. 98 | 99 | ------------------------------------------------------------------------ 100 | 101 | The AR polynomial is 102 | 103 | $$ 104 | \phi(z) = 1 - \phi_1z - \phi_2z^2. 105 | $$ 106 | 107 | Using the quadratic formula, we can write the roots of this polynomial as 108 | 109 | $$ 110 | z_1,z_2 = \frac{\phi_1 \pm \sqrt{\phi_1^2 + 4\phi_2}}{-\phi_2}. 111 | $$ 112 | 113 | The model is causal if $|z_1|,|z_2| > 1$. 114 | 115 | The ACF has periodic behavior if the roots are complex. This happens if and only if 116 | 117 | $$ 118 | \phi_2 < -\frac{\phi_1^2}{4}. 119 | $$ 120 | 121 | We reproduce a figure from Shumway and Stoffer (2000) to illustrate geometrically the values of $\phi_1$ and $\phi_2$ 122 | 123 | ![](causal_ar2.png) 124 | 125 | ------------------------------------------------------------------------ 126 | 127 | ## 3. Linear process coefficients. 128 | 129 | Given an AR(p) model $$ 130 | X_t = \sum_{j=0}^\infty \psi_j W_{t-j}, 131 | $$ write the coefficients in terms of the parameters $\phi_1,\phi_2,\ldots,\phi_p$. 132 | 133 | ------------------------------------------------------------------------ 134 | 135 | As stated in the theorem on existence and uniqueness of solutions, the coefficients are defined via the equation 136 | 137 | $$ 138 | \phi(z)\left(\sum_{j=0}^\infty \psi_j z^j\right) = 1. 139 | $$ {#eq-power-series-equality} 140 | 141 | Here, we treat all expressions symbolically, i.e. we do not care about series convergence. The left hand side is the product of a polynomial and a power series, which gives a power series: 142 | 143 | $$ 144 | \sum_{j=0}^\infty c_j z^j 145 | $$ 146 | 147 | The coefficients $c_0,c_1,\ldots$ can be defined by considering which terms in the product can combine to give an appropriate power of $z^j$. For instance, only the constant terms can multiply together to get a constant, so we have $c_0 = \psi_0$. To get a term with $z$, we need a multiply a constant term by one with $z$. This gives 148 | 149 | $$ 150 | c_1 = \phi_1\psi_0 + \phi_0\psi_1. 151 | $$ 152 | 153 | Generally, we have the formula 154 | 155 | $$ 156 | c_k = \sum_{j=0}^p \phi_j\psi_{k-j}. 157 | $$ 158 | 159 | If $\sum_{j=0}^\infty c_j z_j$ is equal to 1 as a power series, then we must have $c_0 = 1$, $c_k = 0$ for all $k \geq 1$. This allows us to solve for $\psi_j$ recursively since for $k=1,2,\ldots$, the resulting equation 160 | 161 | $$ 162 | \sum_{j=0}^p \phi_j \psi_{k-j} = 0 163 | $$ 164 | 165 | can be rewritten to express $\psi_k$ in terms of $\psi_{k-1}, \psi_{k-2},\ldots,\psi_0$. 166 | 167 | ------------------------------------------------------------------------ 168 | 169 | ## 4. AR(1) ACF 170 | 171 | Verify the formula for the ACVF and ACF of AR(1). 172 | 173 | ------------------------------------------------------------------------ 174 | 175 | For any linear process $X_t = \sum_{j=0}^\infty \psi_j W_{t-j}$, we have 176 | 177 | $$ 178 | \gamma_X(h) = \sigma^2\sum_{j=0}^\infty \psi_j\psi_{j+h} 179 | $$ 180 | 181 | Now, note that for AR(1), we have $X_t = \sum_{j=0}^\infty \phi^j W_{t-j}$. Hence, plugging in $\psi_j = \phi^j$ gives 182 | 183 | $$ 184 | \begin{split} 185 | \gamma_X(h) & = \sigma^2\sum_{j=0}^\infty \phi^{2j+h} \\ 186 | & = \frac{\sigma^2\phi^h}{1-\phi^2}. 187 | \end{split} 188 | $$ 189 | 190 | To compute the ACF, we have 191 | 192 | $$ 193 | \rho_X(h) = \frac{\gamma_X(h)}{\gamma_X(0)} = \phi^h. 194 | $$ 195 | 196 | ------------------------------------------------------------------------ 197 | 198 | ## 5. AR(p) theorems 199 | 200 | Understand the proofs of the theorems. 201 | -------------------------------------------------------------------------------- /demonstrations/week7-questions.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 7: Review" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | ```{r} 10 | #| message: FALSE 11 | library(fpp3) 12 | library(tidyverse) 13 | library(slider) 14 | library(gridExtra) 15 | ``` 16 | 17 | ## Summary 18 | 19 | ### Data wrangling and visualization 20 | 21 | - How to create tsibbles? 22 | - What are the components of the tsibble data strucutre, in particular its index and key variables? 23 | - How to detect and fill in missing or duplicated entries? 24 | - How to filter a tsibble? 25 | - How to make and interpret the following types of plots? 26 | - Time plot 27 | - Seasonal plot 28 | - Seasonal subseries plot 29 | - Scatter plots 30 | - Lag plots 31 | - Time series patterns: Trend, seasonality, cycles 32 | - How are these defined? 33 | - How to recognize them from the plots? 34 | 35 | ### Transformations 36 | 37 | - How to implement the following transformations in R, when to use them, how to interpret the transformed time series? 38 | - Lags 39 | - Differences 40 | - Seasonal differences 41 | - Log transformation 42 | - Box-Cox transformations 43 | - Aggregation and downsampling 44 | - Moving averages and other rolling window transformations 45 | - Calendar adjustment 46 | - Population adjustment 47 | - Inflation adjustment 48 | - What is the effect of window size on moving averages, especially for seasonal time series? 49 | 50 | ### Decomposition 51 | 52 | - Time series components: Trend, seasonal and remainder 53 | - How are these defined? 54 | - How are they related to time series patterns? 55 | - Classical decomposition, in both additive and multiplicative forms 56 | - What are its assumptions? 57 | - How is it defined? 58 | - How do the assumptions lead to consistent estimation of the components? 59 | - How to implement it in R? 60 | - What are some problems with the classical decomposition, and how can these be overcome? 61 | 62 | ### Summary statistics 63 | 64 | - What are summary statistics? 65 | - How are the following summary statistics defined, how can they be computed, what are they used for? 66 | - (Sample) mean, variance, quantiles 67 | - (Sample) autocovariance and autocorrelation functions 68 | - (Sample) cross-correlation 69 | - Decomposition statistics: Strength of trend and strength of seasonality 70 | - ACF plots 71 | - How to make and interpret them? 72 | - How does the plot look like when the time series is dominated by trend, seasonality, or short-term cycles? 73 | - What is the use of summary statistics in time series classification? 74 | 75 | ### Introduction to forecasting 76 | 77 | - How are the following terms precisely defined? 78 | - Forecast 79 | - Forecast horizon 80 | - Forecast error 81 | - Simple forecasting methods: How they are defined, how to implement them in R? 82 | - Mean method 83 | - Naive method 84 | - Seasonal naive method 85 | - Linear trend method 86 | - Drift method 87 | - Seasonal naive method with drift 88 | - How can decomposition and transformations be used in forecasting? 89 | - What are the statistical models associated with the simple forecasting methods? 90 | - Prediction intervals 91 | - How are they defined? 92 | - How can they be calculated and plotted? 93 | - How much should we trust them? 94 | - Forecast errors 95 | - What error metrics are used? 96 | - Why do we preferred scaled errors? How can we interpret them? 97 | - Train-test splits 98 | - How is it defined? How to implement it in R? 99 | - Why can we not perform random splits? 100 | - What is their limitation? 101 | - Time series cross-validation 102 | - How is it defined? 103 | - How can it be implemented in R? 104 | - How can we interpret the error? 105 | - What do the `.step` and `.init` parameters mean? And what is the tradeoff between setting a small value or large value? 106 | - How many error terms are used in calculating the total error? 107 | - How can we calculate the TSCV error for only $h$-step ahead forecasts? 108 | 109 | ### Exponential smoothing 110 | 111 | - For the following exponential smoothing methods, how are the methods defined? How can they be implemented in R? 112 | - Simple exponential smoothing 113 | - Holt linear trend method 114 | - Damped trend method 115 | - Holt-Winters' methods 116 | - How are the parameters optimized? 117 | - What is the meaning of each parameter? How can they be computed using R? 118 | - When is each method preferred? 119 | - What is the difference between additive and multiplicative versions of Holt-Winters? 120 | - What happens when terms in the model are not specified when calling `ETS()`? 121 | 122 | ### Stationary processes 123 | 124 | - What is a time series model? 125 | - How are weakly and strictly stationary process defined? 126 | - How is joint stationarity defined? 127 | - Mean, autocovariance, autocorrelation, and cross-correlation functions 128 | - How are they defined? 129 | - How to calculate them for simple time series models? 130 | - How are the following types of time series models defined? 131 | - White noise 132 | - Random walk 133 | - Signal plus noise 134 | - Linear process 135 | - Gaussian process 136 | - Asymptotic normality theorems for mean and ACF 137 | - What are the assumptions for the two theorems? 138 | - What is the limiting behavior for white noise? 139 | - What is the Box-Jenkins method? What is its relationship to stationary processes? 140 | - What are two methods of transforming a time series to make it stationary? 141 | - What are residuals? 142 | - How can we use an ACF plot to test whether a time series is drawn from a white noise model? 143 | - Ljung-Box test 144 | - What is the test statistic? 145 | - What is the limiting behavior of the test statistic? 146 | - How is the test defined? 147 | - How can we implement it using R? 148 | - How can we choose the lag for the test? 149 | - How to simulate a time series from a time series model in R? 150 | 151 | ## Questions 152 | 153 | a. Load the data set `sg-births.csv`. 154 | 155 | b. Make time, seasonal, and seasonal subseries plots. 156 | 157 | c. Comment on all interesting features of the plots. 158 | 159 | d. Without using software, sketch an ACF plot of the time series (the numbers don't have to be exactly correct, just the overall pattern). 160 | 161 | e. Will a Box-Cox transformation be appropriate for this time series? 162 | 163 | f. What sort of transformation may help to improve forecasting? 164 | 165 | g. Will a classical decomposition be appropriate for this time series? What could you use to improve on classical decomposition? 166 | 167 | h. Is this time series stationary? 168 | 169 | i. Is the remainder component stationary? 170 | 171 | j. Which of forecasting methods we have learnt may be appropriate for this time series? 172 | 173 | k. Fit an additive Holt-Winters model. How can the model parameters be extracted? How can we visualize the different components of the model? Compute a forecast for March 2024 by hand. Check whether it agrees with the computed value. 174 | 175 | l. Perform time series cross-validation to compare the different models for the forecast horizon $h=3$. Which model would you pick? 176 | 177 | m. Are you satisfied with the best model? Why or why not? 178 | -------------------------------------------------------------------------------- /demonstrations/week6.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 6 Demonstration" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | ```{r} 10 | #| message: FALSE 11 | library(fpp3) 12 | library(tidyverse) 13 | library(slider) 14 | library(gridExtra) 15 | ``` 16 | 17 | ## 1. ACVF, ACF, and stationarity 18 | 19 | Consider the time series defined as $$ 20 | X_t = U_1 \sin(2\pi \omega t) + U_2\cos(2\pi\omega t), 21 | $$ where $U_1$ and $U_2$ are independent random variables with zero mean and variance 1. 22 | 23 | a. Compute the ACVF of $(X_t)$. 24 | b. Is $(X_t)$ weakly stationary? 25 | c. Is $(X_t)$ strictly stationary? If not, what conditions can we put on $U_1$ and $U_2$ to make it stationary? 26 | 27 | $$ 28 | \begin{split} 29 | \gamma_X(s, t) & = \text{Cov}\lbrace X_t,X_s\rbrace \\ 30 | & = \text{Cov}\lbrace U_1 \sin(2\pi \omega s) + U_2\cos(2\pi\omega s), U_1 \sin(2\pi \omega t) + U_2\cos(2\pi\omega t)\rbrace \\ 31 | & = \sin(2\pi \omega s)\sin(2\pi\omega t)\text{Cov}\lbrace U_1, U_1 \rbrace + \sin(2\pi\omega s)\cos(2\pi\omega t)\text{Cov}\lbrace U_1, U_2 \rbrace \\ 32 | & \quad\quad + \cos(2\pi\omega s)\sin(2\pi\omega t)\text{Cov}\lbrace U_2, U_1 \rbrace + \cos(2\pi\omega s)\cos(2\pi\omega t)\text{Cov}\lbrace U_2, U_2 \rbrace \\ 33 | & = \sin(2\pi\omega s)\sin(2\pi\omega t) + \cos(2\pi\omega s)\cos(2\pi\omega t) \\ 34 | & = \cos(2\pi\omega(t-s)) 35 | \end{split} 36 | $$ 37 | 38 | Here, the last equality uses a triogonometric identity. Alternatively, can think of this as the dot product between two unit vectors. 39 | 40 | Observe that $\gamma_X(s, t)$ depends only on the difference $t-s$. We further have $$ 41 | \mu_X(t) = \mathbb{E}\lbrace U_1 \sin(2\pi \omega t) + U_2\cos(2\pi\omega t) \rbrace = 0, 42 | $$ which does not depend on $t$. As such, $(X_t)$ is weakly stationary. 43 | 44 | On the other hand, depending on the choice of $U_1, U_2$, it may not be strongly stationary. For instance, let $U_1$ and $U_2$ have the distribution given by $$ 45 | \mathbb{P}\lbrace U = 1\rbrace = \mathbb{P}\lbrace U = -1 \rbrace = 1/2. 46 | $$ This is known as the Rademacher distribution. Suppose also that $\omega = 1/8$. We then have $$ 47 | X_8 = U_1\sin(2\pi) + U_2\cos(2\pi) = U_2. 48 | $$ On the other hand, $$ 49 | X_1 = U_1\sin(\pi/4) + U_2\cos(\pi/4) = U_1/\sqrt{2} + U_2/\sqrt{2}. 50 | $$ As such, we have $$ 51 | \mathbb{P}\lbrace X_1 = \sqrt{2}\rbrace = \mathbb{P}\lbrace X_1 = -\sqrt{2}\rbrace = 1/4 52 | $$ $$ 53 | \mathbb{P}\lbrace X_1 = 0\rbrace = 1/2 54 | $$ 55 | 56 | If $U_1, U_2 \sim N(0,1)$, then the process is strictly stationary, since it is a Gaussian process, in which case, all finite dimensional distributions depend only on the mean and AVCF values. 57 | 58 | ------------------------------------------------------------------------ 59 | 60 | ## 2. ACF vs sample ACF 61 | 62 | Consider the linear trend model $$ 63 | X_t = \beta_0 + \beta_1 t + W_t. 64 | $$ 65 | 66 | a. Compute the ACF of $(X_t)$. 67 | b. Simulate a time series drawn from this model and plot its sample ACF. 68 | c. Why does the sample ACF not look like the population ACF function? 69 | d. Why does the asymptotic normality theorem for the ACF not apply? 70 | 71 | ------------------------------------------------------------------------ 72 | 73 | The ACF is $$ 74 | \gamma_X(s, t) = \text{Cov}\lbrace X_t,X_s\rbrace = \text{Cov}\lbrace W_t,W_s\rbrace = \begin{cases} 75 | 1 & \text{if}~s = t \\ 76 | 0 & \text{otherwise}. 77 | \end{cases} 78 | $$ 79 | 80 | This hence depends only on the difference $s-t$. 81 | 82 | ```{r} 83 | #| echo: TRUE 84 | beta0 <- 3 85 | beta1 <- 0.4 86 | ts_data <- 87 | tibble( 88 | idx = 1:200, 89 | wn = rnorm(200), 90 | xt = beta0 + beta1 * idx + wn 91 | ) |> 92 | as_tsibble(index = idx) 93 | ts_data |> 94 | ACF(xt) |> 95 | autoplot() 96 | ``` 97 | 98 | The sample ACF is calculated as $$ 99 | \hat\gamma_X(h) = \frac{1}{n}\sum_{i=1}^{n-h}(X_i - \bar X) (X_{i+h} - \bar X). 100 | $$ The expectation of each term is roughly $$ 101 | \mathbb{E}\lbrace(X_i - (\beta_0 + \beta n/2))X_{i+h} - (\beta_0 + \beta n/2))\rbrace. 102 | $$ This is not the covariance between them because $\beta_0 + \beta n /2$ is not their means unless $i = n/2$ or $i+h = n/2$. 103 | 104 | The asymptotic normality theorem does not apply because it requires the time series to be stationary. Since the mean function $\beta_0 + \beta_1 t$ depends on $t$, $(X_t)$ is not stationary. 105 | 106 | ------------------------------------------------------------------------ 107 | 108 | ## 3. Forecasting 109 | 110 | Let $(X_t)$ be a zero mean stationary process with $\rho_X(h) \neq 0$ for some $h$ 111 | 112 | a. Find $A$ minimizing $\mathbb{E}\lbrace (X_{n+h} - A X_n)^2 \rbrace$. 113 | b. Use this to make a forecast for $X_{n+h}$ given $X_1,\ldots,X_n$. 114 | c. What is the MSE for the forecast? 115 | d. What is the consequence of this for ACF values? 116 | 117 | ------------------------------------------------------------------------ 118 | 119 | $$ 120 | \begin{split} 121 | \frac{d}{dA}\mathbb{E}\lbrace (X_{n+h} - A X_n)^2 \rbrace & = \frac{d}{dA} \left(\mathbb{E}\lbrace X_{n+h}^2\rbrace - 2A\mathbb{E}\lbrace X_{n+h} X_n\rbrace + A^2\mathbb{E}\lbrace X_n^2 \rbrace\right) \\ 122 | & = -2\mathbb{E}\lbrace X_{n+h} X_n\rbrace + 2A\mathbb{E}\lbrace X_n^2 \rbrace. 123 | \end{split} 124 | $$ This is thus minimized by $$ 125 | A = \frac{\mathbb{E}\lbrace X_{n+h} X_n\rbrace}{\mathbb{E}\lbrace X_n^2 \rbrace} = \frac{\gamma_X(h)}{\gamma_X(0)} = \rho_X(h). 126 | $$ 127 | 128 | We can forecast via $$ 129 | \hat X_{n+h|n} := \rho_X(h)X_n. 130 | $$ The MSE for this forecast is $$ 131 | \begin{split} 132 | \mathbb{E}\lbrace(X_{n+h} - \hat X_{n+h|n})^2\rbrace & = \mathbb{E}\lbrace(X_{n+h} - \rho_X(h)X_n)^2\rbrace \\ 133 | & = \gamma_X(0) - 2\rho_X(h)\gamma_X(h) + \rho_X(h)^2\gamma_X(0) \\ 134 | & = \gamma_X(0) - \rho_X(h)^2\gamma_X(0) \\ 135 | & = \left(1 - \rho_X(h)\right)^2\gamma_X(0). 136 | \end{split} 137 | $$ This value is smaller than the variance of $X_{n+h}$, so it improves over forecasting the mean of the time series, which is zero. Therfore, if the ACF values for the residuals of a model are nonzero, we can improve the forecasting model. 138 | 139 | ------------------------------------------------------------------------ 140 | 141 | ## 4. Residual analysis 142 | 143 | a. What is the difference between innovation residuals and regular residuals? Why do we perform residual analysis on the former rather than the latter? 144 | b. Starting with the following code snippet, fit several models to the Australian takeaway turnover time series and analyze their residuals. Which models have a good fit? Compare this with their CV error. 145 | 146 | ```{r} 147 | takeaway <- aus_retail |> 148 | filter(Industry == "Takeaway food services") |> 149 | summarise(Turnover = sum(Turnover)) 150 | ``` 151 | 152 | ------------------------------------------------------------------------ 153 | 154 | If a transformation is performed, the innovation residuals are the one-step ahead forecasting errors, $y_t - \hat y_{t|t-1}$ for the transformed time series. The regular residuals are the errors for the original time series $x_t - \hat x_{t|t-1}$. 155 | 156 | We perform residual analysis for the former because the modeling assumption is that the innovation residuals are white noise. 157 | 158 | ```{r} 159 | fit <- takeaway |> 160 | model( 161 | naive = NAIVE(Turnover), 162 | drift = RW(Turnover ~ drift()), 163 | mean = MEAN(Turnover), 164 | snaive = SNAIVE(Turnover), 165 | snaive_drift = SNAIVE(Turnover ~ drift()), 166 | ets = ETS(Turnover), 167 | ets_log = ETS(log(Turnover)) 168 | ) 169 | 170 | fit |> 171 | augment() |> 172 | features(.innov, ljung_box, lag = 24) 173 | ``` 174 | 175 | ```{r} 176 | fit 177 | ``` 178 | 179 | ```{r} 180 | takeaway |> 181 | stretch_tsibble(.step = 20, .init = 200) |> 182 | model( 183 | naive = NAIVE(Turnover), 184 | drift = RW(Turnover ~ drift()), 185 | mean = MEAN(Turnover), 186 | snaive = SNAIVE(Turnover), 187 | snaive_drift = SNAIVE(Turnover ~ drift()), 188 | ets = ETS(Turnover ~ error("M") + trend("Ad") + season("M")), 189 | ets_log = ETS(log(Turnover) ~ error("A") + trend("A") + season("A")) 190 | ) |> 191 | forecast(h = 6) |> 192 | accuracy(takeaway) |> 193 | select(.model, RMSSE, MASE) |> 194 | arrange(MASE) 195 | ``` 196 | 197 | The ranking via the LB test statistic and the CV error do not entirely match. Note that the LB statistic is a reflection of training error and measures "goodness of fit". Furthermore, the residuals from different methods may be on different scales and hence are not entirely comparable. 198 | 199 | ------------------------------------------------------------------------ 200 | -------------------------------------------------------------------------------- /demonstrations/week9.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 9 Demonstration" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | ```{r} 10 | #| message: FALSE 11 | library(fpp3) 12 | library(tidyverse) 13 | library(slider) 14 | library(gridExtra) 15 | ``` 16 | 17 | ## 1. Sample trajectories 18 | 19 | Read Chapter 10.8 of the course notes. 20 | 21 | a. Sample a time series from a causal AR(2) model of length 50. You may choose your favorite parameters. 22 | b. In R, how can you choose different methods of estimators for fitting the model parameters? 23 | 24 | ------------------------------------------------------------------------ 25 | 26 | ```{r} 27 | set.seed(5209) 28 | n <- 50 29 | ar2_dat <- 30 | tibble( 31 | t = 1:n, 32 | X = arima.sim(model = list(ar = c(1.5, -0.75)), n = n) 33 | ) |> 34 | as_tsibble(index = t) 35 | 36 | ar2_dat |> 37 | autoplot(X) 38 | ``` 39 | 40 | In class, we learnt about 4 different estimators for the model parameters: 41 | 42 | - Method of moments / Yule-Walker 43 | 44 | - Full maximum likelihood 45 | 46 | - Conditional max likelihood / conditional least squares 47 | 48 | - Unconditional least squares 49 | 50 | The first 3 methods are implemented in base R and can be called using the `ar()` function. The documentation shows that the desired method can be specified: 51 | 52 | ``` 53 | ar(x, aic = TRUE, order.max = NULL, 54 | method = c("yule-walker", "burg", "ols", "mle", "yw"), 55 | na.action, series, ...) 56 | ``` 57 | 58 | Burg is yet another estimator. More info can be found in Brockwell and Davis. 59 | 60 | ------------------------------------------------------------------------ 61 | 62 | ## 2. AR(1) 63 | 64 | In Chapter 10.3 of the course notes, we showed how to compute forecasts and estimate model parameters for AR(1). 65 | 66 | a. Show directly that the AR(1) forecast is a best linear predictor. 67 | 68 | b. Show that the estimator we introduced was a method of moments estimator. 69 | 70 | c. What is the conditional maximum likelihood estimate for AR(1)? 71 | 72 | ------------------------------------------------------------------------ 73 | 74 | The forecast equation for AR(1) is 75 | 76 | $$ 77 | \hat X_{n+h|n} = \phi^h X_n 78 | $$ 79 | 80 | For part a), to check that it is the best linear predictor, we just need to show that the gradient conditions hold, i.e. that 81 | 82 | $$ 83 | \nabla_{\beta} \mathbb{E}\lbrace (X_{n+h} - \beta^T X_{n:1})^2\rbrace \big|_{\beta = (\phi^n,0,\ldots,0)} = 0. 84 | $$ 85 | 86 | Now, the (negative) gradient at our desired solution is given by 87 | 88 | $$ 89 | \begin{split} 90 | \mathbb{E}\lbrace(X_{n+h}-\phi^n X_n)X_{1:n}\rbrace 91 | \end{split} 92 | $$ 93 | 94 | Since 95 | 96 | $$ 97 | X_{n+h} = \sum_{j=0}^{h-1}\phi^jW_{n+h-j} + \phi^h X_n. 98 | $$ 99 | 100 | Plugging this into the above expression and cancelling $\phi^h X_n$, we see that all coordinates in the gradient are of the form 101 | 102 | $$ 103 | \mathbb{E}\left\lbrace \sum_{j=0}^{h-1}\phi^jW_{n+h-j}X_i\right\rbrace 104 | $$ 105 | 106 | for some $1 \leq i \leq n$. By assumption of causality, the white noise terms with index larger than $n$ are independent of $X_1,\ldots,X_n$, so this expectation is equal to 0. 107 | 108 | The estimator defined in the notes was $\hat\phi = \hat\rho(1)=\hat\gamma(1)/\hat\gamma(0)$. This is exactly equal to $\Gamma_1^{-1}\gamma(1)$. 109 | 110 | To get the conditional maximum likelihood, we write the negative log conditional likelihood as 111 | 112 | $$ 113 | -\log p_{\phi,\sigma^2,\mu}(x_2,x_3,\ldots,x_n|x_1) = \frac{n}{2}\log(2\pi \sigma^2) + \sum_{j=2}^n \frac{((x_j-\mu) - \phi (x_{j-1}-\mu))^2}{2\sigma^2} 114 | $$ 115 | 116 | Rerranging the sum of squares term gives 117 | 118 | $$ 119 | \sum_{j=2}^n (x_j - \phi x_{j-1} - (1-\phi)\mu)^2. 120 | $$ 121 | 122 | Differentiating this with respect to $\mu$, we get 123 | 124 | $$ 125 | -\sum_{j=2}^\infty (x_j - \phi x_{j-1} - (1-\phi)\mu)(1-\phi). 126 | $$ 127 | 128 | Setting to be equal to $0$, and using the MLE value for $\phi$, $\phi = \hat\phi$, we get 129 | 130 | $$ 131 | \hat\mu = \frac{\bar x_{2:n} - \hat\phi\bar x_{1:n-1}}{1-\hat\phi}. 132 | $$ 133 | 134 | Next, differentiating with respect to $\phi$, we get 135 | 136 | $$ 137 | \sum_{j=2}^n (x_j - \bar x_{2:n}) - \phi (x_{j-1} -\bar x_{1:n-1}))(x_{j-1} - \bar x_{1:n-1}). 138 | $$ 139 | 140 | Setting this to be equal to 0 gives 141 | 142 | $$ 143 | \hat\phi = \frac{\sum_{j=2}^n (x_j - \bar x_{2:n})(x_{j-1} - \bar x_{1:n-1})}{\sum_{j=2}^n (x_j - \bar x_{2:n})^2} 144 | $$ 145 | 146 | ------------------------------------------------------------------------ 147 | 148 | ## 3. Limiting forecast distribution 149 | 150 | What does the forecast distribution for AR(p) models converge to as $n \to \infty$? 151 | 152 | ------------------------------------------------------------------------ 153 | 154 | The point forecast is of the form 155 | 156 | $$ 157 | \hat x_{n+h|n} = \mu + \gamma_{h:n+h-1}^T\Gamma_n^{-1}(x_{n:1} - \mu). 158 | $$ 159 | 160 | We know that the ACVF values $\gamma(k) \to 0$ as $k \to \infty$. Hence, as a function of $h$, the second term converges to 0. 161 | 162 | The forecast variance is of the form 163 | 164 | $$ 165 | v_{n+h|n} = \gamma(0) - \gamma_{h:n+h-1}^T\Gamma_n^{-1}\gamma_{h:n+h-1}. 166 | $$ 167 | 168 | Using the same logic, the second term converges to 0. 169 | 170 | In summary, the forecast converges to the marginal distribution $N(\mu, \gamma(0))$. 171 | 172 | ------------------------------------------------------------------------ 173 | 174 | ## 4. Difference between estimators 175 | 176 | a. For AR(1), compute the difference between the mean estimators from the method of moments and conditional least squares approaches. 177 | b. How does the difference change as $n \to \infty$? 178 | 179 | ------------------------------------------------------------------------ 180 | 181 | We first write the (conditional) MLE in more suggestive notation: $$ 182 | \begin{split} 183 | \hat\mu_{MLE} & = \frac{\bar x_{2:n} - \hat\phi\bar x_{1:n-1}}{1-\hat\phi} \\ 184 | & = \frac{\frac{1}{n-1}\sum_{t=2}^n x_t - \frac{\hat\phi}{n-1}\sum_{t=1}^{n-1}x_t}{1-\hat\phi} \\ 185 | & = \sum_{t=1}^{n} a_t x_t, 186 | \end{split} 187 | $$ 188 | 189 | where $$ 190 | a_t = \begin{cases} 191 | -\frac{\hat\phi}{1-\hat\phi}\frac{1}{n-1} & t = 1 \\ 192 | \frac{1}{n-1} & 2 \leq t \leq n-1 \\ 193 | \frac{1}{1-\hat\phi}\frac{1}{n-1} & t = n. 194 | \end{cases} 195 | $$ 196 | 197 | The method of moments estimator is just the sample mean 198 | 199 | $$ 200 | \hat\mu_{YW} = \bar x_{1:n}. 201 | $$Taking the difference between the two estimators then gives 202 | 203 | $$ 204 | \begin{split} 205 | \left| \hat\mu_{MLE} - \hat\mu_{YW}\right| & = \left| \sum_{t=1}^n (a_t - 1/n)x_t\right| \\ 206 | & \leq \sum_{t=1}^n |a_t - 1/n| |x_t|. 207 | \end{split} 208 | $$ 209 | 210 | We have 211 | 212 | $$ 213 | |a_t - 1/n| \leq \begin{cases} 214 | \frac{|\hat\phi|}{(1-\hat\phi)(n-1)} + \frac{1}{n} & t = 1 \\ 215 | \frac{1}{n(n-1)} & 2 \leq t \leq n-1 \\ 216 | \frac{1}{1-\hat\phi}\frac{1}{n-1} + \frac{1}{n} & t = n. 217 | \end{cases} 218 | $$ 219 | 220 | Plugging this into the above expression, we get 221 | 222 | $$ 223 | \begin{split} 224 | \left| \hat\mu_{MLE} - \hat\mu_{YW}\right| & \leq \sum_{t=2}^{n-1} \frac{1}{n(n-1)} |x_t| + O(1/n)\cdot|x_1| + O(1/n)\cdot |x_n| \\ 225 | & = O(1/n) \cdot \max_{1 \leq t \leq n} |x_t| 226 | \end{split} 227 | $$ 228 | 229 | ------------------------------------------------------------------------ 230 | 231 | ## 5. Nonlinear autoregressive models 232 | 233 | Fit a nonlinear AR model on the `globtemp` dataset. Compute its sum of squared residuals and compare it to that of a linear AR model. 234 | 235 | ------------------------------------------------------------------------ 236 | 237 | ```{r} 238 | library(caret) 239 | globtemp <- read_rds("../_data/cleaned/globtemp.rds") 240 | 241 | # Create a dataset with columns containing lagged values 242 | trainset <- globtemp |> 243 | as_tsibble() |> 244 | rename(X = value) |> 245 | mutate(lag1 = lag(X), 246 | lag2 = lag(lag1), 247 | lag3 = lag(lag2), 248 | lag4 = lag(lag3)) |> 249 | filter_index("1884" ~ .) 250 | 251 | # Fit KNN model 252 | knn_fit <- train(X ~ lag1 + lag2 + lag3 + lag4, data = trainset, method = "knn") 253 | 254 | # Compute training set error 255 | mean(predict(knn_fit, new_data = trainset) - trainset$X) ** 2 256 | ``` 257 | 258 | ```{r} 259 | # Compute training error for AR model 260 | ar_resids <- trainset |> 261 | model(AR(X)) |> 262 | residuals() |> 263 | pull(.resid) 264 | 265 | mean(ar_resids ** 2, na.rm = TRUE) 266 | ``` 267 | 268 | Training error for k-NN model is smaller. 269 | 270 | ------------------------------------------------------------------------ 271 | -------------------------------------------------------------------------------- /demonstrations/week4.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 4 Demonstration" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | ```{r} 10 | #| message: FALSE 11 | library(fpp3) 12 | library(tidyverse) 13 | library(slider) 14 | library(gridExtra) 15 | library(broom) 16 | ``` 17 | 18 | ## 1. Simple forecasting strategies and statistical models 19 | 20 | For all methods, note that the forecast distribution is the conditional distribution for $x_{n+h}$ given the observed data and the fitted parameter, i.e., it is 21 | 22 | $$ 23 | p_{\hat \theta}(x_{n+h}|x_1,x_2,\ldots,x_n) 24 | $$ 25 | 26 | ### Mean method 27 | 28 | Show that the mean method is derived from the statistical model shown in the video, i.e. $$ 29 | x_t = \theta + \epsilon_t 30 | $$ with $\epsilon_1,\epsilon_2,\ldots,\epsilon_n \sim_{i.i.d.} \mathcal{N}(0,\sigma^2)$. 31 | 32 | ------------------------------------------------------------------------ 33 | 34 | The mean method gives the forecast 35 | 36 | $$ 37 | \hat x_{n+h|n} = \frac{1}{n}\sum_{t=1}^n x_t. 38 | $$ 39 | 40 | Given the statistical model above, the forecast distribution has mean equal to $\theta$. Hence, we just need to know what is the estimate of $\hat\theta$ from $x_1,x_2,\ldots,x_n$. 41 | 42 | Now observe that $x_1,x_2,\ldots,x_n$ are i.i.d. Gaussians with the same mean. 43 | 44 | Hence, the best estimate is the sample mean $\bar x_n$. 45 | 46 | More rigorously, we can write the likelihood as 47 | 48 | $$ 49 | p_\theta(x_{1:n}) \propto \exp\left(- \frac{1}{2\sigma^2}\sum_{t=1}^n (x_t - \theta)^2 \right) 50 | $$ 51 | 52 | Taking a logarithm gives 53 | 54 | $$ 55 | \log p_\theta(x_{1:n}) = - \frac{1}{2\sigma^2}\sum_{t=1}^n (x_t - \theta)^2 + C. 56 | $$ 57 | 58 | This is maximized by $\bar x_n$. 59 | 60 | ------------------------------------------------------------------------ 61 | 62 | ### Naive method 63 | 64 | Show that the naive method is derived from the statistical model shown in the video, i.e. $$ 65 | x_t = x_{t-1} + \epsilon_t 66 | $$ {#eq-naive-method} with $\epsilon_1,\epsilon_2,\ldots,\epsilon_n \sim_{i.i.d.} \mathcal{N}(0,\sigma^2)$. 67 | 68 | ------------------------------------------------------------------------ 69 | 70 | The naive method gives the forecast 71 | 72 | $$ 73 | \hat x_{n+h|n} = x_n 74 | $$ 75 | 76 | To derive this from the model, recurse @eq-naive-method to get 77 | 78 | $$ 79 | x_{n+h} = x_n + \epsilon_{n+1} + \epsilon_{n+2} + \cdots + \epsilon_{n+h}. 80 | $$ 81 | 82 | This shows that 83 | 84 | $$ 85 | x_{n+h}|x_{1:n} \sim \mathcal{N}(x_n,h\sigma^2). 86 | $$ 87 | 88 | The mean of this distribution is $x_n$. 89 | 90 | Note that this also gives the distributional forecast. 91 | 92 | ------------------------------------------------------------------------ 93 | 94 | ### Seasonal naive method 95 | 96 | What is the statistical model associated with the seasonal naive method? 97 | 98 | ------------------------------------------------------------------------ 99 | 100 | The seasonal naive method gives the forecast 101 | 102 | $$ 103 | \hat x_{n+h|n} = x_{n - p + (h~\text{mod}~p)}. 104 | $$ 105 | 106 | In analogy with the naive method, we have 107 | 108 | $$ 109 | x_t = x_{t-p} + \epsilon_t 110 | $$ 111 | 112 | ------------------------------------------------------------------------ 113 | 114 | ### Linear trend method 115 | 116 | What is the statistical model for the linear trend method? 117 | 118 | ------------------------------------------------------------------------ 119 | 120 | We have already seen this model in the notes. It is 121 | 122 | $$ 123 | x_t = \beta_0 + \beta_1 t + \epsilon_t 124 | $$ 125 | 126 | ------------------------------------------------------------------------ 127 | 128 | ### Drift method 129 | 130 | Consider the statistical model $$ 131 | x_t = \theta + x_{t-1} + \epsilon_t. 132 | $$ This is a random walk with drift $\theta$. What is the conditional distribution $p_\theta(x_t|x_{t-1})$? What is maximum likelihood estimate for $\theta$? If we use this for forecasting, what is the formula for the $h$-step ahead forecast? 133 | 134 | ------------------------------------------------------------------------ 135 | 136 | Similar to the naive method, we have 137 | 138 | $$ 139 | x_{n+h} = x_n + h\theta + \sum_{t=n+1}^{n+h} \epsilon_t 140 | $$ 141 | 142 | so that the mean of the forecast distribution is 143 | 144 | $$ 145 | \hat x_{n+h|n} = x_n + h\theta. 146 | $$ 147 | 148 | Similar to the mean method, we just have to estimate $\theta$. 149 | 150 | We have 151 | 152 | $$ 153 | p_\theta(x_t|x_{t-1}) \propto \exp\left(-\frac{1}{2\sigma^2}(x_t - \theta - x_{t-1})^2\right) 154 | $$ 155 | 156 | Multiplying these together for $t=2,3,\ldots,n)$, we get 157 | 158 | $$ 159 | p(x_2\ldots,x_n|x_1) \propto \exp\left(-\frac{1}{2\sigma^2}\sum_{t=2}^n (x_t - x_{t-1} - \theta)^2\right) 160 | $$ 161 | 162 | The maximizer is hence $\hat\theta = \frac{1}{n-1}\sum_{t=2}^n (x_t - x_{t-1}) = \frac{x_n - x_1}{n-1}$. 163 | 164 | The forecast is thus 165 | 166 | $$ 167 | \hat x_{n+h|n} = x_n + h \cdot \frac{x_n-x_1}{n-1}. 168 | $$ 169 | 170 | ------------------------------------------------------------------------ 171 | 172 | ## 2. Drift vs linear trend method 173 | 174 | The drift method can be fit using the code `RW(y ~ drift())`. Starting with the following code snippet, compute forecasts for the next 50 years using the drift method and the linear trend method for the population of Australia. 175 | 176 | ```{r} 177 | global_economy |> filter(Country == "Australia") 178 | ``` 179 | 180 | Which forecast looks better? Which prediction intervals are more realistic? 181 | 182 | Can you explain the connection between this and the statistical modeling assumptions? 183 | 184 | ------------------------------------------------------------------------ 185 | 186 | ```{r} 187 | global_economy |> 188 | filter(Country == "Australia") |> 189 | model(LinTrend = TSLM(Population ~ trend()), 190 | Drift = NAIVE(Population ~ drift())) |> 191 | forecast(h = 50) |> 192 | autoplot(global_economy) 193 | ``` 194 | 195 | The drift method forecast looks better as it starts closer to the last value of the time series. 196 | 197 | The drift method's prediction intervals become wider over time, while the linear trend method prediction intervals do not. The former is thus more realistic. 198 | 199 | The assumption for the linear trend method is that there is a deterministic trend and the noise is purely observational. 200 | 201 | The assumption for the drift method is that there is an inherent state that is changing stochastically over time. 202 | 203 | The latter more accurately describes population growth, while the former more accurately describes something like the position of a particle moving in a vacuum, where the position is measured by a noisy instrument. 204 | 205 | ------------------------------------------------------------------------ 206 | 207 | ## 3. Seasonal naive method with drift 208 | 209 | We have learnt one way to model both linear trend and seasonality by using time series decomposition. Here, we introduce another method. 210 | 211 | Think of a modification of the seasonal naive model to incorporate drift. What is the statistical model? What is the forecast equation? 212 | 213 | The method can be fit using the code `SNAIVE(y ~ drift())`. 214 | 215 | ------------------------------------------------------------------------ 216 | 217 | Statistical model: 218 | 219 | $$ 220 | x_t = x_{t-p} + \theta + \epsilon_t 221 | $$ 222 | 223 | Repeating the steps from the seasonal naive method derivation, we have 224 | 225 | $$ 226 | \hat\theta = \frac{1}{n-p}\sum_{t=p+1}^n (x_t - x_{t-p}) 227 | $$ 228 | 229 | To get the forecast, we count the number of drift terms to add: It is $(h - k)/p + 1$, where $k = h~\text{mod}~p$. Combining this with the formula for $\hat\theta$ gives 230 | 231 | $$ 232 | \hat x_{n+h|n} = x_{n - p + k} + \frac{(h-k)/p + 1}{n-p}\sum_{t=p+1}^n(x_t - x_{t-p}). 233 | $$ 234 | 235 | ------------------------------------------------------------------------ 236 | 237 | ## 4. Forecasting 238 | 239 | Which of `NAIVE`, `SNAIVE`, `NAIVE(y ~ drift())` and `SNAIVE(y ~ drift())` are most appropriate for the following datasets? 240 | 241 | - Bricks (`aus_production`) 242 | 243 | - Household wealth (`hh_budget`) 244 | 245 | ------------------------------------------------------------------------ 246 | 247 | ```{r} 248 | aus_production |> 249 | autoplot(Bricks) 250 | ``` 251 | 252 | The time plot shows strong seasonality and a possibly nonlinear trend. 253 | 254 | We hence try out seasonal naive with and without drift. 255 | 256 | ```{r} 257 | aus_production |> 258 | filter(!is.na(Bricks)) |> 259 | model(SNaive = SNAIVE(Bricks), 260 | SNaiveDrift = SNAIVE(Bricks ~ drift())) |> 261 | forecast() |> 262 | autoplot(aus_production, level = NULL) 263 | ``` 264 | 265 | ```{r} 266 | hh_budget |> 267 | autoplot(Wealth) 268 | ``` 269 | 270 | There does not seem to be seasonality in any of the four time series, but they seem to exhibit some upward trend. Hence, we will try applying the naive method with drift. 271 | 272 | ```{r} 273 | hh_budget |> 274 | model(NAIVE(Wealth ~ drift())) |> 275 | forecast(h = 10) |> 276 | autoplot(hh_budget) 277 | ``` 278 | 279 | ------------------------------------------------------------------------ 280 | 281 | ## 5. Prediction intervals 282 | 283 | Consider the `aus_arrivals` dataset. Filter the time series of arrivals from Japan to before 1995, and fit `NAIVE`, `SNAIVE`, `NAIVE(y ~ drift())` and `SNAIVE(y ~ drift())` . Use the fitted models to forecast the rest of the time series. 284 | 285 | Which model seems like the best fit given the data up to Q4 1994? 286 | 287 | Do their prediction intervals contain the truth? 288 | 289 | ------------------------------------------------------------------------ 290 | 291 | ```{r} 292 | #| warning: FALSE 293 | aus_jap_before95 <- aus_arrivals |> 294 | filter(Origin == "Japan") |> 295 | filter_index(~ "1994 Q4") 296 | 297 | aus_jap_fc <- aus_jap_before95 |> 298 | model(Naive = NAIVE(Arrivals), 299 | SNaive = SNAIVE(Arrivals), 300 | Drift = NAIVE(Arrivals ~ drift()), 301 | SDrift = SNAIVE(Arrivals ~ drift())) |> 302 | forecast(h = 71) 303 | ``` 304 | 305 | ```{r} 306 | aus_jap_fc |> autoplot(aus_jap_before95, level = NULL) 307 | ``` 308 | 309 | The seasonal naive method with drift seems like the best method, looking at the historical data from before 1995, but its prediction intervals do not contain the future values of the time series. 310 | 311 | ```{r} 312 | aus_jap_fc |> filter(.model == "SDrift") |> 313 | autoplot(aus_arrivals) 314 | ``` 315 | 316 | The moral of the story is that, as mentioned in the video lecture, we should not take prediction intervals at face value, as they depend on the fitted model being "correct". This is rarely the case, especially given the possibility of future unforeseen (and therefore unmodeled) scenarios. 317 | -------------------------------------------------------------------------------- /demonstrations/week3.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 3 Demonstration" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | ```{r} 10 | #| message: FALSE 11 | library(fpp3) 12 | library(tidyverse) 13 | library(slider) 14 | library(gridExtra) 15 | library(broom) 16 | ``` 17 | 18 | ## Computing classical decomposition 19 | 20 | *Compute a classical decomposition for the following time series without using 21 | the `classical_decomposition()` function.* 22 | 23 | ```{r} 24 | aus_arrivals_jap <- aus_arrivals |> 25 | filter(Origin == "Japan") |> 26 | select(Quarter, Arrivals) 27 | ``` 28 | 29 |
30 | 31 | We first create a trend and detrended columns. 32 | 33 | ```{r} 34 | detrended <- aus_arrivals_jap |> 35 | mutate(ArrivalsTrend = slide_dbl(Arrivals, mean, .before = 4, .after = 3), 36 | ArrivalsDetrended = Arrivals - ArrivalsTrend) 37 | ``` 38 | 39 | Add dummies for the quarters. 40 | 41 | ```{r} 42 | temp <- detrended |> 43 | mutate(Q1 = quarter(Quarter) == 1, 44 | Q2 = quarter(Quarter) == 2, 45 | Q3 = quarter(Quarter) == 3) 46 | ``` 47 | 48 | Compute seasonal and remainder components. 49 | 50 | ```{r} 51 | hard_decomp <- detrended |> 52 | mutate(ArrivalsSeasonal = lm(ArrivalsDetrended ~ Q1 + Q2 + Q3, temp)$fitted, 53 | ArrivalsRemainder = ArrivalsDetrended - ArrivalsSeasonal) 54 | ``` 55 | 56 | Let us now run the automatic classical decomposition. 57 | 58 | ```{r} 59 | auto_decomp <- aus_arrivals_jap |> 60 | model(classical_decomposition(Arrivals)) |> 61 | components() 62 | ``` 63 | 64 | Comparing the two... 65 | 66 | ```{r} 67 | plt1 <- hard_decomp |> 68 | ggplot(aes(x = Quarter, y = ArrivalsTrend)) + 69 | geom_line() + 70 | geom_line(data = auto_decomp, 71 | mapping = aes(y = trend), color = "blue") 72 | 73 | plt2 <- hard_decomp |> 74 | ggplot(aes(x = Quarter, y = ArrivalsSeasonal)) + 75 | geom_line() + 76 | geom_line(data = auto_decomp, 77 | mapping = aes(y = seasonal), color = "blue") 78 | 79 | plt3 <- hard_decomp |> 80 | ggplot(aes(x = Quarter, y = ArrivalsRemainder)) + 81 | geom_line() + 82 | geom_line(data = auto_decomp, 83 | mapping = aes(y = random), color = "blue") 84 | 85 | grid.arrange(plt1, plt2, plt3, nrow = 3) 86 | ``` 87 | 88 | Quite similar. Some minor differences probably because of different window size 89 | for trend. 90 | 91 | ## Classical vs STL decomposition 92 | 93 | *Start with the following code snippet creating a time series of passengers * 94 | *flying on Ansett Airlines. Perform classical and STL decompositions and comment * 95 | *on their differences. Which do you trust more?* 96 | 97 | ```{r} 98 | melsyd_economy <- ansett |> 99 | filter(Airports == "MEL-SYD", Class == "Economy") |> 100 | mutate(Passengers = Passengers/1000) 101 | autoplot(melsyd_economy, Passengers) + 102 | labs(y = "Passengers ('000)") 103 | ``` 104 | 105 |
106 | 107 | If we try to compute a decomposition directly, we get an error saying that there 108 | are missing values. Let's first find the missing value and then fill it. 109 | 110 | ```{r} 111 | melsyd_economy |> 112 | scan_gaps() 113 | # Missing entry is 1987 W38 114 | ``` 115 | 116 | ```{r} 117 | melsyd_economy |> 118 | filter_index("1987 W35" ~ "1987 W40") 119 | ``` 120 | 121 | Considering the nearby values, it seems reasonable to impute the mean of the preceding and succeeding weeks. 122 | 123 | ```{r} 124 | melsyd_economy <- melsyd_economy |> 125 | fill_gaps(Passengers = (21.9 + 23.8) / 2) 126 | ``` 127 | 128 | We now perform classical and STL decompositions. 129 | 130 | ```{r} 131 | plt1 <- melsyd_economy |> 132 | model(classical_decomposition(Passengers)) |> 133 | components() |> 134 | autoplot() 135 | 136 | plt2 <- melsyd_economy |> 137 | model(STL(Passengers, robust = TRUE)) |> 138 | components() |> 139 | autoplot() 140 | 141 | grid.arrange(plt1, plt2, nrow = 2) 142 | ``` 143 | Here, we see that for classical decomposition, the zero passenger numbers between 144 | W34 and W40 in 1989 have caused a sharp downward shift over W34 to W40 in the 145 | seasonal component and also a significant dip in the trend component. 146 | This is undesirable because we know that these numbers are outliers---they are 147 | the result of an event that will not be repeated again (or at least that cannot 148 | be forecasted the available data). 149 | In comparison, the STL decomposition, after setting the option `robust = TRUE`, 150 | is able to put this portion of the time series entirely into the remainder 151 | component. 152 | 153 | Furthermore, note that the classical decomposition is not able to estimate the 154 | trend component at the very start and end of the time series, while STL is 155 | able to do so. 156 | 157 | ## White noise and ACF plots 158 | 159 | *Create a time series of length 200 comprising i.i.d. standard Gaussian measurements.* 160 | *Make a time plot of the time series as well as an ACF plot.* 161 | *Compare this with the remainder term from an STL decomposition of `aus_arrivals_jap`.* 162 | *What do you observe?* 163 | 164 |
165 | 166 | ```{r} 167 | set.seed(42) 168 | 169 | white_noise <- 170 | tsibble( 171 | x = 1:200, 172 | y = rnorm(200), 173 | index = x 174 | ) 175 | 176 | white_noise |> autoplot() 177 | white_noise |> ACF() |> autoplot() 178 | ``` 179 | 180 | The spikes of the ACF seem like random fluctations. 181 | They are also small in magnitude. 182 | Note that the blue horizontal lines are 95% confidence regions for the spikes if 183 | this were an ACF plot for a white noise time series. 184 | In other words, we should expect at most 5% of the spikes to exceed the blue lines, 185 | which is indeed the case here. 186 | 187 | Let us now consider the ACF plots for the remainder component for the STL 188 | decompositions of two time series. 189 | 190 | 191 | ```{r} 192 | aus_arrivals |> 193 | filter(Origin == "Japan") |> 194 | model(STL(Arrivals ~ trend() + season())) |> 195 | components() |> 196 | ACF(remainder) |> 197 | autoplot() 198 | ``` 199 | 200 | ```{r} 201 | #| message: FALSE 202 | #| warning: FALSE 203 | #| fig-cap: Energy demand in Victoria, Australia in January and February 2013, measured half-hourly. 204 | #| label: fig-decomposition-elec 205 | 206 | vic_elec |> 207 | filter(year(Time) == 2013, month(Time) %in% c(1,2)) |> 208 | model( 209 | STL(Demand ~ trend() + 210 | season(period = 48 * 7) + 211 | season(period = 48))) |> 212 | components() |> 213 | ACF(remainder) |> 214 | autoplot() 215 | 216 | ``` 217 | 218 | These do not look like white noise. 219 | Indeed 220 | 221 | ## Summary statistics 222 | 223 | Glance through the summary statistics described in [Chapter 4.4](https://otexts.com/fpp3/other-features.html) of Hyndman and Athanasopoulos (2021). What do the following summary statistics compute? 224 | 225 | - Strength of trend 226 | - Strength of seasonality 227 | - `shift_level_max` 228 | - `shift_level_index` 229 | - `var_tiled_var` 230 | 231 | When would they be useful? 232 | 233 | ## EDA with summary statistics 234 | 235 | *The follow code snippet generates summary statistics for the various time series * 236 | *in the `tourism` dataset.* 237 | 238 | ```{r} 239 | #| eval: FALSE 240 | tourism_features <- tourism |> 241 | features(Trips, feature_set(pkgs = "feasts")) 242 | ``` 243 | 244 | *Make a scatter plot of seasonal strength against trend strength and color the * 245 | *points according to `Purpose`. What can you tell from the plot?* 246 | 247 | *Perform PCA on the `tourism_features` dataframe and make a scatter plot of the * 248 | *first two PCs. What do you observe?* 249 | 250 |
251 | 252 | ```{r} 253 | # Takes awhile to run 254 | tourism_features <- tourism |> 255 | features(Trips, feature_set(pkgs = "feasts")) 256 | tourism_features 257 | ``` 258 | 259 | ```{r} 260 | tourism_features |> 261 | ggplot(aes(x = trend_strength, 262 | y = seasonal_strength_year, 263 | color = Purpose)) + 264 | geom_point() 265 | ``` 266 | 267 | The description of the `tourism` dataset says that it counts the quarterly 268 | overnight trips from 1998 Q1 to 2016 Q4 across Australia. 269 | There are about 304 such time series, one for every region in Australia and 270 | for one of 4 types of travel purposes. 271 | It seems that the time series of trips for holiday travel tend to be have 272 | high seasonal strength compared to other types of trips. 273 | It also seems that there almost all time series have have fairly strong 274 | trend and seasonal strength. 275 | 276 | We now perform PCA. [^1] 277 | 278 | [^1]: PCA is not part of the scope of this course. This is simply for illustrative purposes on what can be done as part of EDA with summary statistics. 279 | 280 | ```{r} 281 | pcs <- tourism_features |> 282 | select(-State, -Region, -Purpose) |> 283 | prcomp(scale = TRUE) |> 284 | augment(tourism_features) 285 | pcs |> 286 | ggplot(aes(x = .fittedPC1, y = .fittedPC2, col = Purpose)) + 287 | geom_point() + 288 | theme(aspect.ratio = 1) 289 | ``` 290 | 291 | Here, we also see a separation between the time series for holiday travel and 292 | other time series. 293 | We now inspect some of the outlier time series, i.e. those that have especially 294 | large values for the first PC. 295 | 296 | ```{r} 297 | pcs |> 298 | filter(.fittedPC1 > 10) |> 299 | left_join(tourism) |> 300 | as_tsibble(index = Quarter, key = c(Region, State, Purpose)) |> 301 | ggplot(aes(x = Quarter, y = Trips)) + 302 | geom_line() + 303 | facet_wrap(~ Region) 304 | ``` 305 | 306 | ## Time series EDA and classification using summary statistics 307 | 308 | *Use summary statistics to create a model for classifying the time series in this* *[dataset](https://kdd.ics.uci.edu/databases/synthetic_control/synthetic_control.html).* 309 | 310 |
311 | 312 | This will be explored more in the homework assignment. 313 | Here, we just display the code to wrangle the dataset. 314 | 315 | ```{r} 316 | control_charts <- read_table("../_data/raw/synthetic_control.data", 317 | col_names = FALSE) 318 | chart_type <- as.factor(rep(c("Normal", "Cyclic", "Increasing", "Decreasing", 319 | "Upward", "Downward"), each = 100)) 320 | control_charts <- control_charts |> 321 | mutate(Type = chart_type, 322 | key = 1:600) |> 323 | pivot_longer(cols = contains("X"), 324 | values_to = "value") |> 325 | mutate(Time = rep(1:60, 600)) |> 326 | select(Time, value, key, Type) |> 327 | as_tsibble(index = Time, 328 | key = c(key, Type)) 329 | 330 | ``` 331 | Here's a preliminary scatter plot using the trend strength and spikiness summary 332 | statistics. 333 | We see that "normal" control charts have small trend strength whereas all other 334 | time series seem have larger trend. 335 | This is probably due to there not being any seasonal component in the STL 336 | decomposition. 337 | 338 | ```{r} 339 | control_charts |> 340 | features(value, feat_stl) |> 341 | ggplot(aes(x = trend_strength, 342 | y = spikiness, 343 | color = Type)) + 344 | geom_point() 345 | ``` 346 | -------------------------------------------------------------------------------- /demonstrations/week7.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 7: Review" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | ```{r} 10 | #| message: FALSE 11 | library(fpp3) 12 | library(tidyverse) 13 | library(slider) 14 | library(gridExtra) 15 | ``` 16 | 17 | ## Summary 18 | 19 | ### Data wrangling and visualization 20 | 21 | - How to create tsibbles? 22 | - What are the components of the tsibble data strucutre, in particular its index and key variables? 23 | - How to detect and fill in missing or duplicated entries? 24 | - How to filter a tsibble? 25 | - How to make and interpret the following types of plots? 26 | - Time plot 27 | - Seasonal plot 28 | - Seasonal subseries plot 29 | - Scatter plots 30 | - Lag plots 31 | - Time series patterns: Trend, seasonality, cycles 32 | - How are these defined? 33 | - How to recognize them from the plots? 34 | 35 | ### Transformations 36 | 37 | - How to implement the following transformations in R, when to use them, how to interpret the transformed time series? 38 | - Lags 39 | - Differences 40 | - Seasonal differences 41 | - Log transformation 42 | - Box-Cox transformations 43 | - Aggregation and downsampling 44 | - Moving averages and other rolling window transformations 45 | - Calendar adjustment 46 | - Population adjustment 47 | - Inflation adjustment 48 | - What is the effect of window size on moving averages, especially for seasonal time series? 49 | 50 | ### Decomposition 51 | 52 | - Time series components: Trend, seasonal and remainder 53 | - How are these defined? 54 | - How are they related to time series patterns? 55 | - Classical decomposition, in both additive and multiplicative forms 56 | - What are its assumptions? 57 | - How is it defined? 58 | - How do the assumptions lead to consistent estimation of the components? 59 | - How to implement it in R? 60 | - What are some problems with the classical decomposition, and how can these be overcome? 61 | 62 | ### Summary statistics 63 | 64 | - What are summary statistics? 65 | - How are the following summary statistics defined, how can they be computed, what are they used for? 66 | - (Sample) mean, variance, quantiles 67 | - (Sample) autocovariance and autocorrelation functions 68 | - (Sample) cross-correlation 69 | - Decomposition statistics: Strength of trend and strength of seasonality 70 | - ACF plots 71 | - How to make and interpret them? 72 | - How does the plot look like when the time series is dominated by trend, seasonality, or short-term cycles? 73 | - What is the use of summary statistics in time series classification? 74 | 75 | ### Introduction to forecasting 76 | 77 | - How are the following terms precisely defined? 78 | - Forecast 79 | - Forecast horizon 80 | - Forecast error 81 | - Simple forecasting methods: How they are defined, 82 | - Mean method 83 | - Naive method 84 | - Seasonal naive method 85 | - Linear trend method 86 | - Drift method 87 | - Seasonal naive method with drift 88 | - How can decomposition and transformations be used in forecasting? 89 | - What are the statistical models associated with the simple forecasting methods? 90 | - Prediction intervals 91 | - How are they defined? 92 | - How can they be calculated and plotted? 93 | - How much should we trust them? 94 | - Forecast errors 95 | - What error metrics are used? 96 | - Why do we preferred scaled errors? How can we interpret them? 97 | - Train-test splits 98 | - How is it defined? How to implement it in R? 99 | - Why can we not perform random splits? 100 | - What is their limitation? 101 | - Time series cross-validation 102 | - How is it defined? 103 | - How can it be implemented in R? 104 | - How can we interpret the error? 105 | - What do the `.step` and `.init` parameters mean? And what is the tradeoff between setting a small value or large value? 106 | - How many error terms are used in calculating the total error? 107 | - How can we calculate the TSCV error for only $h$-step ahead forecasts? 108 | 109 | ### Exponential smoothing 110 | 111 | - For the following exponential smoothing methods, how are the methods defined? How can they be implemented in R? 112 | - Simple exponential smoothing 113 | - Holt linear trend method 114 | - Damped trend method 115 | - Holt-Winters' methods 116 | - How are the parameters optimized? 117 | - What is the meaning of each parameter? How can they be computed using R? 118 | - When is each method preferred? 119 | - What is the difference between additive and multiplicative versions of Holt-Winters? 120 | - What happens when terms in the model are not specified when calling `ETS()`? 121 | 122 | ### Stationary processes 123 | 124 | - What is a time series model? 125 | - How are weakly and strictly stationary process defined? 126 | - How is joint stationarity defined? 127 | - Mean, autocovariance, autocorrelation, and cross-correlation functions 128 | - How are they defined? 129 | - How to calculate them for simple time series models? 130 | - How are the following types of time series models defined? 131 | - White noise 132 | - Random walk 133 | - Signal plus noise 134 | - Linear process 135 | - Gaussian process 136 | - Asymptotic normality theorems for mean and ACF 137 | - What are the assumptions for the two theorems? 138 | - What is the limiting behavior for white noise? 139 | - What is the Box-Jenkins method? What is its relationship to stationary processes? 140 | - What are two methods of transforming a time series to make it stationary? 141 | - What are residuals? 142 | - How can we use an ACF plot to test whether a time series is drawn from a white noise model? 143 | - Ljung-Box test 144 | - What is the test statistic? 145 | - What is the limiting behavior of the test statistic? 146 | - How is the test defined? 147 | - How can we implement it using R? 148 | - How can we choose the lag for the test? 149 | - How to simulate a time series from a time series model in R? 150 | 151 | ## Questions 152 | 153 | a. Load the data set `sg-births.csv`. 154 | 155 | ```{r} 156 | sg_births <- read_rds("../_data/cleaned/sg-births.rds") 157 | ``` 158 | 159 | b. Make time, seasonal, and seasonal subseries plots. 160 | 161 | ```{r} 162 | sg_births |> autoplot(Births) 163 | ``` 164 | 165 | ```{r} 166 | sg_births |> gg_season(Births) 167 | ``` 168 | 169 | ```{r} 170 | sg_births |> gg_subseries(Births) 171 | ``` 172 | 173 | c. Comment on all interesting features of the plots. 174 | 175 | From the time plot, we observe a downward trend between 1960 and the late 1970s, there is then a rise and dip between 1985 and 2005, and then a small one between 2005 and 2023. 176 | 177 | From the seasonal plot, we observe a yearly seasonality, with peaks in October and troughs in February. This is a well-known pattern in demographics. The seasonality however becomes less pronounced over time. 178 | 179 | We also observe two unusually large spikes in October 1988 and October 1990, which is probably related to the Chinese zodiac. 180 | 181 | The subseries plot shows that the trend is consistent across all months. 182 | 183 | d. Without using software, sketch an ACF plot of the time series (the numbers don't have to be exactly correct, just the overall pattern). 184 | 185 | You should be able to sketch the graph below without having looked at it before hand. The trend implies highly positive values, while the seasonality will lead to a slight sinusoidal pattern of period 12. 186 | 187 | ```{r} 188 | sg_births |> ACF(Births) |> autoplot() 189 | ``` 190 | 191 | e. Will a Box-Cox transformation be appropriate for this time series? 192 | 193 | No. A Box-Cox transformation is not appropriate. These are applied when the fluctuations in a time series are positively correlated with its level. This does not seem to be th 194 | 195 | f. What sort of transformation may help to improve forecasting? 196 | 197 | We can use calendar adjustment (divide by `days_in_month`). It can be computed as follows: 198 | 199 | ```{r} 200 | sg_births_adjusted <- sg_births |> 201 | mutate(BirthsPerDay = Births / days_in_month(Month)) 202 | sg_births_adjusted |> gg_season(BirthsPerDay) 203 | ``` 204 | 205 | g. Will a classical decomposition be appropriate for this time series? What could you use to improve on classical decomposition? 206 | 207 | A classical decomposition is not appropriate because the seasonality changes and because there are strong outlier values in 1988. We can improve on this by using an STL decomposition with robust option selected. 208 | 209 | h. Is this time series stationary? 210 | 211 | No, the time series is not stationary since its mean function is not constant. 212 | 213 | i. Is the remainder component stationary? 214 | 215 | The remainder component is also not stationary. Its behavior seems to change over time. 216 | 217 | j. Which of forecasting methods we have learnt may be appropriate for this time series? 218 | 219 | Since there is seasonality, seasonal naive and various forms of Holt-Winters seem to be appropriate. Seasonal naive with drift is not appropriate as the trend does not appear to be linear. 220 | 221 | k. Fit an additive Holt-Winters model with damping. How can the model parameters be extracted? How can we visualize the different components of the model? Compute a forecast for March 2024 by hand. Check whether it agrees with the computed value. 222 | 223 | ```{r} 224 | fit <- sg_births |> 225 | model(HoltWinters = ETS(Births ~ error("A") + trend("Ad") + season("A"))) 226 | fit |> tidy() 227 | ``` 228 | 229 | ```{r} 230 | fit |> components() |> autoplot() 231 | ``` 232 | 233 | ```{r} 234 | sg_births |> tail() 235 | ``` 236 | 237 | The last observation is 2023 Dec, so $h = 3$ The forecast value is given by $\hat x_{n+3|n} = l_n + 3b_n + s_{n - 9}$, where $n$ is the time index of the last observation. To extract $l_n$, $b_n$ and $s_{n-9}$, we use the following code: 238 | 239 | ```{r} 240 | fit |> components() |> tail(10) 241 | ``` 242 | 243 | We thus calculate $$ 244 | \hat x_{n+3|n} = 2821.979 + (-0.075) * 3 + (-79.722) = 2742. 245 | $$ 246 | 247 | ```{r} 248 | # The point forecast is 2742 249 | fit |> forecast(h = 3) 250 | ``` 251 | 252 | l. Perform time series cross-validation to compare the different models for the forecast horizon $h=3$. Which model would you pick? 253 | 254 | ```{r} 255 | sg_births_cv <- sg_births |> 256 | stretch_tsibble(.init = 100, .step = 20) 257 | 258 | fc <- sg_births_cv |> 259 | model(SeasonalNaive = SNAIVE(Births), 260 | HWAdd = ETS(Births ~ error("A") + trend("A") + season("A")), 261 | HWMult = ETS(Births ~ error("M") + trend("A") + season("M")), 262 | HWAddDamp = ETS(Births ~ error("A") + trend("Ad") + season("A")), 263 | HWMultDamp = ETS(Births ~ error("M") + trend("Ad") + season("M"))) |> 264 | forecast(h = 3) 265 | 266 | fc |> accuracy(sg_births) |> 267 | select(.model, RMSSE, MASE) |> 268 | arrange(RMSSE) 269 | ``` 270 | 271 | The Holt-Winters multiplicative method either with or without damping seems to work the best. 272 | 273 | m. Are you satisfied with the best model? Why or why not? 274 | 275 | ```{r} 276 | sg_births |> 277 | model(HWMult = ETS(Births ~ error("M") + trend("A") + season("M")), 278 | HWMultDamp = ETS(Births ~ error("M") + trend("Ad") + season("M"))) |> 279 | augment() |> 280 | features(.innov, ljung_box, lag = 24) 281 | ``` 282 | 283 | We're not satisfied because the Ljung-Box test rejects the hypothesis that the residuals are stationary. This means that these models are not good fits. 284 | 285 | ```{r} 286 | sg_births |> 287 | model(HWMult = ETS(Births ~ error("M") + trend("A") + season("M"))) |> 288 | gg_tsresiduals() 289 | ``` 290 | -------------------------------------------------------------------------------- /demonstrations/week5.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Week 5 Demonstration" 3 | format: html 4 | editor: visual 5 | --- 6 | 7 | ## Set up 8 | 9 | ```{r} 10 | #| message: FALSE 11 | library(fpp3) 12 | library(tidyverse) 13 | library(slider) 14 | library(gridExtra) 15 | ``` 16 | 17 | ## 1. Train test split 18 | 19 | ```{r} 20 | takeaway <- aus_retail |> 21 | filter(Industry == "Takeaway food services") |> 22 | summarise(Turnover = sum(Turnover)) 23 | ``` 24 | 25 | a. Starting with the above snippet, create a training set for Australian takeaway food turnover (`aus_retail`) by withholding the last four years as a test set. 26 | 27 | ------------------------------------------------------------------------ 28 | 29 | First, we make a time plot to inspect the time series. 30 | 31 | ```{r} 32 | takeaway |> autoplot(Turnover) 33 | ``` 34 | 35 | The code to create the train set is as follows. 36 | 37 | ```{r} 38 | takeaway_train <- takeaway |> 39 | slice_head(n = nrow(takeaway) - (4 * 12)) 40 | ``` 41 | 42 | b. Fit all the appropriate benchmark methods to the training set and forecast the periods covered by the test set. 43 | 44 | ------------------------------------------------------------------------ 45 | 46 | ```{r} 47 | fit <- takeaway_train |> 48 | model( 49 | naive = NAIVE(Turnover), 50 | drift = RW(Turnover ~ drift()), 51 | mean = MEAN(Turnover), 52 | snaive = SNAIVE(Turnover), 53 | snaive_drift = SNAIVE(Turnover ~ drift()) 54 | ) 55 | fc <- fit |> forecast(h = "4 years") 56 | ``` 57 | 58 | ------------------------------------------------------------------------ 59 | 60 | c. Compute the accuracy of your forecasts. Which method does best? 61 | 62 | ------------------------------------------------------------------------ 63 | 64 | ```{r} 65 | fc |> 66 | accuracy(takeaway) |> 67 | arrange(MASE) 68 | ``` 69 | 70 | ------------------------------------------------------------------------ 71 | 72 | d. Make a time plot of the forecasts to verify this. 73 | 74 | ------------------------------------------------------------------------ 75 | 76 | ```{r} 77 | fc |> 78 | autoplot(takeaway, level = NULL) 79 | ``` 80 | 81 | ------------------------------------------------------------------------ 82 | 83 | e. Which error metrics are preferred and why? How to interpret them? 84 | 85 | ------------------------------------------------------------------------ 86 | 87 | RMSSE and MASE are preferred because they are more interpretable. They are MSE and MASE divided by the one-step-ahead training error of the naive method. This is similar logic to $R^2$. 88 | 89 | ------------------------------------------------------------------------ 90 | 91 | f. If RMSSE or MASE are larger than 1, does it mean that the forecast method is worse than the naive method? 92 | 93 | ------------------------------------------------------------------------ 94 | 95 | No, because the error for the naive method is computed on the training set. Furthermore, it is one-step-ahead error, whereas the test error is potentially over a long forecast horizon. 96 | 97 | ------------------------------------------------------------------------ 98 | 99 | d. What is a problem with doing a train test split? 100 | 101 | ------------------------------------------------------------------------ 102 | 103 | Cannot focus on a specific forecast horizon. 104 | 105 | ------------------------------------------------------------------------ 106 | 107 | ## 2. Cross-validation 108 | 109 | a. Perform cross-validation for Australian takeaway food turnover with $h=4$. 110 | 111 | ------------------------------------------------------------------------ 112 | 113 | ```{r} 114 | takeaway |> 115 | stretch_tsibble(.init = 50, .step = 5) |> 116 | model( 117 | naive = NAIVE(Turnover), 118 | drift = RW(Turnover ~ drift()), 119 | mean = MEAN(Turnover), 120 | snaive = SNAIVE(Turnover), 121 | snaive_drift = SNAIVE(Turnover ~ drift()) 122 | ) |> 123 | forecast(h = 4) |> 124 | accuracy(takeaway) 125 | ``` 126 | 127 | ------------------------------------------------------------------------ 128 | 129 | b. Why is the error smaller compared to a single train-test split? 130 | 131 | ------------------------------------------------------------------------ 132 | 133 | Because the CV error is measured with respect to forecasts that are 1 to 4 steps ahead. On the other hand, the train-test split error involved that of forecasts up to 48 steps ahead. 134 | 135 | ------------------------------------------------------------------------ 136 | 137 | c. Why might we want to set `.step` to a larger value? What goes wrong if we set it to be too large a value? 138 | 139 | ------------------------------------------------------------------------ 140 | 141 | `.step` controls the number of splits made. If it is too small, we have many splits, which may lead to high computational overhead. On the other hand, if it is too big, we have too few splits, which means that we compute the error over too few data points. 142 | 143 | ------------------------------------------------------------------------ 144 | 145 | d. If we are mostly interested in forecast accuracy 4 months ahead, how should we change the code to focus on this task? 146 | 147 | ------------------------------------------------------------------------ 148 | 149 | ```{r} 150 | takeaway |> 151 | stretch_tsibble(.init = 50, .step = 5) |> 152 | model( 153 | naive = NAIVE(Turnover), 154 | drift = RW(Turnover ~ drift()), 155 | mean = MEAN(Turnover), 156 | snaive = SNAIVE(Turnover), 157 | snaive_drift = SNAIVE(Turnover ~ drift()) 158 | ) |> 159 | forecast(h = 4) |> 160 | group_by(.id) |> 161 | mutate(h = ((row_number() - 1) %% 4) + 1) |> 162 | ungroup() |> 163 | filter(h == 4) |> 164 | as_fable(response = "Turnover", distribution = Turnover) |> 165 | accuracy(takeaway) 166 | ``` 167 | 168 | ------------------------------------------------------------------------ 169 | 170 | ## 3. Holt linear method and transformations 171 | 172 | Forecast the Chinese GDP from the `global_economy` data set using the Holt linear trend method. Experiment with damping and Box-Cox transformations. Try to develop an intuition of what each is doing to the forecasts. 173 | 174 | ------------------------------------------------------------------------ 175 | 176 | First, create the filtered dataset and plot it. 177 | 178 | ```{r} 179 | china_gdp <- global_economy |> 180 | filter(Country == "China") |> 181 | select(Year, GDP) 182 | 183 | china_gdp |> autoplot(GDP) 184 | ``` 185 | 186 | Seems like there is an exponential trend. Since Holt's method extrapolates the trend linearly, it makes sense to transform the time series so that the trend looks linear. A Box-Cox transformation with $\lambda = 0.2$ seems to do this reasonably well. 187 | 188 | ```{r} 189 | china_gdp |> 190 | autoplot(box_cox(GDP, 0.2)) 191 | ``` 192 | 193 | We will fit four models, exploring the vanilla and damped versions of Holt's method, together with combining it with either the Box-Cox transform above or the log transform. 194 | 195 | ```{r} 196 | fit <- china_gdp |> 197 | model( 198 | ets = ETS(GDP ~ error("A") + trend("A") + season("N")), 199 | ets_damped = ETS(GDP ~ error("A") + trend("Ad") + season("N")), 200 | ets_bc = ETS(box_cox(GDP, 0.2) ~ error("A") + trend("A") + season("N")), 201 | ets_log = ETS(log(GDP) ~ error("A") + trend("A") + season("N")) 202 | ) 203 | 204 | fit 205 | ``` 206 | 207 | We now plot the 20 year forecasts for all 4 methods and compare them. 208 | 209 | ```{r} 210 | fit |> 211 | forecast(h = "20 years") |> 212 | autoplot(china_gdp, level = NULL) 213 | ``` 214 | 215 | Damping didn't seem to have a large effect on the forecasts, but it seems like the transformation did. 216 | 217 | ------------------------------------------------------------------------ 218 | 219 | ## 4. Comparing exponential smoothing methods 220 | 221 | Fit ETS models to the following datasets. 222 | 223 | - `globtemp` 224 | - `fma::sheep` 225 | - `diabetes` 226 | - `gafa_stock` 227 | - `pelt` 228 | 229 | a. What happens when no formula is provided to `ETS`? 230 | 231 | ------------------------------------------------------------------------ 232 | 233 | In that case, `ETS` automatically performs model selection to pick the "best" ETS model. 234 | 235 | ------------------------------------------------------------------------ 236 | 237 | b. When are multiplicative errors chosen? 238 | 239 | ------------------------------------------------------------------------ 240 | 241 | They are chosen for `diabetes` and `gafa_stock`. 242 | 243 | ------------------------------------------------------------------------ 244 | 245 | c. How can we identify the model coefficients? 246 | 247 | ------------------------------------------------------------------------ 248 | 249 | Use `tidy()` on the mable (output of `model()`). 250 | 251 | ------------------------------------------------------------------------ 252 | 253 | ```{r} 254 | globtemp <- astsa::globtemp |> 255 | as_tsibble() |> 256 | rename(Year = index, 257 | Temp = value) 258 | 259 | globtemp_fit <- globtemp |> 260 | model(ETS(Temp)) 261 | 262 | globtemp_fit 263 | ``` 264 | 265 | The model chosen is SES. 266 | 267 | ```{r} 268 | globtemp_fit |> 269 | forecast(h = 20) |> 270 | autoplot(globtemp) 271 | ``` 272 | 273 | If we filter for only the years from 1960 onwards, we get Holt's linear method. 274 | 275 | ```{r} 276 | globtemp <- astsa::globtemp |> 277 | as_tsibble() |> 278 | filter_index("1960" ~ .) |> 279 | rename(Year = index, 280 | Temp = value) 281 | 282 | globtemp_fit <- globtemp |> 283 | model(ETS(Temp)) 284 | 285 | globtemp_fit 286 | ``` 287 | 288 | ```{r} 289 | globtemp_fit |> 290 | forecast(h = 20) |> 291 | autoplot(globtemp) 292 | ``` 293 | 294 | ```{r} 295 | globtemp_fit |> tidy() 296 | ``` 297 | 298 | Alpha and beta are very small, which indicates very slow decay in the weights, as befits the noisy time series. 299 | 300 | We now try to fit Holt's linear method to the full time series. We see that the fitted model parameters are different from when only fitting the time series from 1960 onward. Here, alpha is bigger, which implies faster decay in the weights. This is probably due to the changing level of the time series. 301 | 302 | ```{r} 303 | globtemp <- astsa::globtemp |> 304 | as_tsibble() |> 305 | rename(Year = index, 306 | Temp = value) 307 | 308 | globtemp_fit <- globtemp |> 309 | model(ETS(Temp ~ error("A") + trend("A") + season("N"))) 310 | 311 | globtemp_fit |> tidy() 312 | ``` 313 | 314 | ------------------------------------------------------------------------ 315 | 316 | ```{r} 317 | sheep <- fma::sheep |> 318 | as_tsibble() |> 319 | rename(Year = index, 320 | Sheep = value) 321 | 322 | sheep_fit <- sheep |> 323 | model(ETS(Sheep)) 324 | 325 | sheep_fit |> tidy() 326 | ``` 327 | 328 | Very large alpha means very fast decay in the weights. This is almost just the naive method. 329 | 330 | ```{r} 331 | sheep_fit |> 332 | forecast(h = 10) |> 333 | autoplot(sheep) 334 | ``` 335 | 336 | ------------------------------------------------------------------------ 337 | 338 | ```{r} 339 | diabetes <- read_rds("../_data/cleaned/diabetes.rds") 340 | 341 | diabetes_fit <- diabetes |> 342 | model(ETS(TotalC)) 343 | 344 | diabetes_fit |> 345 | forecast(h = 24) |> 346 | autoplot(diabetes) 347 | ``` 348 | 349 | ```{r} 350 | diabetes_fit 351 | ``` 352 | 353 | We end up with multiplicative Holt-Winters. 354 | 355 | ```{r} 356 | diabetes_fit |> tidy() 357 | ``` 358 | 359 | Alpha, beta, and gamma are all small, so the weights decay slowly. This implies that the time series patterns are quite consistent. 360 | 361 | ------------------------------------------------------------------------ 362 | 363 | ```{r} 364 | gafa_regular <- gafa_stock |> 365 | group_by(Symbol) |> 366 | mutate(trading_day = row_number()) |> 367 | ungroup() |> 368 | as_tsibble(index = trading_day, regular = TRUE) 369 | 370 | gafa_stock |> autoplot(Close) 371 | ``` 372 | 373 | ```{r} 374 | gafa_fit <- gafa_regular |> 375 | model(ETS(Close)) 376 | 377 | gafa_fit 378 | ``` 379 | 380 | ```{r} 381 | gafa_fit|> 382 | forecast(h = 50) |> 383 | autoplot(gafa_regular |> group_by_key() |> slice((n() - 100):n())) 384 | ``` 385 | 386 | ------------------------------------------------------------------------ 387 | -------------------------------------------------------------------------------- /_data/cleaned/GOOG.csv: -------------------------------------------------------------------------------- 1 | Date,Open,High,Low,Close,Adj Close,Volume 2 | 2019-01-02,50.828499,52.616001,50.785500,52.292500,52.292500,30652000 3 | 2019-01-03,52.049999,52.848999,50.703499,50.803001,50.803001,36822000 4 | 2019-01-04,51.629501,53.542000,51.370899,53.535500,53.535500,41878000 5 | 2019-01-07,53.575001,53.700001,52.737999,53.419498,53.419498,39638000 6 | 2019-01-08,53.805500,54.228001,53.026501,53.813999,53.813999,35298000 7 | 2019-01-09,54.082500,54.131500,53.320000,53.733002,53.733002,23986000 8 | 2019-01-10,53.382999,53.557499,52.885502,53.516499,53.516499,29128000 9 | 2019-01-11,53.159000,53.188751,52.424000,52.859501,52.859501,30416000 10 | 2019-01-14,52.346001,52.576500,52.062752,52.234501,52.234501,22886000 11 | 2019-01-15,52.508499,54.002499,52.367001,53.857498,53.857498,29272000 12 | 2019-01-16,54.000000,54.618752,53.966999,54.048500,54.048500,26636000 13 | 2019-01-17,53.973499,54.590000,53.674999,54.494999,54.494999,24854000 14 | 2019-01-18,55.000000,55.417599,54.544998,54.912998,54.912998,39112000 15 | 2019-01-22,54.400002,54.575500,53.173500,53.526001,53.526001,32270000 16 | 2019-01-23,53.867500,54.246498,52.987499,53.778500,53.778500,19340000 17 | 2019-01-24,53.824001,53.973751,53.035000,53.695000,53.695000,27226000 18 | 2019-01-25,54.250000,54.700001,54.091000,54.549500,54.549500,22382000 19 | 2019-01-28,54.005501,54.150002,53.189999,53.504002,53.504002,25686000 20 | 2019-01-29,53.633999,53.757500,52.793251,53.030998,53.030998,20436000 21 | 2019-01-30,53.421501,54.549999,53.342499,54.452999,54.452999,25596000 22 | 2019-01-31,55.150002,55.866501,54.770500,55.818501,55.818501,30766000 23 | 2019-02-01,55.619999,56.250000,55.244499,55.537498,55.537498,29244000 24 | 2019-02-04,55.632999,56.639999,55.451000,56.639999,56.639999,51530000 25 | 2019-02-05,56.242001,57.342499,55.862400,57.299500,57.299500,71044000 26 | 2019-02-06,56.978500,57.349998,55.638500,55.761501,55.761501,42112000 27 | 2019-02-07,55.208000,55.242001,54.299999,54.935501,54.935501,40896000 28 | 2019-02-08,54.349998,54.945499,54.327499,54.752998,54.752998,21516000 29 | 2019-02-11,54.847500,55.297249,54.643002,54.750500,54.750500,21304000 30 | 2019-02-12,55.340000,56.264751,55.292500,56.068501,56.068501,32182000 31 | 2019-02-13,56.249500,56.736500,55.924999,56.007999,56.007999,20996000 32 | 2019-02-14,55.902500,56.411499,55.522251,56.083500,56.083500,18952000 33 | 2019-02-15,56.504002,56.583500,55.532501,55.682499,55.682499,28996000 34 | 2019-02-19,55.500000,56.094501,55.500000,55.928001,55.928001,20928000 35 | 2019-02-20,55.999500,56.170502,55.264000,55.689999,55.689999,21756000 36 | 2019-02-21,55.542000,55.597000,54.625999,54.848499,54.848499,28302000 37 | 2019-02-22,55.044998,55.562000,54.779999,55.518501,55.518501,20990000 38 | 2019-02-25,55.799999,55.926998,55.363499,55.470001,55.470001,28262000 39 | 2019-02-26,55.287498,55.975498,54.995998,55.756500,55.756500,29426000 40 | 2019-02-27,55.347500,55.898998,55.049999,55.802502,55.802502,19368000 41 | 2019-02-28,55.564999,56.382500,55.550499,55.995998,55.995998,30850000 42 | 2019-03-01,56.244999,57.148499,56.237499,57.049500,57.049500,29006000 43 | 2019-03-04,57.349499,57.914001,56.534500,57.389999,57.389999,28920000 44 | 2019-03-05,57.502998,58.480499,57.309750,58.101501,58.101501,28864000 45 | 2019-03-06,58.124500,58.378300,57.774502,57.893002,57.893002,21986000 46 | 2019-03-07,57.785999,57.837749,56.745499,57.165001,57.165001,23332000 47 | 2019-03-08,56.336498,57.354000,56.165001,57.116001,57.116001,24248000 48 | 2019-03-11,57.222500,58.809502,57.222500,58.787998,58.787998,34384000 49 | 2019-03-12,58.912998,60.000000,58.912998,59.660000,59.660000,40262000 50 | 2019-03-13,60.032249,60.046501,59.597000,59.666000,59.666000,28718000 51 | 2019-03-14,59.725498,59.894001,59.223999,59.277500,59.277500,23456000 52 | 2019-03-15,59.668999,59.828499,59.130501,59.223000,59.223000,49236000 53 | 2019-03-18,59.165001,59.500000,58.871052,59.213001,59.213001,25852000 54 | 2019-03-19,59.440498,60.000000,59.293499,59.942501,59.942501,30414000 55 | 2019-03-20,59.867500,61.356998,59.808498,61.198502,61.198502,44548000 56 | 2019-03-21,60.799999,61.589500,60.657501,61.577000,61.577000,24080000 57 | 2019-03-22,61.316002,61.500000,60.141251,60.275002,60.275002,34284000 58 | 2019-03-25,59.846500,60.319901,59.352001,59.650002,59.650002,29936000 59 | 2019-03-26,59.926498,60.141499,58.835999,59.230999,59.230999,38024000 60 | 2019-03-27,59.275002,59.377949,57.968498,58.651001,58.651001,28004000 61 | 2019-03-28,58.577000,58.578251,57.971550,58.424500,58.424500,19234000 62 | 2019-03-29,58.744999,58.949501,58.144001,58.665501,58.665501,25398000 63 | 2019-04-01,59.205002,59.833000,59.099998,59.721500,59.721500,25050000 64 | 2019-04-02,59.765999,60.067501,59.285500,60.024502,60.024502,16558000 65 | 2019-04-03,60.374001,60.814999,60.025002,60.296001,60.296001,20286000 66 | 2019-04-04,60.297001,60.783501,60.206501,60.750000,60.750000,19000000 67 | 2019-04-05,60.749500,60.811001,60.251499,60.357498,60.357498,18144000 68 | 2019-04-08,60.394501,60.434502,59.993000,60.192001,60.192001,17204000 69 | 2019-04-09,59.799999,60.114498,59.653999,59.862499,59.862499,17528000 70 | 2019-04-10,60.034000,60.189251,59.821751,60.108002,60.108002,14492000 71 | 2019-04-11,60.198002,60.397999,60.006500,60.230999,60.230999,14204000 72 | 2019-04-12,60.500000,60.917500,60.405499,60.893501,60.893501,18668000 73 | 2019-04-15,60.900002,61.209999,60.455502,61.055000,61.055000,23748000 74 | 2019-04-16,61.250000,61.541000,61.006001,61.356499,61.356499,17126000 75 | 2019-04-17,61.650002,62.028000,61.390999,61.817001,61.817001,24438000 76 | 2019-04-18,61.959000,62.099998,61.730499,61.818501,61.818501,26636000 77 | 2019-04-22,61.799500,62.454498,61.415501,62.442001,62.442001,16146000 78 | 2019-04-23,62.534500,63.450001,62.319000,63.227501,63.227501,26398000 79 | 2019-04-24,63.206001,63.400501,62.750000,62.799999,62.799999,20376000 80 | 2019-04-25,63.238499,63.370399,62.601501,63.172501,63.172501,22146000 81 | 2019-04-26,63.450001,63.653500,63.015999,63.609001,63.609001,24828000 82 | 2019-04-29,63.700001,64.463501,63.314751,64.378998,64.378998,49988000 83 | 2019-04-30,59.250000,59.640499,58.750000,59.424000,59.424000,124140000 84 | 2019-05-01,59.402500,59.402500,58.359001,58.403999,58.403999,52784000 85 | 2019-05-02,58.388000,58.709499,57.750099,58.130501,58.130501,38896000 86 | 2019-05-03,58.682499,59.340000,58.450001,59.270000,59.270000,39614000 87 | 2019-05-06,58.313000,59.542500,58.313000,59.469501,59.469501,31278000 88 | 2019-05-07,59.023499,59.521999,58.051998,58.705002,58.705002,31028000 89 | 2019-05-08,58.600498,59.021198,58.286999,58.313499,58.313499,26186000 90 | 2019-05-09,57.951500,58.483002,57.542500,58.118999,58.118999,23714000 91 | 2019-05-10,58.179501,58.630001,57.125000,58.213501,58.213501,26290000 92 | 2019-05-13,57.098000,57.396999,56.105499,56.601501,56.601501,37212000 93 | 2019-05-14,56.860500,57.021000,55.977501,56.021999,56.021999,36732000 94 | 2019-05-15,55.893501,58.566502,55.833302,58.210499,58.210499,45786000 95 | 2019-05-16,58.225498,59.408001,58.141998,58.949001,58.949001,30628000 96 | 2019-05-17,58.423500,59.007500,58.000500,58.115002,58.115002,24172000 97 | 2019-05-20,57.224998,57.339851,56.572151,56.942501,56.942501,27066000 98 | 2019-05-21,57.424500,57.635399,56.896999,57.481499,57.481499,23196000 99 | 2019-05-22,57.337502,57.925999,57.294498,57.570999,57.570999,18290000 100 | 2019-05-23,57.025002,57.298649,56.461201,57.038502,57.038502,23978000 101 | 2019-05-24,57.368000,57.488251,56.583000,56.673500,56.673500,22240000 102 | 2019-05-28,56.700001,57.579350,56.655998,56.707500,56.707500,27300000 103 | 2019-05-29,56.375999,56.455002,55.410999,55.823002,55.823002,30764000 104 | 2019-05-30,55.777000,56.156502,55.605999,55.897499,55.897499,19038000 105 | 2019-05-31,55.064499,55.480000,55.008999,55.181499,55.181499,30156000 106 | 2019-06-03,53.275002,53.275002,51.250000,51.811501,51.811501,102612000 107 | 2019-06-04,52.145000,52.802502,51.684502,52.652500,52.652500,56670000 108 | 2019-06-05,52.577000,52.677502,51.524502,52.111000,52.111000,43368000 109 | 2019-06-06,52.249500,52.374500,51.685001,52.216999,52.216999,34064000 110 | 2019-06-07,52.531502,53.546001,52.419998,53.301998,53.301998,36048000 111 | 2019-06-10,53.648998,54.632999,53.616100,54.019001,54.019001,29284000 112 | 2019-06-11,54.699001,55.099499,53.880150,53.936001,53.936001,28734000 113 | 2019-06-12,53.900002,54.046501,53.376999,53.851501,53.851501,21220000 114 | 2019-06-13,54.181999,54.708500,54.007500,54.438499,54.438499,21154000 115 | 2019-06-14,54.320999,54.634499,54.008598,54.267502,54.267502,22230000 116 | 2019-06-17,54.313999,54.959000,54.313999,54.625000,54.625000,18832000 117 | 2019-06-18,55.484501,55.819500,54.949501,55.180000,55.180000,27734000 118 | 2019-06-19,55.279999,55.349998,54.674000,55.116501,55.116501,26776000 119 | 2019-06-20,55.999500,56.006001,55.237000,55.570999,55.570999,25240000 120 | 2019-06-21,55.462002,56.205502,55.403999,56.094002,56.094002,38952000 121 | 2019-06-24,55.980499,56.099998,55.550499,55.776001,55.776001,27912000 122 | 2019-06-25,55.632999,55.717499,54.189999,54.317501,54.317501,30938000 123 | 2019-06-26,54.325001,54.648499,53.612000,53.990002,53.990002,36218000 124 | 2019-06-27,54.200001,54.355000,53.764500,53.800499,53.800499,20086000 125 | 2019-06-28,53.819500,54.049999,53.668499,54.045502,54.045502,33864000 126 | 2019-07-01,54.900002,55.379002,54.685150,54.897499,54.897499,28726000 127 | 2019-07-02,55.112000,55.588501,54.908501,55.562500,55.562500,19832000 128 | 2019-07-03,55.870499,56.338001,55.693001,56.078999,56.078999,15340000 129 | 2019-07-05,55.889999,56.644001,55.806999,56.579498,56.579498,25286000 130 | 2019-07-08,56.258499,56.299000,55.560501,55.817501,55.817501,24728000 131 | 2019-07-09,55.590000,56.401249,55.358501,56.241501,56.241501,26608000 132 | 2019-07-10,56.561001,57.102501,56.548500,57.023998,57.023998,24190000 133 | 2019-07-11,57.162498,57.653500,56.979000,57.210499,57.210499,23910000 134 | 2019-07-12,57.199501,57.367001,56.938999,57.244999,57.244999,17280000 135 | 2019-07-15,57.342999,57.541000,56.970001,57.516998,57.516998,18076000 136 | 2019-07-16,57.299999,57.929001,57.250000,57.679001,57.679001,24776000 137 | 2019-07-17,57.548500,57.917999,57.288502,57.317501,57.317501,23400000 138 | 2019-07-18,57.087002,57.380249,56.636501,57.316502,57.316502,25814000 139 | 2019-07-19,57.409500,57.556999,56.480999,56.505001,56.505001,32944000 140 | 2019-07-22,56.672501,56.962502,56.212002,56.903500,56.903500,26030000 141 | 2019-07-23,57.200001,57.345001,56.590000,57.310501,57.310501,21874000 142 | 2019-07-24,56.595001,57.200001,56.349499,56.890499,56.890499,31796000 143 | 2019-07-25,56.890999,57.084999,56.046001,56.605999,56.605999,44196000 144 | 2019-07-26,61.202000,63.277500,61.200001,62.520500,62.520500,96116000 145 | 2019-07-29,62.052502,62.368500,61.411499,61.970501,61.970501,44474000 146 | 2019-07-30,61.270500,61.743500,61.165001,61.257000,61.257000,29066000 147 | 2019-07-31,61.150002,61.700001,60.388199,60.834000,60.834000,34510000 148 | 2019-08-01,60.701500,61.705502,60.285999,60.450500,60.450500,33970000 149 | 2019-08-02,60.036999,60.345001,59.446999,59.699501,59.699501,32902000 150 | 2019-08-05,58.501999,58.762001,57.007000,57.616001,57.616001,51950000 151 | 2019-08-06,58.165501,58.998001,58.000000,58.497501,58.497501,34188000 152 | 2019-08-07,57.799999,58.922249,57.481201,58.699501,58.699501,28886000 153 | 2019-08-08,59.141499,60.250500,58.651001,60.240002,60.240002,29360000 154 | 2019-08-09,59.899502,60.194000,59.180149,59.400501,59.400501,21314000 155 | 2019-08-12,58.960499,59.248001,58.383598,58.735500,58.735500,20060000 156 | 2019-08-13,58.573002,60.238998,58.573002,59.863499,59.863499,25888000 157 | 2019-08-14,58.815498,59.115002,58.027000,58.214500,58.214500,31574000 158 | 2019-08-15,58.174999,58.792000,58.105499,58.362999,58.362999,24374000 159 | 2019-08-16,58.977501,59.136002,58.590500,58.880001,58.880001,26266000 160 | 2019-08-19,59.504501,60.349499,59.504501,59.922501,59.922501,24632000 161 | 2019-08-20,59.762501,59.803001,59.105499,59.134499,59.134499,18310000 162 | 2019-08-21,59.657501,59.950001,59.371498,59.562500,59.562500,14814000 163 | 2019-08-22,59.703499,59.900600,58.929001,59.476501,59.476501,18950000 164 | 2019-08-23,59.099499,59.703999,57.387501,57.564499,57.564499,33740000 165 | 2019-08-26,57.862999,58.473499,57.647999,58.444500,58.444500,24522000 166 | 2019-08-27,59.026501,59.119999,58.072498,58.391998,58.391998,21544000 167 | 2019-08-28,58.085499,58.820999,57.865002,58.550999,58.550999,16040000 168 | 2019-08-29,59.056000,59.803001,59.056000,59.642502,59.642502,21768000 169 | 2019-08-30,59.924999,59.924999,59.190151,59.404999,59.404999,22596000 170 | 2019-09-03,58.851501,59.344501,58.160000,58.419498,58.419498,29598000 171 | 2019-09-04,58.835499,59.174000,58.549999,59.070499,59.070499,21378000 172 | 2019-09-05,59.576500,60.652000,59.576500,60.569000,60.569000,28162000 173 | 2019-09-06,60.406502,60.600750,60.126099,60.246498,60.246498,21442000 174 | 2019-09-09,60.200001,61.000000,59.631001,60.220501,60.220501,29438000 175 | 2019-09-10,59.757500,60.500000,59.729000,60.299999,60.299999,25202000 176 | 2019-09-11,60.170502,61.130001,60.110001,61.008499,61.008499,26140000 177 | 2019-09-12,61.215000,62.092999,61.151001,61.712502,61.712502,34518000 178 | 2019-09-13,61.567501,62.043999,61.350498,61.978001,61.978001,26028000 179 | 2019-09-16,61.476002,61.978001,61.280499,61.564999,61.564999,21066000 180 | 2019-09-17,61.520000,61.750000,61.184502,61.457500,61.457500,19102000 181 | 2019-09-18,61.375500,61.780499,60.826500,61.620499,61.620499,22702000 182 | 2019-09-19,61.603001,62.222000,61.601002,61.935501,61.935501,19920000 183 | 2019-09-20,61.655998,62.166000,61.153999,61.496498,61.496498,45400000 184 | 2019-09-23,61.299999,61.954498,61.208500,61.701500,61.701500,21248000 185 | 2019-09-24,62.000000,62.337002,60.534000,60.938000,60.938000,31664000 186 | 2019-09-25,60.791000,62.415001,60.504501,62.326000,62.326000,29060000 187 | 2019-09-26,62.098000,62.250000,61.613400,62.069500,62.069500,30760000 188 | 2019-09-27,62.150501,62.201000,60.722500,61.254501,61.254501,27078000 189 | 2019-09-30,61.048500,61.299999,60.615002,60.950001,60.950001,28082000 190 | 2019-10-01,60.950001,61.561501,60.179001,60.255001,60.255001,25470000 191 | 2019-10-02,59.848999,59.848999,58.564499,58.831501,58.831501,32302000 192 | 2019-10-03,59.000000,59.452999,58.121498,59.391499,59.391499,32424000 193 | 2019-10-04,59.594501,60.571999,59.458500,60.450001,60.450001,23248000 194 | 2019-10-07,60.220001,60.910198,60.187500,60.383999,60.383999,16858000 195 | 2019-10-08,59.879501,60.304001,59.450500,59.456501,59.456501,20786000 196 | 2019-10-09,59.967499,60.417500,59.881500,60.115501,60.115501,17354000 197 | 2019-10-10,59.929001,60.750000,59.867001,60.433498,60.433498,16932000 198 | 2019-10-11,61.110500,61.419498,60.687000,60.772499,60.772499,25454000 199 | 2019-10-14,60.617001,61.316502,60.588001,60.856998,60.856998,17350000 200 | 2019-10-15,61.020000,62.366501,61.020000,62.150501,62.150501,27634000 201 | 2019-10-16,62.058498,62.737000,61.922501,62.181999,62.181999,21892000 202 | 2019-10-17,62.546501,63.166248,62.497002,62.653500,62.653500,19048000 203 | 2019-10-18,62.673000,62.944500,62.054001,62.274502,62.274502,27056000 204 | 2019-10-21,62.612999,62.731449,62.029999,62.307499,62.307499,20544000 205 | 2019-10-22,62.392502,62.529999,62.069000,62.139999,62.139999,20476000 206 | 2019-10-23,62.118000,62.994499,62.118000,62.956501,62.956501,18230000 207 | 2019-10-24,63.044998,63.200001,62.685749,63.049500,63.049500,20562000 208 | 2019-10-25,62.551498,63.480000,62.500500,63.256500,63.256500,24262000 209 | 2019-10-28,63.772499,64.965500,63.626999,64.500000,64.500000,52264000 210 | 2019-10-29,63.811501,64.079498,62.860600,63.131001,63.131001,37728000 211 | 2019-10-30,62.648499,63.467999,62.599998,63.064499,63.064499,28178000 212 | 2019-10-31,63.063999,63.383499,62.542149,63.005501,63.005501,29114000 213 | 2019-11-01,63.250000,63.730999,63.025002,63.687000,63.687000,33402000 214 | 2019-11-04,63.822498,64.706497,63.817749,64.568497,64.568497,30020000 215 | 2019-11-05,64.644501,64.946503,64.561447,64.601501,64.601501,25654000 216 | 2019-11-06,64.473000,64.686501,64.125000,64.589996,64.589996,23060000 217 | 2019-11-07,64.713997,66.186996,64.712250,65.443001,65.443001,40600000 218 | 2019-11-08,65.264000,65.900002,65.218246,65.568497,65.568497,25028000 219 | 2019-11-11,65.158997,65.321251,64.870499,64.959503,64.959503,20238000 220 | 2019-11-12,65.000000,65.500000,64.788498,64.940002,64.940002,21718000 221 | 2019-11-13,64.703499,65.214996,64.675499,64.900002,64.900002,16534000 222 | 2019-11-14,64.875000,65.849998,64.782501,65.572998,65.572998,23870000 223 | 2019-11-15,65.946999,66.744003,65.713997,66.743500,66.743500,35652000 224 | 2019-11-18,66.611000,66.776451,65.875000,66.035004,66.035004,29748000 225 | 2019-11-19,66.385002,66.385002,65.639999,65.773003,65.773003,25384000 226 | 2019-11-20,65.586998,65.750000,64.557503,65.152496,65.152496,26172000 227 | 2019-11-21,65.073997,65.629501,64.650002,65.067497,65.067497,19910000 228 | 2019-11-22,65.280998,65.436501,64.570503,64.766998,64.766998,27714000 229 | 2019-11-25,64.959000,65.565498,64.906502,65.334503,65.334503,20724000 230 | 2019-11-26,65.492996,65.739998,65.254501,65.677498,65.677498,21394000 231 | 2019-11-27,65.750000,65.917999,65.481499,65.649498,65.649498,19912000 232 | 2019-11-29,65.356003,65.510246,65.198502,65.248001,65.248001,11740000 233 | 2019-12-02,65.050003,65.291496,64.050003,64.496002,64.496002,30218000 234 | 2019-12-03,63.978500,64.923050,63.950001,64.764000,64.764000,22876000 235 | 2019-12-04,65.350502,66.290001,65.243500,66.027000,66.027000,30750000 236 | 2019-12-05,66.400002,66.467903,65.821999,66.406502,66.406502,24254000 237 | 2019-12-06,66.671997,67.199997,66.671997,67.030998,67.030998,26296000 238 | 2019-12-09,66.902000,67.972504,66.891998,67.178001,67.178001,27086000 239 | 2019-12-10,67.074997,67.498749,66.802002,67.233002,67.233002,21882000 240 | 2019-12-11,67.542000,67.559998,67.133499,67.250999,67.250999,17008000 241 | 2019-12-12,67.296997,67.788750,67.025002,67.513496,67.513496,25620000 242 | 2019-12-13,67.397499,67.654648,67.193497,67.391502,67.391502,30992000 243 | 2019-12-16,67.824997,68.234001,67.633499,68.058502,68.058502,27946000 244 | 2019-12-17,68.144501,68.250000,67.566147,67.755997,67.755997,37080000 245 | 2019-12-18,67.830002,68.023499,67.550003,67.630997,67.630997,30452000 246 | 2019-12-19,67.591003,67.904999,67.449249,67.802002,67.802002,29398000 247 | 2019-12-20,68.167503,68.181999,67.449997,67.479500,67.479500,66300000 248 | 2019-12-23,67.793503,67.989998,67.325500,67.442001,67.442001,17662000 249 | 2019-12-24,67.425003,67.513000,67.139000,67.178001,67.178001,6950000 250 | 2019-12-26,67.308502,68.066353,67.223503,68.019997,68.019997,13350000 251 | 2019-12-27,68.149498,68.226501,67.465500,67.594498,67.594498,20768000 252 | 2019-12-30,67.500000,67.650002,66.700996,66.806999,66.806999,21018000 253 | 2019-12-31,66.505501,66.900002,66.454247,66.850998,66.850998,19236000 254 | 2020-01-02,67.077499,68.406998,67.077499,68.368500,68.368500,28132000 255 | 2020-01-03,67.392998,68.625000,67.277199,68.032997,68.032997,23728000 256 | 2020-01-06,67.500000,69.824997,67.500000,69.710503,69.710503,34646000 257 | 2020-01-07,69.897003,70.149498,69.518997,69.667000,69.667000,30054000 258 | 2020-01-08,69.603996,70.579002,69.542000,70.216003,70.216003,30560000 259 | 2020-01-09,71.028503,71.366501,70.513496,70.991501,70.991501,30018000 260 | 2020-01-10,71.377998,71.746452,70.917503,71.486504,71.486504,36414000 261 | 2020-01-13,71.806503,72.026001,71.301003,71.961502,71.961502,33046000 262 | 2020-01-14,71.950500,72.089996,71.418503,71.543999,71.543999,31178000 263 | 2020-01-15,71.510498,72.069748,71.510498,71.959999,71.959999,25654000 264 | 2020-01-16,72.372002,72.599503,72.045998,72.584999,72.584999,23474000 265 | 2020-01-17,73.145500,74.064751,72.911003,74.019501,74.019501,47924000 266 | 2020-01-21,73.956001,74.592499,73.559998,74.220001,74.220001,40734000 267 | 2020-01-22,74.550003,75.160698,74.246498,74.297501,74.297501,32216000 268 | 2020-01-23,74.382004,74.776001,74.105003,74.332497,74.332497,27024000 269 | 2020-01-24,74.679497,74.774750,73.262497,73.335503,73.335503,35692000 270 | 2020-01-27,71.550003,71.903503,71.059998,71.695000,71.695000,35104000 271 | 2020-01-28,72.150002,72.800003,71.623497,72.627998,72.627998,31548000 272 | 2020-01-29,72.940002,73.271500,72.336998,72.931503,72.931503,21554000 273 | 2020-01-30,71.998001,72.863998,71.820000,72.792000,72.792000,26788000 274 | 2020-01-31,73.445000,73.506500,71.426498,71.711502,71.711502,48344000 275 | 2020-02-03,73.099998,74.500000,72.949501,74.296997,74.296997,60736000 276 | 2020-02-04,72.853500,73.474998,71.315002,72.353500,72.353500,78660000 277 | 2020-02-05,73.121002,73.192001,71.528000,72.411499,72.411499,39724000 278 | 2020-02-06,72.516502,74.099998,72.478500,73.811501,73.811501,33588000 279 | 2020-02-07,73.364998,74.292000,73.317497,73.961502,73.961502,23446000 280 | 2020-02-10,73.716003,75.474998,73.716003,75.433998,75.433998,28398000 281 | 2020-02-11,75.590500,76.481499,75.281898,75.439499,75.439499,26892000 282 | 2020-02-12,75.723999,76.034752,75.405502,75.913498,75.913498,23352000 283 | 2020-02-13,75.634499,76.359001,75.230003,75.733002,75.733002,18590000 284 | 2020-02-14,75.779999,76.037003,75.366997,76.037003,76.037003,23956000 285 | 2020-02-18,75.750000,76.581497,75.629501,75.983498,75.983498,22414000 286 | 2020-02-19,76.253502,76.605301,76.070000,76.334503,76.334503,18986000 287 | 2020-02-20,76.099998,76.482002,75.341003,75.907501,75.907501,21932000 288 | 2020-02-21,75.401497,75.610748,74.022003,74.255501,74.255501,34634000 289 | 2020-02-24,71.305496,71.848503,70.569504,71.079498,71.079498,57342000 290 | 2020-02-25,71.650002,71.906998,69.120003,69.422501,69.422501,49566000 291 | 2020-02-26,69.806999,70.785004,68.949997,69.658997,69.658997,44048000 292 | 2020-02-27,68.102997,68.585197,65.858498,65.904503,65.904503,59566000 293 | 2020-02-28,63.875000,67.056999,63.549999,66.966499,66.966499,75782000 294 | 2020-03-02,67.580498,69.543503,66.340752,69.455498,69.455498,48630000 295 | 2020-03-03,69.971001,70.507500,66.599998,67.069504,67.069504,48046000 296 | 2020-03-04,67.961502,69.404503,67.155502,69.325996,69.325996,38266000 297 | 2020-03-05,67.510002,67.945503,65.254997,65.952003,65.952003,51226000 298 | 2020-03-06,63.853001,65.310997,63.052502,64.920502,64.920502,53212000 299 | 2020-03-09,60.264999,62.737999,60.000000,60.778000,60.778000,67308000 300 | 2020-03-10,63.000000,64.057503,60.938499,64.019501,64.019501,52228000 301 | 2020-03-11,62.485001,63.048000,59.803501,60.770500,60.770500,52170000 302 | 2020-03-12,56.299999,59.693501,55.665001,55.745499,55.745499,84534000 303 | 2020-03-13,58.950001,60.987999,55.857151,60.986500,60.986500,74002000 304 | 2020-03-16,54.799999,57.613350,53.722000,54.216499,54.216499,85048000 305 | 2020-03-17,54.655499,56.542999,52.800499,55.990002,55.990002,77230000 306 | 2020-03-18,52.825500,55.325001,51.863998,54.840000,54.840000,84668000 307 | 2020-03-19,54.652500,57.898499,53.005402,55.764500,55.764500,73022000 308 | 2020-03-20,56.785999,57.199501,53.274502,53.616001,53.616001,72036000 309 | 2020-03-23,53.066002,53.566002,50.676800,52.831001,52.831001,80882000 310 | 2020-03-24,55.188499,56.750000,54.530998,56.723000,56.723000,66890000 311 | 2020-03-25,56.323502,57.445000,54.300499,55.124500,55.124500,81630000 312 | 2020-03-26,55.590000,58.498501,54.676498,58.087502,58.087502,71434000 313 | 2020-03-27,56.283501,57.533501,55.295502,55.535500,55.535500,64170000 314 | 2020-03-30,56.251999,57.581501,54.824001,57.341000,57.341000,51482000 315 | 2020-03-31,57.365002,58.765499,56.907001,58.140499,58.140499,49728000 316 | 2020-04-01,56.099998,56.484501,54.872501,55.280998,55.280998,46884000 317 | 2020-04-02,54.912998,56.342999,54.820000,56.042000,56.042000,39298000 318 | 2020-04-03,55.950748,56.176998,53.990501,54.894001,54.894001,46268000 319 | 2020-04-06,56.900002,59.733002,56.547001,59.346001,59.346001,53294000 320 | 2020-04-07,61.049999,61.250000,59.111500,59.325500,59.325500,47746000 321 | 2020-04-08,60.325001,60.953499,59.408001,60.514000,60.514000,39502000 322 | 2020-04-09,61.203999,61.278500,59.836750,60.572498,60.572498,43508000 323 | 2020-04-13,60.459000,61.025501,59.379902,60.877998,60.877998,34796000 324 | 2020-04-14,62.254501,64.103500,61.846500,63.461498,63.461498,49408000 325 | 2020-04-15,62.280499,64.023003,62.020000,63.123501,63.123501,33434000 326 | 2020-04-16,63.705002,63.950001,62.131001,63.173500,63.173500,50362000 327 | 2020-04-17,64.242500,64.721497,63.561501,64.162498,64.162498,38980000 328 | 2020-04-20,63.549999,64.080002,63.068501,63.330502,63.330502,33910000 329 | 2020-04-21,62.349998,62.713501,60.485500,60.817001,60.817001,43060000 330 | 2020-04-22,62.277000,64.280647,62.099998,63.160500,63.160500,41848000 331 | 2020-04-23,63.577499,64.665497,63.283501,63.815498,63.815498,31324000 332 | 2020-04-24,63.058498,64.019997,62.472500,63.965500,63.965500,32792000 333 | 2020-04-27,64.800003,64.807503,63.450001,63.793999,63.793999,32012000 334 | 2020-04-28,64.396500,64.402496,61.610001,61.683498,61.683498,59026000 335 | 2020-04-29,67.072998,67.999496,66.266998,67.073997,67.073997,75872000 336 | 2020-04-30,66.244003,67.640999,66.124496,67.432999,67.432999,53378000 337 | 2020-05-01,66.425003,67.603500,65.550003,66.030502,66.030502,41450000 338 | 2020-05-04,65.411499,66.383003,64.949997,66.339996,66.339996,30080000 339 | 2020-05-05,66.896004,68.696999,66.873001,67.555496,67.555496,33030000 340 | 2020-05-06,68.084503,68.556000,67.364502,67.364998,67.364998,24308000 341 | 2020-05-07,68.296997,68.879997,67.763496,68.627998,68.627998,27952000 342 | 2020-05-08,69.156502,69.938004,68.774002,69.418503,69.418503,27738000 343 | 2020-05-11,68.914001,70.826500,68.857597,70.163002,70.163002,28242000 344 | 2020-05-12,70.356003,70.750000,68.738503,68.787003,68.787003,27812000 345 | 2020-05-13,68.852501,69.274101,66.419998,67.466499,67.466499,36252000 346 | 2020-05-14,66.750999,67.871002,66.195503,67.806503,67.806503,32062000 347 | 2020-05-15,67.500000,68.723999,66.949997,68.659500,68.659500,34154000 348 | 2020-05-18,68.087502,69.616249,67.712502,69.196999,69.196999,36448000 349 | 2020-05-19,69.349854,69.599998,68.674248,68.674248,68.674248,25612000 350 | 2020-05-20,69.478996,70.521004,69.362503,70.335999,70.335999,33108000 351 | 2020-05-21,70.400002,70.774498,69.672501,70.139999,70.139999,27700000 352 | 2020-05-22,69.835503,70.638000,69.591499,70.521004,70.521004,26188000 353 | 2020-05-26,71.863503,72.050003,70.606499,70.850998,70.850998,41212000 354 | 2020-05-27,70.862503,71.086998,69.564499,70.891998,70.891998,33716000 355 | 2020-05-28,69.843002,72.042000,69.800003,70.836502,70.836502,33844000 356 | 2020-05-29,70.847000,71.628502,70.667503,71.445999,71.445999,36418000 357 | 2020-06-01,70.919502,71.898003,70.900002,71.591003,71.591003,24342000 358 | 2020-06-02,71.527496,71.980499,70.941498,71.960999,71.960999,25562000 359 | 2020-06-03,71.915001,72.327599,71.488853,71.819000,71.819000,25124000 360 | 2020-06-04,71.519997,71.947998,70.236504,70.609001,70.609001,29686000 361 | 2020-06-05,70.658501,72.252502,70.300003,71.919502,71.919502,34698000 362 | 2020-06-08,71.116997,72.399498,71.116997,72.330498,72.330498,28084000 363 | 2020-06-09,72.267998,73.400002,72.160500,72.807999,72.807999,28184000 364 | 2020-06-10,72.976997,73.712952,72.813499,73.292503,73.292503,30504000 365 | 2020-06-11,72.124001,72.723747,70.099998,70.192001,70.192001,39826000 366 | 2020-06-12,71.424500,71.849998,69.301003,70.658997,70.658997,38928000 367 | 2020-06-15,69.540001,71.239998,69.396004,70.992500,70.992500,30078000 368 | 2020-06-16,72.261002,72.750999,71.294998,72.136002,72.136002,34184000 369 | 2020-06-17,72.358002,73.000000,71.569000,72.556000,72.556000,30992000 370 | 2020-06-18,72.458000,72.570503,71.350502,71.797997,71.797997,31638000 371 | 2020-06-19,72.199997,72.389999,71.067497,71.585999,71.585999,63158000 372 | 2020-06-22,71.449997,72.637497,71.160500,72.593002,72.593002,30848000 373 | 2020-06-23,72.781998,73.797050,72.262001,73.220497,73.220497,28596000 374 | 2020-06-24,73.075500,73.771004,71.487503,71.598503,71.598503,35120000 375 | 2020-06-25,71.495003,72.144997,71.000000,72.066498,72.066498,24610000 376 | 2020-06-26,71.569504,71.672501,67.599503,67.995003,67.995003,85354000 377 | 2020-06-29,67.908997,69.779999,67.350502,69.748497,69.748497,36204000 378 | 2020-06-30,69.522003,70.932503,69.197998,70.680496,70.680496,40848000 379 | 2020-07-01,70.555000,72.150002,70.490997,71.902000,71.902000,35504000 380 | 2020-07-02,72.347000,74.147499,72.320999,73.235001,73.235001,37182000 381 | 2020-07-06,74.002998,75.329498,73.642998,74.785004,74.785004,31280000 382 | 2020-07-07,74.500000,75.839996,74.177498,74.259003,74.259003,29164000 383 | 2020-07-08,74.716003,75.293999,74.281502,74.800003,74.800003,24994000 384 | 2020-07-09,75.322502,76.136002,74.404251,75.549500,75.549500,28466000 385 | 2020-07-10,75.307503,77.191498,74.827003,77.086998,77.086998,37126000 386 | 2020-07-13,77.500000,78.856598,75.262154,75.567001,75.567001,36928000 387 | 2020-07-14,74.515503,76.147499,74.175003,76.028999,76.028999,31700000 388 | 2020-07-15,76.156502,76.766502,74.900002,75.681999,75.681999,32214000 389 | 2020-07-16,75.000000,75.934502,74.315498,75.900002,75.900002,30386000 390 | 2020-07-17,76.081001,76.171997,74.920998,75.777496,75.777496,29134000 391 | 2020-07-20,75.763000,78.514503,75.180000,78.286003,78.286003,31146000 392 | 2020-07-21,79.349503,79.349503,77.713997,77.920998,77.920998,24324000 393 | 2020-07-22,78.025002,78.500000,77.305000,78.424500,78.424500,18640000 394 | 2020-07-23,78.348503,78.593498,75.369598,75.783997,75.783997,32552000 395 | 2020-07-24,74.946503,75.881798,74.419998,75.593498,75.593498,30880000 396 | 2020-07-27,75.779999,77.048500,75.760498,76.510002,76.510002,24920000 397 | 2020-07-28,76.259003,76.323997,74.883003,75.016998,75.016998,34044000 398 | 2020-07-29,75.316002,76.562599,75.066498,76.100998,76.100998,22130000 399 | 2020-07-30,74.849998,76.893501,74.611000,76.572502,76.572502,33428000 400 | 2020-07-31,75.250504,75.447502,72.701500,74.148003,74.148003,68798000 401 | 2020-08-03,74.332001,74.523499,73.281998,73.722504,73.722504,46604000 402 | 2020-08-04,73.828499,74.278000,72.932503,73.248497,73.248497,38070000 403 | 2020-08-05,73.464996,74.120499,73.172997,73.680496,73.680496,39590000 404 | 2020-08-06,73.587502,75.119499,73.300003,75.004997,75.004997,39908000 405 | 2020-08-07,75.000000,75.842247,74.082001,74.724503,74.724503,31556000 406 | 2020-08-10,74.359001,75.203751,73.653999,74.805000,74.805000,25786000 407 | 2020-08-11,74.622002,75.500000,73.900002,74.015999,74.015999,29088000 408 | 2020-08-12,74.278999,75.619301,74.262497,75.331001,75.331001,28740000 409 | 2020-08-13,75.516998,76.862503,75.400253,75.922501,75.922501,29104000 410 | 2020-08-14,75.782997,76.095001,75.143997,75.386497,75.386497,27096000 411 | 2020-08-17,75.733498,76.280502,75.398499,75.899002,75.899002,27566000 412 | 2020-08-18,76.308998,78.123497,76.185501,77.930000,77.930000,40542000 413 | 2020-08-19,77.665497,78.683998,77.197502,77.376503,77.376503,33212000 414 | 2020-08-20,77.172501,79.293503,76.910004,79.087502,79.087502,34138000 415 | 2020-08-21,78.851501,79.886002,78.400253,79.021004,79.021004,28930000 416 | 2020-08-24,79.698997,80.708504,79.028503,79.410004,79.410004,28198000 417 | 2020-08-25,79.103500,80.581001,79.103500,80.411003,80.411003,44942000 418 | 2020-08-26,80.400002,82.960999,80.180000,82.619003,82.619003,79868000 419 | 2020-08-27,82.683998,82.750000,81.287498,81.716499,81.716499,37232000 420 | 2020-08-28,81.674500,82.358498,81.537498,82.220497,82.220497,29980000 421 | 2020-08-31,82.394501,82.398247,81.515503,81.709000,81.709000,36468000 422 | 2020-09-01,81.831497,83.286499,81.611000,83.035500,83.035500,36506000 423 | 2020-09-02,83.688751,86.658997,83.316498,86.414001,86.414001,50224000 424 | 2020-09-03,85.485703,85.485703,80.752998,82.092003,82.092003,62156000 425 | 2020-09-04,81.212997,82.255501,77.380653,79.552002,79.552002,52172000 426 | 2020-09-08,76.675499,78.193253,76.400497,76.619499,76.619499,52218000 427 | 2020-09-09,77.876503,78.449997,76.802551,77.848000,77.848000,35494000 428 | 2020-09-10,78.031998,79.204048,76.290253,76.600998,76.600998,32372000 429 | 2020-09-11,76.800003,78.760002,74.867996,76.036003,76.036003,31942000 430 | 2020-09-14,76.950249,78.199997,75.787003,75.963997,75.963997,33932000 431 | 2020-09-15,76.800003,77.978500,76.591751,77.071999,77.071999,26622000 432 | 2020-09-16,77.777000,78.099998,75.990997,76.044998,76.044998,26234000 433 | 2020-09-17,74.800003,75.414902,73.500000,74.776497,74.776497,37596000 434 | 2020-09-18,74.900497,75.150146,71.856499,72.999496,72.999496,62078000 435 | 2020-09-21,72.002998,72.417999,70.327499,71.557999,71.557999,57776000 436 | 2020-09-22,72.504501,73.475998,71.726501,73.273003,73.273003,31664000 437 | 2020-09-23,72.939003,73.047997,70.385002,70.760498,70.760498,33148000 438 | 2020-09-24,70.551498,72.185448,70.492500,71.414497,71.414497,29004000 439 | 2020-09-25,71.631500,72.500000,70.667000,72.248001,72.248001,26460000 440 | 2020-09-28,73.710503,73.839996,72.465050,73.225998,73.225998,40158000 441 | 2020-09-29,73.519501,73.833153,72.940247,73.466499,73.466499,19564000 442 | 2020-09-30,73.339996,74.487503,72.994003,73.480003,73.480003,34032000 443 | 2020-10-01,74.213501,74.952003,73.960503,74.504501,74.504501,35590000 444 | 2020-10-02,73.101501,74.160004,72.545998,72.920998,72.920998,25682000 445 | 2020-10-05,73.310501,74.410500,73.213501,74.301003,74.301003,22266000 446 | 2020-10-06,73.778999,74.337997,72.429497,72.671997,72.671997,24908000 447 | 2020-10-07,73.214500,73.447998,71.800003,73.014503,73.014503,34924000 448 | 2020-10-08,73.254501,74.500000,73.254501,74.296501,74.296501,23756000 449 | 2020-10-09,74.735001,75.825996,74.472504,75.761002,75.761002,28706000 450 | 2020-10-12,77.150002,79.693001,76.628502,78.457497,78.457497,49652000 451 | 2020-10-13,79.186501,79.500000,78.160004,78.584000,78.584000,32020000 452 | 2020-10-14,78.929497,79.384201,77.526497,78.403999,78.403999,38586000 453 | 2020-10-15,77.357498,78.755249,77.251503,77.956497,77.956497,30800000 454 | 2020-10-16,78.292503,79.056503,78.150002,78.650497,78.650497,28694000 455 | 2020-10-19,79.023003,79.407501,76.400002,76.730499,76.730499,32142000 456 | 2020-10-20,76.352501,78.875000,76.283501,77.796501,77.796501,44834000 457 | 2020-10-21,78.666496,80.936501,78.581497,79.665497,79.665497,51366000 458 | 2020-10-22,79.652496,81.099503,79.250000,80.766502,80.766502,28672000 459 | 2020-10-23,81.303497,82.117996,81.025497,82.050003,82.050003,27516000 460 | 2020-10-26,81.250504,81.912003,78.824997,79.522499,79.522499,37066000 461 | 2020-10-27,79.783501,80.342247,79.139000,80.212997,80.212997,24580000 462 | 2020-10-28,77.987000,78.067497,75.731003,75.831001,75.831001,36680000 463 | 2020-10-29,76.117996,79.685501,76.112000,78.362000,78.362000,40062000 464 | 2020-10-30,83.605499,84.349998,80.223000,81.050499,81.050499,86582000 465 | 2020-11-02,81.407997,83.038498,80.801498,81.301498,81.301498,50708000 466 | 2020-11-03,81.588997,83.084999,80.831001,82.510498,82.510498,33234000 467 | 2020-11-04,85.514000,88.568253,85.301498,87.456497,87.456497,71418000 468 | 2020-11-05,89.050003,89.681999,87.525497,88.168503,88.168503,41316000 469 | 2020-11-06,87.697502,88.621498,87.017502,88.087502,88.087502,33218000 470 | 2020-11-09,89.544998,90.903000,88.000999,88.150002,88.150002,45366000 471 | 2020-11-10,86.554497,88.150002,85.864998,87.019501,87.019501,52722000 472 | 2020-11-11,87.500000,88.210999,87.368248,87.635498,87.635498,25280000 473 | 2020-11-12,87.381500,88.413498,87.279999,87.491997,87.491997,24950000 474 | 2020-11-13,87.881500,89.052002,87.227501,88.850998,88.850998,29998000 475 | 2020-11-16,88.584999,89.953499,88.384499,89.069000,89.069000,24936000 476 | 2020-11-17,88.847000,89.250000,88.349998,88.507500,88.507500,22942000 477 | 2020-11-18,88.261497,88.673500,87.306999,87.338997,87.338997,23470000 478 | 2020-11-19,86.918999,88.479500,86.850250,88.195999,88.195999,24998000 479 | 2020-11-20,88.260498,88.699997,87.093002,87.109497,87.109497,46270000 480 | 2020-11-23,87.480003,87.695000,85.886002,86.742996,86.742996,43232000 481 | 2020-11-24,86.525002,88.580002,86.384499,88.444000,88.444000,31560000 482 | 2020-11-25,88.644501,88.927002,87.827003,88.571503,88.571503,20916000 483 | 2020-11-27,88.654503,90.199997,88.622002,89.659500,89.659500,17698000 484 | 2020-11-30,89.059196,89.403252,87.750000,88.037003,88.037003,36476000 485 | 2020-12-01,88.718498,91.241501,88.468498,89.904999,89.904999,34738000 486 | 2020-12-02,89.904999,91.782501,89.473648,91.397499,91.397499,24440000 487 | 2020-12-03,91.200500,92.360001,91.132500,91.338501,91.338501,24546000 488 | 2020-12-04,91.225998,91.657997,90.849503,91.399498,91.399498,27564000 489 | 2020-12-07,90.949997,91.618500,90.289001,90.973999,90.973999,26418000 490 | 2020-12-08,90.504997,91.095001,89.810249,90.927498,90.927498,21926000 491 | 2020-12-09,90.600502,91.713501,88.390503,89.206497,89.206497,30152000 492 | 2020-12-10,88.489998,89.065498,87.015999,88.766502,88.766502,27256000 493 | 2020-12-11,88.153000,89.222504,88.000000,89.088501,89.088501,24414000 494 | 2020-12-14,88.750000,89.869499,87.860748,88.002998,88.002998,32004000 495 | 2020-12-15,88.221001,88.570999,87.497498,88.388496,88.388496,29646000 496 | 2020-12-16,88.643997,88.650002,87.804001,88.150002,88.150002,30270000 497 | 2020-12-17,88.425499,88.589203,86.932999,87.394997,87.394997,32494000 498 | 2020-12-18,87.709000,87.755501,86.011002,86.550499,86.550499,80328000 499 | 2020-12-21,85.675499,87.042503,84.949997,86.968498,86.968498,36568000 500 | 2020-12-22,86.721497,86.870247,85.628754,86.175003,86.175003,18734000 501 | 2020-12-23,86.405502,87.399498,86.251999,86.619003,86.619003,20676000 502 | 2020-12-24,86.750000,87.300003,86.455498,86.942497,86.942497,6936000 503 | 2020-12-28,87.581749,89.536400,87.316750,88.804497,88.804497,27860000 504 | 2020-12-29,89.389503,89.622002,87.804497,87.935997,87.935997,25988000 505 | 2020-12-30,88.100502,88.254753,86.279999,86.975998,86.975998,26122000 506 | 2020-12-31,86.771004,87.946503,86.771004,87.594002,87.594002,20238000 507 | 2021-01-04,87.876999,88.032501,85.392502,86.412003,86.412003,38038000 508 | 2021-01-05,86.250000,87.383499,85.900749,87.045998,87.045998,22906000 509 | 2021-01-06,85.131500,87.400002,84.949997,86.764503,86.764503,52042000 510 | 2021-01-07,87.002998,89.419998,86.852501,89.362503,89.362503,45300000 511 | 2021-01-08,89.399002,90.491997,88.676750,90.360497,90.360497,41012000 512 | 2021-01-11,89.303497,89.715752,88.026001,88.335999,88.335999,24194000 513 | 2021-01-12,87.695999,88.902000,86.265503,87.327499,87.327499,27140000 514 | 2021-01-13,86.929001,88.251747,86.900497,87.720001,87.720001,21882000 515 | 2021-01-14,87.681000,88.750504,86.669998,87.009003,87.009003,23590000 516 | 2021-01-15,86.909500,87.800003,86.077499,86.809502,86.809502,26844000 517 | 2021-01-19,87.612503,90.463753,87.072998,89.542999,89.542999,34692000 518 | 2021-01-20,91.572998,95.185501,91.276497,94.345001,94.345001,49806000 519 | 2021-01-21,94.900002,96.742996,94.355499,94.562500,94.562500,41278000 520 | 2021-01-22,94.783997,95.547501,94.087997,95.052498,95.052498,25442000 521 | 2021-01-25,96.033501,96.478996,93.376503,94.970001,94.970001,38546000 522 | 2021-01-26,94.442001,96.250000,94.212250,95.862000,95.862000,26262000 523 | 2021-01-27,94.126503,94.500000,90.449997,91.539497,91.539497,54966000 524 | 2021-01-28,92.196999,94.941498,92.132004,93.155502,93.155502,35462000 525 | 2021-01-29,92.308502,92.863998,90.510002,91.787003,91.787003,32252000 526 | 2021-02-01,92.678497,96.119598,92.546501,95.067497,95.067497,32044000 527 | 2021-02-02,96.127998,97.788002,95.724503,96.375504,96.375504,45474000 528 | 2021-02-03,103.650002,105.824997,100.918999,103.503502,103.503502,82364000 529 | 2021-02-04,103.444504,103.927498,102.129501,103.118500,103.118500,37046000 530 | 2021-02-05,103.500000,105.125504,102.966499,104.900002,104.900002,30702000 531 | 2021-02-08,105.295502,106.177353,103.599998,104.645500,104.645500,24838000 532 | 2021-02-09,103.927002,105.256500,103.927002,104.175499,104.175499,17798000 533 | 2021-02-10,104.710503,105.418503,103.154503,104.768997,104.768997,22710000 534 | 2021-02-11,104.975502,105.101501,103.865997,104.794502,104.794502,18914000 535 | 2021-02-12,104.512497,105.441002,104.156502,105.205498,105.205498,17114000 536 | 2021-02-16,105.218002,107.634003,105.218002,106.095001,106.095001,22676000 537 | 2021-02-17,105.000000,106.682999,104.945999,106.415497,106.415497,21418000 538 | 2021-02-18,105.519501,106.636749,105.185501,105.860001,105.860001,22432000 539 | 2021-02-19,105.963501,106.526497,104.870499,105.056999,105.056999,29148000 540 | 2021-02-22,103.349998,104.570999,103.107002,103.244003,103.244003,27350000 541 | 2021-02-23,101.250504,104.100502,100.100998,103.542999,103.542999,33348000 542 | 2021-02-24,102.091499,105.039001,101.906502,104.758499,104.758499,24966000 543 | 2021-02-25,103.372498,104.744003,101.064499,101.568001,101.568001,36568000 544 | 2021-02-26,102.526001,103.550499,100.803001,101.843002,101.843002,41670000 545 | 2021-03-01,102.825996,104.325996,102.305000,104.075500,104.075500,28090000 546 | 2021-03-02,103.809502,105.218498,103.563004,103.792000,103.792000,22692000 547 | 2021-03-03,103.360497,104.425903,100.500000,101.335503,101.335503,29684000 548 | 2021-03-04,101.168503,104.461998,101.013496,102.454498,102.454498,42360000 549 | 2021-03-05,103.655998,105.905502,102.320747,105.427002,105.427002,43904000 550 | 2021-03-08,105.056503,106.440498,101.080498,101.208504,101.208504,32948000 551 | 2021-03-09,103.500000,103.902000,102.391502,102.635002,102.635002,33946000 552 | 2021-03-10,103.587997,103.750000,101.668503,102.751503,102.751503,25372000 553 | 2021-03-11,103.703003,106.285004,103.619003,105.738503,105.738503,24782000 554 | 2021-03-12,104.250000,104.513000,102.377502,103.096001,103.096001,34516000 555 | 2021-03-15,103.114998,103.352997,102.175499,103.324501,103.324501,25962000 556 | 2021-03-16,103.949501,106.178001,103.500000,104.625999,104.625999,29832000 557 | 2021-03-17,103.801498,105.488998,102.699997,104.554001,104.554001,25980000 558 | 2021-03-18,103.050003,103.775002,101.677498,101.810997,101.810997,27228000 559 | 2021-03-19,102.102501,102.654999,100.884003,102.160004,102.160004,46298000 560 | 2021-03-22,102.092003,102.899498,101.303497,101.929497,101.929497,39096000 561 | 2021-03-23,102.584999,103.615097,101.960999,102.648003,102.648003,27340000 562 | 2021-03-24,103.268501,103.910500,102.077751,102.252998,102.252998,23080000 563 | 2021-03-25,102.240501,102.943497,100.536499,102.218002,102.218002,28378000 564 | 2021-03-26,101.943001,102.549500,100.700996,101.777496,101.777496,29870000 565 | 2021-03-29,101.393997,102.921501,100.780998,102.797501,102.797501,24596000 566 | 2021-03-30,102.881500,103.539001,102.201500,102.777000,102.777000,20732000 567 | 2021-03-31,102.956001,104.666351,102.837250,103.431503,103.431503,29198000 568 | 2021-04-01,104.897499,107.147003,104.844498,106.887497,106.887497,33980000 569 | 2021-04-05,107.647003,111.865501,107.581001,111.277496,111.277496,43298000 570 | 2021-04-06,111.125000,111.883003,110.739998,111.237503,111.237503,27060000 571 | 2021-04-07,111.306503,112.750000,111.266502,112.484001,112.484001,25798000 572 | 2021-04-08,113.898003,114.200249,112.884003,113.272003,113.272003,27166000 573 | 2021-04-09,112.834999,114.452003,112.685699,114.293999,114.293999,20888000 574 | 2021-04-12,113.312500,113.765999,111.923248,112.739502,112.739502,31318000 575 | 2021-04-13,113.073502,113.860497,112.804497,113.363503,113.363503,23310000 576 | 2021-04-14,113.758003,113.899498,112.459503,112.741997,112.741997,20220000 577 | 2021-04-15,113.848999,115.329849,113.300003,114.833000,114.833000,27472000 578 | 2021-04-16,115.150002,115.321999,114.222504,114.888000,114.888000,22596000 579 | 2021-04-19,114.598999,115.922501,114.392250,115.120003,115.120003,24688000 580 | 2021-04-20,115.394501,115.480003,113.585503,114.681503,114.681503,21774000 581 | 2021-04-21,114.262497,114.765999,112.928497,114.664497,114.664497,23930000 582 | 2021-04-22,114.661499,115.188103,112.822502,113.396004,113.396004,21096000 583 | 2021-04-23,114.173500,116.291000,113.910500,115.764999,115.764999,28670000 584 | 2021-04-26,115.996498,117.063004,115.692001,116.336998,116.336998,20834000 585 | 2021-04-27,116.800003,116.872498,115.213501,115.356003,115.356003,31972000 586 | 2021-04-28,120.357246,122.618896,118.742500,118.995499,118.995499,59728000 587 | 2021-04-29,120.516502,121.825996,120.113998,121.494499,121.494499,39554000 588 | 2021-04-30,120.224503,121.357002,120.108002,120.505997,120.505997,39142000 589 | 2021-05-03,120.136002,120.985001,119.224998,119.758499,119.758499,33788000 590 | 2021-05-04,118.487000,118.962997,115.584999,117.712502,117.712502,35120000 591 | 2021-05-05,118.420998,119.110001,117.570503,117.836998,117.836998,21806000 592 | 2021-05-06,117.531998,119.135498,117.116898,119.067497,119.067497,20618000 593 | 2021-05-07,120.000000,120.820503,119.500000,119.934502,119.934502,23272000 594 | 2021-05-10,118.744499,118.900002,116.736504,117.083000,117.083000,26006000 595 | 2021-05-11,114.593002,116.099998,114.150002,115.438004,115.438004,32110000 596 | 2021-05-12,113.085503,114.268501,111.502502,111.954002,111.954002,34934000 597 | 2021-05-13,113.054497,113.830048,112.136002,113.098503,113.098503,26670000 598 | 2021-05-14,114.591499,116.056999,114.166000,115.807999,115.807999,26624000 599 | 2021-05-17,115.466003,116.167000,114.750000,116.070503,116.070503,19842000 600 | 2021-05-18,116.845299,117.157501,115.157997,115.171501,115.171501,17302000 601 | 2021-05-19,113.220001,115.837997,113.176003,115.435501,115.435501,19350000 602 | 2021-05-20,116.402000,118.016998,116.054497,117.804497,117.804497,23832000 603 | 2021-05-21,118.299500,118.449997,117.118500,117.254997,117.254997,22832000 604 | 2021-05-24,118.349998,120.924004,118.005501,120.333504,120.333504,21244000 605 | 2021-05-25,121.000000,121.644501,120.149498,120.453499,120.453499,18838000 606 | 2021-05-26,120.641747,122.147202,120.625748,121.676498,121.676498,21856000 607 | 2021-05-27,121.847000,122.000000,120.099998,120.125504,120.125504,38962000 608 | 2021-05-28,121.098000,121.406998,120.384499,120.578003,120.578003,24108000 609 | 2021-06-01,121.099998,121.898552,120.244003,121.490501,121.490501,19166000 610 | 2021-06-02,121.765503,122.099998,120.209999,121.064003,121.064003,17158000 611 | 2021-06-03,119.750999,120.487251,119.141502,120.230499,120.230499,18346000 612 | 2021-06-04,121.125999,122.692947,120.888496,122.587997,122.587997,25948000 613 | 2021-06-07,122.566002,123.400002,122.053650,123.304497,123.304497,23850000 614 | 2021-06-08,123.995003,124.724747,123.412003,124.142502,124.142502,25060000 615 | 2021-06-09,124.974998,125.250000,124.366501,124.570000,124.570000,20126000 616 | 2021-06-10,124.700500,126.163002,124.699997,126.080002,126.080002,31234000 617 | 2021-06-11,126.246002,126.349503,124.914497,125.696503,125.696503,25240000 618 | 2021-06-14,125.669502,126.411499,125.046997,126.351997,126.351997,22550000 619 | 2021-06-15,126.522003,126.862000,125.648499,126.032997,126.032997,22182000 620 | 2021-06-16,126.247498,126.523499,124.149948,125.696503,125.696503,26316000 621 | 2021-06-17,125.523003,127.196503,125.514999,126.371002,126.371002,25756000 622 | 2021-06-18,125.705498,126.389000,124.602997,125.567497,125.567497,53306000 623 | 2021-06-21,125.739998,127.036751,125.134247,126.455002,126.455002,26256000 624 | 2021-06-22,126.449997,127.269997,126.026497,126.999496,126.999496,20984000 625 | 2021-06-23,126.550003,127.795998,126.251999,126.461502,126.461502,19694000 626 | 2021-06-24,127.053497,127.535500,126.959999,127.281998,127.281998,18934000 627 | 2021-06-25,126.957001,127.504997,126.444000,126.995003,126.995003,33484000 628 | 2021-06-28,127.000000,127.336998,125.973801,126.819504,126.819504,28110000 629 | 2021-06-29,126.772499,127.000000,125.436996,126.018501,126.018501,20950000 630 | 2021-06-30,125.653549,125.800003,124.757500,125.316002,125.316002,24006000 631 | 2021-07-01,124.849747,126.462502,124.849747,126.368500,126.368500,17120000 632 | 2021-07-02,126.839500,128.848007,126.768997,128.718994,128.718994,21160000 633 | 2021-07-06,129.449493,129.884506,128.408997,129.770996,129.770996,21350000 634 | 2021-07-07,130.341003,130.639893,129.759995,130.077499,130.077499,16680000 635 | 2021-07-08,128.250000,130.032501,128.039993,129.177002,129.177002,19780000 636 | 2021-07-09,128.944504,129.849503,128.943497,129.574493,129.574493,15106000 637 | 2021-07-12,129.833496,130.770004,129.600006,130.563995,130.563995,16944000 638 | 2021-07-13,130.881500,132.042007,130.636993,130.994507,130.994507,16618000 639 | 2021-07-14,131.901505,132.996002,131.897995,132.082504,132.082504,17912000 640 | 2021-07-15,132.500000,132.595001,130.598007,131.266495,131.266495,16586000 641 | 2021-07-16,131.641006,132.182999,130.821503,131.845505,131.845505,14856000 642 | 2021-07-19,131.155502,131.246994,128.537003,129.253998,129.253998,25710000 643 | 2021-07-20,130.003998,132.001343,129.188400,131.101501,131.101501,19084000 644 | 2021-07-21,130.787003,132.617249,130.601501,132.600494,132.600494,14742000 645 | 2021-07-22,132.649994,133.504501,132.399994,133.328506,133.328506,13608000 646 | 2021-07-23,135.259995,138.808502,134.700500,137.815994,137.815994,26378000 647 | 2021-07-26,138.250000,139.712997,137.651001,139.644501,139.644501,23052000 648 | 2021-07-27,140.011002,140.011002,135.100006,136.796494,136.796494,42164000 649 | 2021-07-28,138.561996,139.675995,136.350006,136.381500,136.381500,54688000 650 | 2021-07-29,136.380600,137.151505,136.138000,136.540497,136.540497,19284000 651 | 2021-07-30,135.511002,135.771347,134.814194,135.220993,135.220993,23954000 652 | 2021-08-02,135.484497,136.020493,134.669495,135.989502,135.989502,20140000 653 | 2021-08-03,136.000000,136.335495,134.183502,136.279999,136.279999,19064000 654 | 2021-08-04,136.249496,136.537994,135.414993,136.028503,136.028503,16528000 655 | 2021-08-05,136.028503,136.949997,135.600006,136.940002,136.940002,11866000 656 | 2021-08-06,136.294998,137.080048,136.046494,137.035995,137.035995,13560000 657 | 2021-08-09,136.949005,138.321503,136.428757,138.001999,138.001999,12374000 658 | 2021-08-10,138.079498,138.551498,137.226501,138.096497,138.096497,16034000 659 | 2021-08-11,138.283005,138.847748,137.350006,137.689499,137.689499,15204000 660 | 2021-08-12,137.712997,138.417999,136.779007,138.389496,138.389496,14646000 661 | 2021-08-13,138.357498,138.673996,138.005005,138.406006,138.406006,12580000 662 | 2021-08-16,138.000000,138.990494,136.165756,138.916000,138.916000,18040000 663 | 2021-08-17,138.190994,138.718506,136.787506,137.300507,137.300507,21272000 664 | 2021-08-18,137.115494,138.294006,136.421005,136.570007,136.570007,14934000 665 | 2021-08-19,135.467499,137.451996,135.356003,136.913498,136.913498,18296000 666 | 2021-08-20,137.082993,138.614502,136.466995,138.436996,138.436996,15564000 667 | 2021-08-23,138.998505,142.177002,138.747955,141.099503,141.099503,21090000 668 | 2021-08-24,141.543503,143.007507,141.353500,142.398499,142.398499,15126000 669 | 2021-08-25,142.882996,143.313004,142.439499,142.949997,142.949997,12838000 670 | 2021-08-26,142.618500,143.134796,142.091507,142.123001,142.123001,14922000 671 | 2021-08-27,142.112503,145.011002,142.020004,144.550507,144.550507,24562000 672 | 2021-08-30,144.704498,146.489502,144.600006,145.469498,145.469498,16916000 673 | 2021-08-31,145.884506,146.112000,145.000000,145.462006,145.462006,26756000 674 | 2021-09-01,145.649994,146.820496,145.614502,145.841995,145.841995,15824000 675 | 2021-09-02,145.949493,146.324997,144.106506,144.218994,144.218994,21844000 676 | 2021-09-03,144.145996,145.376999,143.505005,144.774994,144.774994,19104000 677 | 2021-09-07,144.749496,145.824005,144.541000,145.518997,145.518997,15170000 678 | 2021-09-08,145.393494,145.550995,144.199997,144.883499,144.883499,15486000 679 | 2021-09-09,144.883499,145.669495,144.434006,144.913498,144.913498,14798000 680 | 2021-09-10,145.443497,146.018997,141.741501,141.921005,141.921005,32896000 681 | 2021-09-13,143.201004,144.190994,142.282501,143.464996,143.464996,20176000 682 | 2021-09-14,144.160995,144.727493,142.905502,143.406006,143.406006,18916000 683 | 2021-09-15,143.759003,145.581497,142.255997,145.205994,145.205994,20648000 684 | 2021-09-16,145.121002,145.199997,143.416351,144.373505,144.373505,20292000 685 | 2021-09-17,143.798492,144.249496,141.061493,141.463501,141.463501,60040000 686 | 2021-09-20,139.000198,139.362503,137.052994,139.016998,139.016998,34918000 687 | 2021-09-21,140.117004,140.811600,138.905502,139.646500,139.646500,18130000 688 | 2021-09-22,140.050507,141.583496,139.471756,140.938507,140.938507,22068000 689 | 2021-09-23,141.609497,142.252457,141.096497,141.826508,141.826508,17272000 690 | 2021-09-24,140.945999,142.903503,140.850494,142.632996,142.632996,14950000 691 | 2021-09-27,141.585495,142.500000,140.500000,141.501007,141.501007,18844000 692 | 2021-09-28,139.088501,139.606506,135.699997,136.184006,136.184006,42190000 693 | 2021-09-29,137.109695,137.398499,134.250000,134.520996,134.520996,26338000 694 | 2021-09-30,134.324997,135.589996,133.000000,133.265503,133.265503,35294000 695 | 2021-10-01,133.554504,137.070999,133.377502,136.462494,136.462494,28388000 696 | 2021-10-04,135.699493,135.699997,131.166504,133.764999,133.764999,31530000 697 | 2021-10-05,134.000000,137.362000,134.000000,136.177002,136.177002,24126000 698 | 2021-10-06,134.625504,137.852005,134.486496,137.354004,137.354004,19764000 699 | 2021-10-07,138.863007,140.154449,138.563004,139.185501,139.185501,18250000 700 | 2021-10-08,139.906006,140.317001,139.429352,140.056000,140.056000,18924000 701 | 2021-10-11,139.800003,140.763657,138.806503,138.847504,138.847504,16584000 702 | 2021-10-12,139.637497,139.695007,136.250000,136.712997,136.712997,22536000 703 | 2021-10-13,137.750000,138.550003,136.976501,137.899994,137.899994,16380000 704 | 2021-10-14,139.951996,141.651505,139.339005,141.412003,141.412003,21426000 705 | 2021-10-15,142.199997,142.199997,141.064499,141.675003,141.675003,21250000 706 | 2021-10-18,141.213501,142.998749,141.213501,142.960495,142.960495,16564000 707 | 2021-10-19,143.291504,144.106995,143.095993,143.822006,143.822006,15316000 708 | 2021-10-20,144.222504,144.247757,141.912003,142.414993,142.414993,17940000 709 | 2021-10-21,142.192001,142.849503,141.636993,142.780502,142.780502,14850000 710 | 2021-10-22,140.350998,141.558502,137.170502,138.625000,138.625000,30182000 711 | 2021-10-25,138.810501,139.205795,136.748505,138.772995,138.772995,21082000 712 | 2021-10-26,140.606003,140.839493,139.005493,139.671997,139.671997,28258000 713 | 2021-10-27,139.902496,149.117996,139.902496,146.427505,146.427505,51850000 714 | 2021-10-28,147.298996,147.424500,144.763504,146.128998,146.128998,32418000 715 | 2021-10-29,145.520004,148.613007,145.166504,148.270493,148.270493,28954000 716 | 2021-11-01,148.164993,148.399506,143.579498,143.774002,143.774002,32272000 717 | 2021-11-02,144.809402,146.920502,144.641006,145.863007,145.863007,21150000 718 | 2021-11-03,146.274994,146.910507,145.053497,146.789993,146.789993,17886000 719 | 2021-11-04,147.199997,149.949997,146.634995,148.682999,148.682999,24700000 720 | 2021-11-05,149.353500,150.570755,148.651993,149.240997,149.240997,20408000 721 | 2021-11-08,150.000000,151.034500,149.119995,149.351501,149.351501,18388000 722 | 2021-11-09,149.746002,150.378494,147.507004,149.248505,149.248505,16876000 723 | 2021-11-10,148.009750,148.699997,145.324997,146.626007,146.626007,22708000 724 | 2021-11-11,147.106995,148.502243,146.694504,146.748001,146.748001,12464000 725 | 2021-11-12,147.831497,149.859497,146.453995,149.645493,149.645493,17048000 726 | 2021-11-15,150.000000,150.477005,148.652496,149.388000,149.388000,16248000 727 | 2021-11-16,149.170502,149.832504,148.350006,149.076004,149.076004,17254000 728 | 2021-11-17,149.229004,149.626007,148.563004,149.061996,149.061996,15290000 729 | 2021-11-18,149.145996,151.610001,148.998505,150.709000,150.709000,26658000 730 | 2021-11-19,151.000000,151.850006,149.887497,149.952499,149.952499,19766000 731 | 2021-11-22,150.141754,150.744507,147.005493,147.078506,147.078506,24608000 732 | 2021-11-23,147.113007,147.694000,144.889496,146.757004,146.757004,18126000 733 | 2021-11-24,146.350006,147.000000,145.199005,146.717499,146.717499,16464000 734 | 2021-11-26,145.015503,145.296997,142.485504,142.806000,142.806000,16992000 735 | 2021-11-29,144.298492,146.862000,144.298492,146.113998,146.113998,26276000 736 | 2021-11-30,145.450256,146.628494,142.065994,142.451996,142.451996,41590000 737 | 2021-12-01,144.212494,146.499146,141.500000,141.617996,141.617996,28476000 738 | 2021-12-02,141.824005,144.675003,140.981995,143.776505,143.776505,21250000 739 | 2021-12-03,144.495499,145.212997,141.149994,142.520493,142.520493,26688000 740 | 2021-12-06,143.574005,144.351501,140.647003,143.796494,143.796494,22198000 741 | 2021-12-07,145.949997,148.300003,145.702499,148.036499,148.036499,23258000 742 | 2021-12-08,148.331497,149.156494,147.199997,148.720505,148.720505,18964000 743 | 2021-12-09,148.175995,149.604996,147.529007,148.106003,148.106003,18580000 744 | 2021-12-10,149.100006,149.399994,147.357498,148.675003,148.675003,21634000 745 | 2021-12-13,148.444000,148.562500,146.360001,146.704498,146.704498,24104000 746 | 2021-12-14,144.770004,145.442001,142.242493,144.970505,144.970505,24778000 747 | 2021-12-15,144.365997,147.517242,142.705505,147.368500,147.368500,27280000 748 | 2021-12-16,148.076996,148.551498,144.092499,144.838501,144.838501,27400000 749 | 2021-12-17,142.714493,144.460098,141.787994,142.802994,142.802994,43404000 750 | 2021-12-20,140.679596,142.610504,140.250000,142.401505,142.401505,20264000 751 | 2021-12-21,143.149994,144.692047,141.735001,144.220505,144.220505,19548000 752 | 2021-12-22,144.100006,147.302994,143.962997,146.949005,146.949005,18438000 753 | 2021-12-23,147.089493,148.572601,146.950851,147.142502,147.142502,13818000 754 | 2021-12-27,147.463501,148.426498,147.250000,148.063995,148.063995,13256000 755 | 2021-12-28,148.374496,148.374496,145.935501,146.447998,146.447998,18624000 756 | 2021-12-29,146.429504,147.183746,145.504501,146.504501,146.504501,17022000 757 | 2021-12-30,146.449997,147.062500,145.758499,146.002502,146.002502,12978000 758 | 2021-12-31,145.544006,146.365005,144.677505,144.679504,144.679504,17298000 759 | 2022-01-03,144.475494,145.550003,143.502502,145.074493,145.074493,25214000 760 | 2022-01-04,145.550507,146.610001,143.816147,144.416504,144.416504,22928000 761 | 2022-01-05,144.181000,144.298004,137.523499,137.653503,137.653503,49642000 762 | 2022-01-06,137.497498,139.686005,136.763504,137.550995,137.550995,29050000 763 | 2022-01-07,137.904999,138.254745,135.789001,137.004501,137.004501,19408000 764 | 2022-01-10,135.098999,138.639999,133.140503,138.574005,138.574005,34096000 765 | 2022-01-11,138.180496,140.329498,136.813507,140.017502,140.017502,23502000 766 | 2022-01-12,141.554504,142.814255,141.112000,141.647995,141.647995,23642000 767 | 2022-01-13,141.840500,143.185501,138.914001,139.130997,139.130997,26566000 768 | 2022-01-14,137.500000,141.200500,137.500000,139.786499,139.786499,23826000 769 | 2022-01-18,136.600006,137.391495,135.617004,136.290497,136.290497,27382000 770 | 2022-01-19,136.938507,138.399506,135.500000,135.651993,135.651993,20796000 771 | 2022-01-20,136.514008,137.912003,133.144501,133.506500,133.506500,21930000 772 | 2022-01-21,133.011993,134.760498,130.001007,130.091995,130.091995,41920000 773 | 2022-01-24,126.027496,130.778503,124.641953,130.371994,130.371994,55148000 774 | 2022-01-25,128.435501,129.338501,126.377998,126.735497,126.735497,36008000 775 | 2022-01-26,130.592499,132.807495,127.153503,129.240005,129.240005,39630000 776 | 2022-01-27,131.360992,132.609955,128.945007,129.121002,129.121002,30248000 777 | 2022-01-28,130.000000,133.370499,128.694504,133.289505,133.289505,30518000 778 | 2022-01-31,134.197998,135.843506,132.274002,135.698502,135.698502,34056000 779 | 2022-02-01,137.835007,138.199997,134.568253,137.878494,137.878494,51204000 780 | 2022-02-02,151.863495,152.100006,145.557495,148.036499,148.036499,89750000 781 | 2022-02-03,145.294998,149.117706,142.205002,142.650497,142.650497,56930000 782 | 2022-02-04,143.016998,144.535248,139.817505,143.016006,143.016006,49224000 783 | 2022-02-07,143.709000,143.846497,138.699005,138.938004,138.938004,44610000 784 | 2022-02-08,138.991257,139.837097,136.873001,139.212997,139.212997,34256000 785 | 2022-02-09,140.849747,142.175507,140.376999,141.453003,141.453003,28628000 786 | 2022-02-10,139.500000,141.431000,138.050003,138.602493,138.602493,33018000 787 | 2022-02-11,138.750000,139.283249,133.288498,134.130005,134.130005,38808000 788 | 2022-02-14,133.365494,136.166504,133.302002,135.300003,135.300003,26792000 789 | 2022-02-15,137.471497,137.899994,135.539505,136.425507,136.425507,26578000 790 | 2022-02-16,136.430496,137.945999,134.823654,137.487503,137.487503,25610000 791 | 2022-02-17,136.149994,136.839493,132.201996,132.308502,132.308502,30968000 792 | 2022-02-18,133.037506,133.824005,130.307053,130.467499,130.467499,31858000 793 | 2022-02-22,129.985001,131.900757,127.740997,129.402496,129.402496,38906000 794 | 2022-02-23,131.078506,131.748993,127.503502,127.584999,127.584999,26432000 795 | 2022-02-24,125.000000,133.037003,124.764503,132.673492,132.673492,43166000 796 | 2022-02-25,133.525497,135.389008,131.764999,134.519501,134.519501,26236000 797 | 2022-02-28,133.284500,135.640503,132.825256,134.891006,134.891006,29676000 798 | 2022-03-01,134.479996,136.110992,133.378494,134.167999,134.167999,24640000 799 | 2022-03-02,134.608246,135.615494,133.432495,134.751495,134.751495,23966000 800 | 2022-03-03,135.978500,136.713806,133.431000,134.307999,134.307999,19780000 801 | 2022-03-04,133.382507,134.199005,130.408493,132.121994,132.121994,24446000 802 | 2022-03-07,131.904007,131.904007,126.410004,126.464500,126.464500,39178000 803 | 2022-03-08,126.250504,131.246506,125.860748,127.278503,127.278503,35250000 804 | 2022-03-09,131.399994,134.198502,130.087997,133.865997,133.865997,32258000 805 | 2022-03-10,131.462494,133.538498,131.401001,132.682007,132.682007,24266000 806 | 2022-03-11,133.999496,134.199997,130.296494,130.475494,130.475494,26600000 807 | 2022-03-14,130.572998,131.026001,126.413002,126.740997,126.740997,30254000 808 | 2022-03-15,127.741501,130.517242,126.568001,129.660507,129.660507,30292000 809 | 2022-03-16,131.000000,133.770996,129.201004,133.690506,133.690506,32058000 810 | 2022-03-17,133.320999,134.739502,132.718994,134.600494,134.600494,23994000 811 | 2022-03-18,133.884003,136.913498,132.932007,136.801498,136.801498,45900000 812 | 2022-03-21,136.847504,137.582504,134.611496,136.478500,136.478500,26632000 813 | 2022-03-22,136.500000,141.500000,136.500000,140.277496,140.277496,29776000 814 | 2022-03-23,139.138504,140.024994,138.166504,138.503494,138.503494,25302000 815 | 2022-03-24,139.272507,141.396500,138.039398,141.311996,141.311996,20544000 816 | 2022-03-25,141.753998,141.959503,139.699493,141.521500,141.521500,19270000 817 | 2022-03-28,140.684494,141.976501,139.828156,141.949997,141.949997,23774000 818 | 2022-03-29,143.160507,144.162506,142.483994,143.250000,143.250000,28678000 819 | 2022-03-30,142.869995,143.480499,142.167999,142.644501,142.644501,21046000 820 | 2022-03-31,142.448502,142.644501,139.619003,139.649506,139.649506,29516000 821 | 2022-04-01,140.009995,140.949997,138.796997,140.699997,140.699997,23480000 822 | 2022-04-04,140.824493,144.043747,140.824493,143.642502,143.642502,19076000 823 | 2022-04-05,143.399506,143.589996,140.943497,141.063004,141.063004,19256000 824 | 2022-04-06,139.161499,139.848495,136.418106,137.175995,137.175995,23574000 825 | 2022-04-07,136.617996,137.701508,134.857254,136.464996,136.464996,19448000 826 | 2022-04-08,136.250000,136.250000,133.752502,134.010498,134.010498,16434000 827 | 2022-04-11,132.899994,132.939194,129.617493,129.796494,129.796494,24188000 828 | 2022-04-12,132.423492,132.423492,127.575996,128.374496,128.374496,23004000 829 | 2022-04-13,128.626495,130.655746,128.438599,130.285995,130.285995,19542000 830 | 2022-04-14,130.649506,130.710251,127.111504,127.252998,127.252998,23484000 831 | 2022-04-18,127.410004,128.712006,126.578453,127.960999,127.960999,14918000 832 | 2022-04-19,128.076996,130.903748,127.451500,130.531006,130.531006,22720000 833 | 2022-04-20,131.283997,131.923492,127.894051,128.245499,128.245499,22610000 834 | 2022-04-21,129.350006,130.307495,124.650002,124.937500,124.937500,30158000 835 | 2022-04-22,125.000000,125.452003,119.140503,119.613998,119.613998,46410000 836 | 2022-04-25,119.429497,123.278000,118.769249,123.250000,123.250000,34522000 837 | 2022-04-26,122.750000,122.750000,119.161850,119.505997,119.505997,49394000 838 | 2022-04-27,114.373001,117.500000,113.124252,115.020500,115.020500,62238000 839 | 2022-04-28,117.114998,120.438499,115.143898,119.411499,119.411499,36790000 840 | 2022-04-29,117.578003,118.959999,114.694000,114.966499,114.966499,33694000 841 | 2022-05-02,113.906502,117.339500,113.399498,117.156998,117.156998,30280000 842 | 2022-05-03,116.764999,119.300003,116.626999,118.129501,118.129501,21216000 843 | 2022-05-04,118.003502,123.142998,115.738503,122.574997,122.574997,33232000 844 | 2022-05-05,120.220497,121.233253,115.182503,116.746498,116.746498,43090000 845 | 2022-05-06,115.518997,117.498497,114.142998,115.660004,115.660004,35310000 846 | 2022-05-09,113.303497,115.562897,112.551498,113.084000,113.084000,34520000 847 | 2022-05-10,116.040497,116.691002,113.383301,114.584503,114.584503,31158000 848 | 2022-05-11,113.710503,116.670998,113.650002,113.960999,113.960999,36502000 849 | 2022-05-12,111.938004,114.856499,110.113503,113.161003,113.161003,41464000 850 | 2022-05-13,114.845497,118.084999,114.000000,116.515503,116.515503,29738000 851 | 2022-05-16,115.384003,116.607498,114.334999,114.792503,114.792503,23282000 852 | 2022-05-17,117.227501,117.227501,115.337502,116.701500,116.701500,21576000 853 | 2022-05-18,115.237503,115.695648,112.141998,112.401001,112.401001,27982000 854 | 2022-05-19,111.841003,113.587502,110.468002,110.745499,110.745499,29192000 855 | 2022-05-20,112.085503,112.550003,106.373001,109.313004,109.313004,37586000 856 | 2022-05-23,110.103996,112.005501,109.154251,111.666496,111.666496,31558000 857 | 2022-05-24,106.377502,106.394997,102.208000,105.926003,105.926003,60386000 858 | 2022-05-25,105.141998,106.544701,104.211250,105.839500,105.839500,37900000 859 | 2022-05-26,106.050499,108.955254,105.487999,108.295998,108.295998,30288000 860 | 2022-05-27,109.788498,112.867996,109.550003,112.799004,112.799004,29924000 861 | 2022-05-31,113.079002,116.433502,112.572502,114.039001,114.039001,51302000 862 | 2022-06-01,114.931503,117.399002,113.550499,114.137001,114.137001,28630000 863 | 2022-06-02,114.188004,117.898003,113.307999,117.746002,117.746002,27472000 864 | 2022-06-03,115.992500,116.364502,113.667999,114.564003,114.564003,25052000 865 | 2022-06-06,116.742500,119.398499,116.528297,117.010498,117.010498,23786000 866 | 2022-06-07,115.648003,117.748650,115.125504,117.229500,117.229500,26414000 867 | 2022-06-08,116.876503,118.646004,116.696747,117.237999,117.237999,22544000 868 | 2022-06-09,116.341499,118.349998,114.866997,114.917999,114.917999,23142000 869 | 2022-06-10,112.781250,113.497002,110.861000,111.427498,111.427498,31324000 870 | 2022-06-13,107.445999,109.218498,106.588051,106.876503,106.876503,36756000 871 | 2022-06-14,106.889999,108.457497,106.351997,107.194000,107.194000,25480000 872 | 2022-06-15,108.899498,112.063004,108.118752,110.390503,110.390503,33192000 873 | 2022-06-16,108.149498,109.290497,105.792503,106.636002,106.636002,35314000 874 | 2022-06-17,106.535004,109.249496,105.628548,107.865501,107.865501,43516000 875 | 2022-06-21,109.702003,112.672997,109.293503,112.014999,112.014999,39010000 876 | 2022-06-22,111.163002,113.769501,110.724297,112.033997,112.033997,23922000 877 | 2022-06-23,112.949997,113.196503,111.028999,112.684502,112.684502,24710000 878 | 2022-06-24,113.602997,118.637497,113.602997,118.538002,118.538002,39122000 879 | 2022-06-27,118.934998,119.250000,116.000748,116.622498,116.622498,32840000 880 | 2022-06-28,116.350998,117.856499,112.444000,112.571503,112.571503,28232000 881 | 2022-06-29,112.148499,113.664497,111.554001,112.256500,112.256500,18628000 882 | 2022-06-30,110.499496,111.329803,107.309998,109.372498,109.372498,38046000 883 | 2022-07-01,108.336998,109.806351,107.105003,109.081001,109.081001,31028000 884 | 2022-07-05,107.514503,114.052597,106.249496,113.887001,113.887001,36398000 885 | 2022-07-06,114.092003,116.351997,112.250504,115.213501,115.213501,28852000 886 | 2022-07-07,116.008003,119.862000,115.533997,119.306000,119.306000,32184000 887 | 2022-07-08,117.550003,120.434998,117.514000,120.168503,120.168503,29082000 888 | 2022-07-11,118.650002,118.794502,116.234497,116.522499,116.522499,26718000 889 | 2022-07-12,116.838501,117.849503,114.614998,114.849503,114.849503,24970000 890 | 2022-07-13,112.639000,115.156998,111.822998,112.186996,112.186996,38958000 891 | 2022-07-14,110.825996,111.987503,109.325500,111.440002,111.440002,32366000 892 | 2022-07-15,112.962997,114.000504,111.822502,112.766998,112.766998,34330000 893 | 2022-07-18,113.440002,114.800003,109.300003,109.910004,109.910004,33354000 894 | 2022-07-19,111.730003,114.809998,110.500000,114.620003,114.620003,30992300 895 | 2022-07-20,114.059998,116.330002,113.260002,114.699997,114.699997,26780100 896 | 2022-07-21,115.089996,115.209999,111.910004,115.040001,115.040001,27267800 897 | 2022-07-22,111.809998,113.180000,107.599998,108.360001,108.360001,44455300 898 | 2022-07-25,108.879997,110.580002,107.010002,108.209999,108.209999,28289900 899 | 2022-07-26,107.430000,107.739998,104.760002,105.440002,105.440002,36626600 900 | 2022-07-27,109.599998,114.400002,108.419998,113.599998,113.599998,41474600 901 | 2022-07-28,112.800003,114.699997,111.850998,114.589996,114.589996,23303800 902 | 2022-07-29,113.400002,116.900002,113.230003,116.639999,116.639999,31336200 903 | 2022-08-01,115.529999,117.120003,114.690002,115.480003,115.480003,22856200 904 | 2022-08-02,114.430000,117.080002,114.260002,115.900002,115.900002,17911000 905 | 2022-08-03,116.339996,119.419998,116.150002,118.779999,118.779999,25302800 906 | 2022-08-04,118.300003,119.500000,117.709999,118.870003,118.870003,15757700 907 | 2022-08-05,116.930000,118.860001,116.709999,118.220001,118.220001,15615700 908 | 2022-08-08,119.120003,120.860001,117.830002,118.139999,118.139999,17061100 909 | 2022-08-09,117.989998,118.199997,116.559998,117.500000,117.500000,15424300 910 | 2022-08-10,119.589996,121.779999,119.360001,120.650002,120.650002,20497000 911 | 2022-08-11,122.080002,122.339996,119.550003,119.820000,119.820000,16671600 912 | 2022-08-12,121.160004,122.650002,120.400002,122.650002,122.650002,16121100 913 | 2022-08-15,122.209999,123.260002,121.570000,122.879997,122.879997,15525000 914 | 2022-08-16,122.320000,123.227997,121.535004,122.510002,122.510002,15626200 915 | 2022-08-17,120.930000,122.150002,120.199997,120.320000,120.320000,17589200 916 | 2022-08-18,120.230003,121.690002,119.550003,120.860001,120.860001,15652000 917 | 2022-08-19,119.870003,120.000000,117.669998,118.120003,118.120003,20187000 918 | 2022-08-22,116.099998,116.500000,114.669998,115.070000,115.070000,19316000 919 | 2022-08-23,114.320000,115.930000,114.300003,114.769997,114.769997,14390700 920 | 2022-08-24,114.449997,115.717003,113.779999,114.699997,114.699997,16051200 921 | 2022-08-25,115.150002,117.779999,115.050003,117.699997,117.699997,14874700 922 | 2022-08-26,115.809998,116.599998,111.220001,111.300003,111.300003,31698700 923 | 2022-08-29,110.779999,111.959999,109.809998,110.339996,110.339996,20386100 924 | 2022-08-30,111.029999,111.370003,108.800003,109.910004,109.910004,20548200 925 | 2022-08-31,111.629997,111.769997,109.050003,109.150002,109.150002,25898000 926 | 2022-09-01,109.199997,111.220001,108.190002,110.550003,110.550003,22784400 927 | 2022-09-02,111.339996,111.675003,108.129997,108.680000,108.680000,20618100 928 | 2022-09-06,108.135002,108.879997,106.510002,107.480003,107.480003,20565100 929 | 2022-09-07,107.760002,110.989998,107.614998,110.480003,110.480003,22987200 930 | 2022-09-08,109.180000,110.580002,108.059998,109.419998,109.419998,21660700 931 | 2022-09-09,110.050003,112.000000,110.000000,111.779999,111.779999,21732900 932 | 2022-09-12,111.989998,112.639999,110.930000,111.870003,111.870003,19732900 933 | 2022-09-13,108.889999,109.370003,105.000000,105.309998,105.309998,33015000 934 | 2022-09-14,105.440002,106.099998,104.500000,105.870003,105.870003,22115800 935 | 2022-09-15,105.010002,106.209999,103.309998,103.900002,103.900002,26494900 936 | 2022-09-16,102.970001,104.029999,101.855003,103.629997,103.629997,64540100 937 | 2022-09-19,102.540001,104.019997,102.370003,103.849998,103.849998,19738600 938 | 2022-09-20,102.879997,103.169998,101.120003,101.830002,101.830002,24001700 939 | 2022-09-21,102.239998,103.489998,99.989998,100.010002,100.010002,26596800 940 | 2022-09-22,99.449997,101.680000,99.410004,100.570000,100.570000,21272700 941 | 2022-09-23,100.059998,100.110001,98.010002,99.169998,99.169998,25657000 942 | 2022-09-26,98.610001,100.440002,98.379997,98.809998,98.809998,22437900 943 | 2022-09-27,99.910004,100.459999,97.339996,98.089996,98.089996,24225000 944 | 2022-09-28,98.019997,101.400002,97.800003,100.739998,100.739998,24617000 945 | 2022-09-29,99.300003,99.300003,96.519997,98.089996,98.089996,21921500 946 | 2022-09-30,97.730003,99.494003,96.029999,96.150002,96.150002,26277800 947 | 2022-10-03,97.220001,99.970001,97.019997,99.300003,99.300003,24840000 948 | 2022-10-04,101.040001,102.720001,101.040001,102.410004,102.410004,22580900 949 | 2022-10-05,100.690002,102.739998,99.739998,102.220001,102.220001,18475500 950 | 2022-10-06,101.500000,103.730003,101.500000,102.239998,102.239998,17156200 951 | 2022-10-07,100.650002,101.419998,99.209999,99.570000,99.570000,24249900 952 | 2022-10-10,99.849998,99.989998,97.870003,98.709999,98.709999,16529900 953 | 2022-10-11,98.250000,100.120003,97.250000,98.050003,98.050003,21617700 954 | 2022-10-12,98.269997,99.648003,97.669998,98.300003,98.300003,17343400 955 | 2022-10-13,95.930000,100.529999,95.269997,99.709999,99.709999,32812200 956 | 2022-10-14,100.625000,101.290001,97.029999,97.180000,97.180000,22624800 957 | 2022-10-17,99.519997,101.769997,99.510002,100.779999,100.779999,23311600 958 | 2022-10-18,103.940002,104.220001,100.650002,101.389999,101.389999,21610500 959 | 2022-10-19,100.699997,101.658997,99.635002,100.290001,100.290001,21573700 960 | 2022-10-20,100.820000,103.000000,99.970001,100.529999,100.529999,25125100 961 | 2022-10-21,98.459999,101.620003,98.230003,101.480003,101.480003,28988700 962 | 2022-10-24,102.089996,103.099998,100.300003,102.970001,102.970001,24680800 963 | 2022-10-25,103.300003,105.099998,103.019997,104.930000,104.930000,29910200 964 | 2022-10-26,96.760002,98.540001,94.570000,94.820000,94.820000,71504300 965 | 2022-10-27,94.309998,95.169998,91.900002,92.599998,92.599998,54036500 966 | 2022-10-28,92.529999,96.860001,92.322998,96.580002,96.580002,35696900 967 | 2022-10-31,95.779999,96.349998,94.379997,94.660004,94.660004,29868700 968 | 2022-11-01,95.589996,96.165001,90.430000,90.500000,90.500000,43220600 969 | 2022-11-02,90.910004,91.300003,87.010002,87.070000,87.070000,43553600 970 | 2022-11-03,86.345001,86.550003,83.449997,83.489998,83.489998,48510400 971 | 2022-11-04,85.510002,86.730003,83.879997,86.699997,86.699997,40173300 972 | 2022-11-07,87.339996,88.940002,86.959999,88.650002,88.650002,26899900 973 | 2022-11-08,89.160004,90.404999,87.650002,88.910004,88.910004,30172000 974 | 2022-11-09,88.544998,89.489998,87.360001,87.400002,87.400002,26743900 975 | 2022-11-10,92.339996,94.550003,91.650002,94.169998,94.169998,42371200 976 | 2022-11-11,94.709999,97.360001,94.160004,96.730003,96.730003,30569100 977 | 2022-11-14,95.500000,97.180000,95.112999,96.029999,96.029999,24170100 978 | 2022-11-15,98.669998,100.419998,97.019997,98.720001,98.720001,31831000 979 | 2022-11-16,98.019997,99.849998,97.902000,98.989998,98.989998,24660200 980 | 2022-11-17,97.180000,99.480003,97.099998,98.500000,98.500000,21818700 981 | 2022-11-18,99.010002,99.160004,96.739998,97.800003,97.800003,24969900 982 | 2022-11-21,97.559998,98.720001,95.669998,95.830002,95.830002,18696900 983 | 2022-11-22,96.160004,97.547997,94.410004,97.330002,97.330002,18868900 984 | 2022-11-23,97.339996,99.069000,97.339996,98.820000,98.820000,17568900 985 | 2022-11-25,98.464996,98.940002,97.529999,97.599998,97.599998,8567800 986 | 2022-11-28,97.199997,97.830002,95.889999,96.250000,96.250000,19974500 987 | 2022-11-29,96.000000,96.389999,94.389999,95.440002,95.440002,20220000 988 | 2022-11-30,95.120003,101.449997,94.669998,101.449997,101.449997,39888100 989 | 2022-12-01,101.400002,102.589996,100.669998,101.279999,101.279999,21771500 990 | 2022-12-02,99.370003,101.150002,99.169998,100.830002,100.830002,18821500 991 | 2022-12-05,99.815002,101.750000,99.355003,99.870003,99.870003,19955500 992 | 2022-12-06,99.669998,100.209999,96.760002,97.309998,97.309998,20877600 993 | 2022-12-07,96.769997,97.309998,95.025002,95.150002,95.150002,26647900 994 | 2022-12-08,95.690002,95.870003,93.800003,93.949997,93.949997,25593200 995 | 2022-12-09,93.900002,94.489998,93.019997,93.070000,93.070000,21885300 996 | 2022-12-12,93.089996,93.875000,91.900002,93.559998,93.559998,27380900 997 | 2022-12-13,98.070000,99.800003,95.379997,95.849998,95.849998,34788500 998 | 2022-12-14,95.540001,97.220001,93.940002,95.309998,95.309998,26452900 999 | 2022-12-15,93.540001,94.029999,90.430000,91.199997,91.199997,28298800 1000 | 2022-12-16,91.199997,91.750000,90.010002,90.860001,90.860001,48485500 1001 | 2022-12-19,90.879997,91.199997,88.925003,89.150002,89.150002,23020500 1002 | 2022-12-20,88.730003,89.779999,88.040001,89.629997,89.629997,21976800 1003 | 2022-12-21,89.730003,90.915001,88.910004,90.250000,90.250000,20336400 1004 | 2022-12-22,88.930000,89.180000,86.940002,88.260002,88.260002,23656100 1005 | 2022-12-23,87.620003,90.099998,87.620003,89.809998,89.809998,17815000 1006 | 2022-12-27,89.309998,89.500000,87.535004,87.930000,87.930000,15470900 1007 | 2022-12-28,87.500000,88.519997,86.370003,86.459999,86.459999,17879600 1008 | 2022-12-29,87.029999,89.364998,86.989998,88.949997,88.949997,18280700 1009 | 2022-12-30,87.364998,88.830002,87.029999,88.730003,88.730003,19190300 1010 | 2023-01-03,89.830002,91.550003,89.019997,89.699997,89.699997,20738500 1011 | 2023-01-04,91.010002,91.239998,87.800003,88.709999,88.709999,27046500 1012 | 2023-01-05,88.070000,88.209999,86.559998,86.769997,86.769997,23136100 1013 | 2023-01-06,87.360001,88.470001,85.570000,88.160004,88.160004,26612600 1014 | 2023-01-09,89.195000,90.830002,88.580002,88.800003,88.800003,22996700 1015 | 2023-01-10,86.720001,89.474998,86.699997,89.239998,89.239998,22855600 1016 | 2023-01-11,90.059998,92.449997,89.739998,92.260002,92.260002,25998800 1017 | 2023-01-12,92.400002,92.620003,90.570000,91.910004,91.910004,22754200 1018 | 2023-01-13,91.528000,92.980003,90.930000,92.800003,92.800003,18630700 1019 | 2023-01-17,92.779999,92.970001,90.839996,92.160004,92.160004,22935800 1020 | 2023-01-18,92.940002,93.587997,91.400002,91.779999,91.779999,19641600 1021 | 2023-01-19,91.389999,94.400002,91.379997,93.910004,93.910004,28707700 1022 | 2023-01-20,95.949997,99.419998,95.910004,99.279999,99.279999,53704800 1023 | 2023-01-23,99.129997,101.400002,98.750000,101.209999,101.209999,31791800 1024 | 2023-01-24,99.550003,101.089996,98.699997,99.209999,99.209999,27391400 1025 | 2023-01-25,97.199997,97.720001,95.262001,96.730003,96.730003,31000900 1026 | 2023-01-26,98.279999,99.209999,96.820000,99.160004,99.160004,24542100 1027 | 2023-01-27,99.050003,101.580002,98.970001,100.709999,100.709999,29020400 1028 | 2023-01-30,98.745003,99.408997,97.519997,97.949997,97.949997,24365100 1029 | 2023-01-31,97.860001,99.910004,97.790001,99.870003,99.870003,22306800 1030 | 2023-02-01,99.739998,102.190002,98.419998,101.430000,101.430000,26392600 1031 | 2023-02-02,106.790001,108.820000,106.540001,108.800003,108.800003,46622600 1032 | 2023-02-03,103.510002,108.019997,103.300003,105.220001,105.220001,36823400 1033 | 2023-02-06,102.684998,104.699997,102.209999,103.470001,103.470001,25573000 1034 | 2023-02-07,103.629997,108.669998,103.547997,108.040001,108.040001,33738800 1035 | 2023-02-08,102.690002,103.580002,98.455002,100.000000,100.000000,73546000 1036 | 2023-02-09,100.540001,100.610001,93.860001,95.459999,95.459999,97798600 1037 | 2023-02-10,95.739998,97.019997,94.529999,94.860001,94.860001,49325300 1038 | 2023-02-13,95.010002,95.349998,94.050003,95.000000,95.000000,43116600 1039 | 2023-02-14,94.660004,95.175003,92.650002,94.949997,94.949997,42513100 1040 | 2023-02-15,94.739998,97.339996,94.360001,97.099998,97.099998,36964500 1041 | 2023-02-16,95.540001,97.879997,94.970001,95.779999,95.779999,35642100 1042 | 2023-02-17,95.070000,95.750000,93.449997,94.589996,94.589996,31095100 1043 | 2023-02-21,93.239998,93.415001,92.000000,92.050003,92.050003,28367200 1044 | 2023-02-22,91.933998,92.360001,90.870003,91.800003,91.800003,29891100 1045 | 2023-02-23,92.129997,92.129997,90.010002,91.070000,91.070000,32423700 1046 | 2023-02-24,89.629997,90.129997,88.860001,89.349998,89.349998,31295600 1047 | 2023-02-27,90.089996,90.449997,89.610001,90.099998,90.099998,22724300 1048 | 2023-02-28,89.540001,91.449997,89.519997,90.300003,90.300003,30546900 1049 | 2023-03-01,90.160004,91.199997,89.849998,90.510002,90.510002,26323900 1050 | 2023-03-02,89.860001,92.480003,89.769997,92.309998,92.309998,23328600 1051 | 2023-03-03,92.739998,94.110001,92.660004,94.019997,94.019997,30242500 1052 | 2023-03-06,94.360001,96.300003,94.300003,95.580002,95.580002,28288200 1053 | 2023-03-07,95.419998,96.089996,93.844002,94.169998,94.169998,24101500 1054 | 2023-03-08,94.404999,96.239998,94.404999,94.650002,94.650002,25395200 1055 | 2023-03-09,94.489998,95.919998,92.355003,92.660004,92.660004,24438900 1056 | 2023-03-10,92.500000,93.180000,90.800003,91.010002,91.010002,32850100 1057 | 2023-03-13,90.565002,93.080002,89.940002,91.660004,91.660004,31508600 1058 | 2023-03-14,93.070000,94.830002,92.779999,94.250000,94.250000,32303900 1059 | 2023-03-15,93.540001,97.250000,93.040001,96.550003,96.550003,38367300 1060 | 2023-03-16,96.570000,101.970001,95.870003,101.070000,101.070000,54499500 1061 | 2023-03-17,100.839996,103.489998,100.750000,102.459999,102.459999,76140300 1062 | 2023-03-20,101.059998,102.580002,100.790001,101.930000,101.930000,26033900 1063 | 2023-03-21,101.980003,105.959999,101.860001,105.839996,105.839996,33122800 1064 | 2023-03-22,105.139999,107.510002,104.209999,104.220001,104.220001,32336900 1065 | 2023-03-23,105.889999,107.100998,105.410004,106.260002,106.260002,31385800 1066 | 2023-03-24,105.739998,106.160004,104.739998,106.059998,106.059998,25236200 1067 | 2023-03-27,105.320000,105.400002,102.629997,103.059998,103.059998,25393400 1068 | 2023-03-28,103.000000,103.000000,100.279999,101.360001,101.360001,24913500 1069 | 2023-03-29,102.720001,102.820000,101.029999,101.900002,101.900002,26148300 1070 | 2023-03-30,101.440002,101.610001,100.290001,101.320000,101.320000,25009800 1071 | 2023-03-31,101.709999,104.190002,101.440002,104.000000,104.000000,28108000 1072 | 2023-04-03,102.669998,104.949997,102.379997,104.910004,104.910004,20719900 1073 | 2023-04-04,104.839996,106.099998,104.599998,105.120003,105.120003,20377200 1074 | 2023-04-05,106.120003,106.540001,104.101997,104.949997,104.949997,21864200 1075 | 2023-04-06,105.769997,109.629997,104.815002,108.900002,108.900002,34684200 1076 | 2023-04-10,107.389999,107.970001,105.599998,106.949997,106.949997,19741500 1077 | 2023-04-11,106.919998,107.220001,105.279999,106.120003,106.120003,18721300 1078 | 2023-04-12,107.389999,107.586998,104.970001,105.220001,105.220001,22761600 1079 | 2023-04-13,106.470001,108.264999,106.440002,108.190002,108.190002,21650700 1080 | 2023-04-14,107.690002,109.580002,107.589996,109.459999,109.459999,20758700 1081 | 2023-04-17,105.430000,106.709999,105.320000,106.419998,106.419998,29043400 1082 | 2023-04-18,107.000000,107.050003,104.779999,105.120003,105.120003,17641400 1083 | 2023-04-19,104.214996,105.724998,103.800003,105.019997,105.019997,16732000 1084 | 2023-04-20,104.650002,106.888000,104.639999,105.900002,105.900002,22515300 1085 | 2023-04-21,106.089996,106.639999,105.485001,105.910004,105.910004,22379000 1086 | 2023-04-24,106.050003,107.320000,105.360001,106.779999,106.779999,21410900 1087 | 2023-04-25,106.610001,107.440002,104.559998,104.610001,104.610001,31408100 1088 | 2023-04-26,105.559998,107.019997,103.269997,104.449997,104.449997,37068200 1089 | 2023-04-27,105.230003,109.150002,104.419998,108.370003,108.370003,38235200 1090 | 2023-04-28,107.800003,108.290001,106.040001,108.220001,108.220001,23957900 1091 | 2023-05-01,107.720001,108.680000,107.500000,107.709999,107.709999,20926300 1092 | 2023-05-02,107.660004,107.730003,104.500000,105.980003,105.980003,20343100 1093 | 2023-05-03,106.220001,108.129997,105.620003,106.120003,106.120003,17116300 1094 | 2023-05-04,106.160004,106.300003,104.699997,105.209999,105.209999,19780600 1095 | 2023-05-05,105.320000,106.440002,104.738998,106.214996,106.214996,20705300 1096 | 2023-05-08,105.794998,108.419998,105.790001,108.239998,108.239998,17266000 1097 | 2023-05-09,108.779999,110.595001,107.724998,107.940002,107.940002,24782400 1098 | 2023-05-10,108.550003,113.510002,108.480003,112.279999,112.279999,47533500 1099 | 2023-05-11,115.860001,118.440002,114.930000,116.900002,116.900002,57115100 1100 | 2023-05-12,117.000000,118.260002,116.550003,117.919998,117.919998,31272500 1101 | 2023-05-15,116.489998,118.794998,116.480003,116.959999,116.959999,22107900 1102 | 2023-05-16,116.830002,121.199997,116.830002,120.089996,120.089996,32370100 1103 | 2023-05-17,120.180000,122.279999,119.459999,121.480003,121.480003,26659600 1104 | 2023-05-18,121.559998,123.900002,121.489998,123.519997,123.519997,27014500 1105 | 2023-05-19,124.199997,126.478996,122.720001,123.250000,123.250000,30251300 1106 | 2023-05-22,123.510002,127.050003,123.449997,125.870003,125.870003,29760200 1107 | 2023-05-23,124.930000,125.419998,123.050003,123.290001,123.290001,24477900 1108 | 2023-05-24,121.879997,122.750000,120.750000,121.639999,121.639999,23087900 1109 | 2023-05-25,125.209999,125.980003,122.900002,124.349998,124.349998,33812700 1110 | 2023-05-26,124.065002,126.000000,123.290001,125.430000,125.430000,25154700 1111 | 2023-05-30,126.290001,126.379997,122.889999,124.639999,124.639999,27230700 1112 | 2023-05-31,123.699997,124.900002,123.099998,123.370003,123.370003,41548800 1113 | 2023-06-01,123.500000,125.040001,123.300003,124.370003,124.370003,25017700 1114 | 2023-06-02,124.489998,126.745003,124.349998,125.230003,125.230003,19362400 1115 | 2023-06-05,124.610001,127.989998,124.379997,126.629997,126.629997,22672500 1116 | 2023-06-06,126.599998,128.880005,125.970001,127.910004,127.910004,19450100 1117 | 2023-06-07,127.574997,129.550003,122.629997,122.940002,122.940002,34179300 1118 | 2023-06-08,122.584999,123.730003,122.010002,122.669998,122.669998,24815000 1119 | 2023-06-09,122.559998,124.285004,122.419998,122.870003,122.870003,20304500 1120 | 2023-06-12,123.394997,124.750000,122.349998,124.349998,124.349998,22255700 1121 | 2023-06-13,125.650002,125.860001,123.845001,124.430000,124.430000,19287700 1122 | 2023-06-14,123.800003,124.790001,122.160004,124.379997,124.379997,24659600 1123 | 2023-06-15,123.879997,126.160004,123.139999,125.790001,125.790001,24517100 1124 | 2023-06-16,126.699997,126.699997,123.790001,124.059998,124.059998,56686800 1125 | 2023-06-20,123.535004,125.175003,122.830002,123.849998,123.849998,22698000 1126 | 2023-06-21,123.235001,123.410004,120.860001,121.260002,121.260002,22612000 1127 | 2023-06-22,120.660004,123.934998,119.599998,123.870003,123.870003,20781900 1128 | 2023-06-23,122.040001,123.440002,121.860001,123.019997,123.019997,29542900 1129 | 2023-06-26,121.466003,122.720001,118.989998,119.089996,119.089996,23185000 1130 | 2023-06-27,117.839996,119.894997,116.910004,119.010002,119.010002,27221700 1131 | 2023-06-28,117.959999,121.269997,117.599998,121.080002,121.080002,19753100 1132 | 2023-06-29,120.089996,120.910004,119.209999,120.010002,120.010002,18517500 1133 | 2023-06-30,121.099998,122.029999,120.879997,120.970001,120.970001,23865800 1134 | 2023-07-03,120.320000,121.019997,119.705002,120.559998,120.559998,13888300 1135 | 2023-07-05,120.059998,123.370003,120.059998,122.629997,122.629997,17830300 1136 | 2023-07-06,120.639999,121.150002,119.250000,120.930000,120.930000,17732500 1137 | 2023-07-07,120.889999,121.750000,120.089996,120.139999,120.139999,20982400 1138 | 2023-07-10,119.070000,119.070000,116.639999,116.870003,116.870003,32960100 1139 | 2023-07-11,116.760002,118.224998,115.830002,117.709999,117.709999,18286600 1140 | 2023-07-12,119.300003,120.959999,119.000000,119.620003,119.620003,22059600 1141 | 2023-07-13,121.540001,125.334999,121.059998,124.830002,124.830002,31535900 1142 | 2023-07-14,125.129997,127.089996,124.900002,125.699997,125.699997,20482800 1143 | 2023-07-17,126.059998,127.279999,124.500000,125.059998,125.059998,20675300 1144 | 2023-07-18,124.904999,124.989998,123.300003,124.080002,124.080002,21071200 1145 | 2023-07-19,124.790001,125.470001,122.470001,122.779999,122.779999,22313800 1146 | 2023-07-20,122.120003,124.699997,118.684998,119.529999,119.529999,27541700 1147 | 2023-07-21,120.870003,121.300003,119.070000,120.309998,120.309998,56498100 1148 | 2023-07-24,121.926003,123.349998,121.379997,121.879997,121.879997,22276100 1149 | 2023-07-25,121.879997,123.690002,121.529999,122.790001,122.790001,31820800 1150 | 2023-07-26,130.360001,131.369995,128.710007,129.660004,129.660004,46216900 1151 | 2023-07-27,131.800003,133.600006,129.179993,129.869995,129.869995,35931600 1152 | 2023-07-28,130.970001,134.070007,130.919998,133.009995,133.009995,26971000 1153 | 2023-07-31,133.009995,133.830002,132.130005,133.110001,133.110001,18381900 1154 | 2023-08-01,130.854996,132.919998,130.750000,131.889999,131.889999,22154300 1155 | 2023-08-02,129.839996,130.419998,127.849998,128.639999,128.639999,22705800 1156 | 2023-08-03,128.369995,129.770004,127.775002,128.770004,128.770004,15018100 1157 | 2023-08-04,129.600006,131.929993,128.315002,128.539993,128.539993,20509500 1158 | 2023-08-07,129.509995,132.059998,129.429993,131.940002,131.940002,17621000 1159 | 2023-08-08,130.979996,131.940002,130.130005,131.839996,131.839996,16836000 1160 | 2023-08-09,132.190002,132.470001,129.505005,130.149994,130.149994,17745200 1161 | 2023-08-10,131.970001,132.647003,130.035004,130.210007,130.210007,17855700 1162 | 2023-08-11,129.201996,130.440002,128.750000,130.169998,130.169998,15191500 1163 | 2023-08-14,129.850006,131.910004,129.589996,131.830002,131.830002,17526200 1164 | 2023-08-15,131.589996,131.990005,129.819000,130.270004,130.270004,14769200 1165 | 2023-08-16,129.279999,130.897995,128.460007,129.110001,129.110001,17548400 1166 | 2023-08-17,130.449997,132.490997,129.850006,130.460007,130.460007,23665600 1167 | 2023-08-18,129.059998,129.830002,127.000000,128.110001,128.110001,23619400 1168 | 2023-08-21,127.849998,129.259995,127.160004,128.929993,128.929993,21851100 1169 | 2023-08-22,129.130005,130.949997,128.925003,129.690002,129.690002,15569400 1170 | 2023-08-23,130.850006,134.070007,130.509995,133.210007,133.210007,26497000 1171 | 2023-08-24,134.727005,134.970001,130.300003,130.419998,130.419998,18680400 1172 | 2023-08-25,130.139999,131.399994,128.039993,130.690002,130.690002,20678100 1173 | 2023-08-28,132.080002,133.240005,130.850006,131.789993,131.789993,16715500 1174 | 2023-08-29,132.998001,137.294998,132.979996,135.490005,135.490005,30803300 1175 | 2023-08-30,135.570007,137.250000,135.020996,136.929993,136.929993,21773400 1176 | 2023-08-31,137.050003,138.399994,136.820007,137.350006,137.350006,28147900 1177 | 2023-09-01,138.429993,138.580002,135.940002,136.800003,136.800003,16665700 1178 | 2023-09-05,136.440002,137.369995,135.559998,136.710007,136.710007,17730200 1179 | 2023-09-06,137.014999,137.479996,134.690002,135.369995,135.369995,15814300 1180 | 2023-09-07,134.600006,136.580002,133.960007,136.199997,136.199997,16976000 1181 | 2023-09-08,135.869995,137.514999,135.869995,137.199997,137.199997,17810700 1182 | 2023-09-11,137.380005,138.264008,136.550003,137.740005,137.740005,17180800 1183 | 2023-09-12,137.130005,137.639999,135.929993,136.070007,136.070007,15212900 1184 | 2023-09-13,135.899994,137.699997,134.929993,137.500000,137.500000,16394900 1185 | 2023-09-14,138.389999,139.550003,137.059998,138.990005,138.990005,19064600 1186 | 2023-09-15,138.800003,139.360001,137.179993,138.300003,138.300003,48947600 1187 | 2023-09-18,137.630005,139.929993,137.630005,138.960007,138.960007,16233600 1188 | 2023-09-19,138.250000,139.175003,137.500000,138.830002,138.830002,15479100 1189 | 2023-09-20,138.830002,138.839996,134.520004,134.589996,134.589996,21473500 1190 | 2023-09-21,132.389999,133.190002,131.089996,131.360001,131.360001,22042700 1191 | 2023-09-22,131.679993,133.009995,130.509995,131.250000,131.250000,17348700 1192 | 2023-09-25,130.770004,132.220001,130.029999,132.169998,132.169998,14650000 1193 | 2023-09-26,130.914001,131.404999,128.190002,129.449997,129.449997,20378800 1194 | 2023-09-27,129.440002,131.720001,129.380005,131.460007,131.460007,18764200 1195 | 2023-09-28,130.690002,134.179993,130.690002,133.130005,133.130005,18201400 1196 | 2023-09-29,134.080002,134.889999,131.320007,131.850006,131.850006,23224200 1197 | 2023-10-02,132.154999,135.360001,132.065002,135.169998,135.169998,19210400 1198 | 2023-10-03,134.929993,135.240005,132.815002,133.300003,133.300003,19628700 1199 | 2023-10-04,133.660004,136.570007,133.429993,136.270004,136.270004,22848000 1200 | 2023-10-05,136.130005,136.500000,134.455002,135.990005,135.990005,15922900 1201 | 2023-10-06,134.940002,139.186005,134.940002,138.729996,138.729996,20819300 1202 | 2023-10-09,137.990005,139.970001,136.699997,139.500000,139.500000,16599100 1203 | 2023-10-10,139.509995,140.740005,138.429993,139.199997,139.199997,19554900 1204 | 2023-10-11,139.850006,142.220001,139.839996,141.699997,141.699997,20146300 1205 | 2023-10-12,142.160004,142.380005,139.449997,140.289993,140.289993,18173100 1206 | 2023-10-13,140.649994,141.339996,137.970001,138.580002,138.580002,19438700 1207 | 2023-10-16,139.729996,140.904999,139.320007,140.490005,140.490005,17345600 1208 | 2023-10-17,140.029999,141.250000,138.529007,140.990005,140.990005,17424000 1209 | 2023-10-18,140.750000,141.990005,138.705002,139.279999,139.279999,18304900 1210 | 2023-10-19,139.800003,141.005005,138.600006,138.979996,138.979996,21831200 1211 | 2023-10-20,138.589996,139.039993,136.244995,136.740005,136.740005,24953900 1212 | 2023-10-23,136.229996,139.020004,135.110001,137.899994,137.899994,20780700 1213 | 2023-10-24,139.160004,140.710007,138.750000,140.119995,140.119995,26535200 1214 | 2023-10-25,129.770004,130.100006,126.089996,126.669998,126.669998,58796100 1215 | 2023-10-26,124.470001,125.459999,122.320000,123.440002,123.440002,33907400 1216 | 2023-10-27,124.029999,124.440002,121.459999,123.400002,123.400002,37367700 1217 | 2023-10-30,124.459999,126.550003,123.879997,125.750000,125.750000,24165600 1218 | 2023-10-31,126.269997,126.559998,123.925003,125.300003,125.300003,21123400 1219 | 2023-11-01,125.339996,127.739998,124.925003,127.570000,127.570000,26536600 1220 | 2023-11-02,129.559998,130.089996,128.110001,128.580002,128.580002,24091700 1221 | 2023-11-03,129.089996,130.729996,129.009995,130.369995,130.369995,19517900 1222 | 2023-11-06,130.220001,131.559998,129.929993,131.449997,131.449997,15360400 1223 | 2023-11-07,131.979996,133.279999,131.139999,132.399994,132.399994,19223800 1224 | 2023-11-08,132.360001,133.539993,132.160004,133.259995,133.259995,15093600 1225 | 2023-11-09,133.360001,133.960007,131.509995,131.690002,131.690002,17976500 1226 | 2023-11-10,131.529999,134.270004,130.869995,134.059998,134.059998,20872900 1227 | 2023-11-13,133.360001,134.110001,132.770004,133.639999,133.639999,16409900 1228 | 2023-11-14,135.649994,137.240005,135.100006,135.429993,135.429993,22317300 1229 | 2023-11-15,136.639999,136.839996,135.330002,136.380005,136.380005,15840900 1230 | 2023-11-16,136.960007,138.880005,136.080002,138.699997,138.699997,17615100 1231 | 2023-11-17,137.820007,138.000000,135.479996,136.940002,136.940002,25565300 1232 | 2023-11-20,135.500000,138.425003,135.490005,137.919998,137.919998,19569400 1233 | 2023-11-21,137.940002,138.964996,137.705002,138.619995,138.619995,17648100 1234 | 2023-11-22,139.100006,141.100006,139.000000,140.020004,140.020004,17306400 1235 | 2023-11-24,139.539993,139.677002,137.470001,138.220001,138.220001,8828600 1236 | 2023-11-27,137.570007,139.630005,137.539993,138.050003,138.050003,17886400 1237 | 2023-11-28,137.630005,138.660004,137.039993,138.619995,138.619995,17046900 1238 | 2023-11-29,138.985001,139.669998,136.294998,136.399994,136.399994,21014700 1239 | 2023-11-30,136.399994,136.960007,132.789993,133.919998,133.919998,29913500 1240 | 2023-12-01,133.320007,133.500000,132.151993,133.320007,133.320007,24258400 1241 | 2023-12-04,131.294006,131.449997,129.399994,130.630005,130.630005,24117100 1242 | 2023-12-05,130.369995,133.539993,129.729996,132.389999,132.389999,19235100 1243 | 2023-12-06,132.899994,133.309998,131.309998,131.429993,131.429993,16360600 1244 | 2023-12-07,136.600006,140.000000,136.229996,138.449997,138.449997,38419400 1245 | 2023-12-08,135.660004,137.990005,135.570007,136.639999,136.639999,22990900 1246 | 2023-12-11,133.820007,134.789993,132.889999,134.699997,134.699997,24502900 1247 | 2023-12-12,133.270004,134.539993,132.830002,133.639999,133.639999,26584000 1248 | 2023-12-13,134.544998,134.779999,132.949997,133.970001,133.970001,25414500 1249 | 2023-12-14,134.770004,135.035004,131.059998,133.199997,133.199997,29619100 1250 | 2023-12-15,132.919998,134.830002,132.630005,133.839996,133.839996,58569400 1251 | 2023-12-18,133.860001,138.380005,133.770004,137.190002,137.190002,25699800 1252 | 2023-12-19,138.000000,138.770004,137.449997,138.100006,138.100006,20661000 1253 | 2023-12-20,140.330002,143.078003,139.410004,139.660004,139.660004,33507300 1254 | 2023-12-21,140.770004,142.029999,140.473007,141.800003,141.800003,18101500 1255 | 2023-12-22,142.130005,143.250000,142.054993,142.720001,142.720001,18494700 1256 | 2023-12-26,142.979996,143.945007,142.500000,142.820007,142.820007,11170100 1257 | 2023-12-27,142.830002,143.320007,141.050995,141.440002,141.440002,17288400 1258 | 2023-12-28,141.850006,142.270004,140.828003,141.279999,141.279999,12192500 1259 | 2023-12-29,140.679993,141.434998,139.899994,140.929993,140.929993,14872700 --------------------------------------------------------------------------------