---
title: "Lab 8"
author: "Name here"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(warning = FALSE)
library(readr)
library(ggplot2)
library(dplyr)
library(lubridate)
library(ggfortify)
library(forecast)
```
Please use D2L to turn in both the PDF/ Word output and your R Markdown file.

For this exercise, we will continue working with the bakery dataset. 

#### Q1. ARMA Simulation (50 pts)
Simulate data from AR(1), MA(1), and ARMA(1,1) models and create acf and pacf plots. Note that `ggtsdisplay`, `ggAcf,` and `ggPacf` in the `forecast` package can be used.

Comment on the differences in the figures.



#### Q2. Taxi (50 pts)

The code below creates a series of the weekly differences in taxi trips in NYC for yellow taxis. Examine the series and discuss what you see. Then fit and explain an ARMA model.

```{r}
taxi.rides <- read_csv('http://math.montana.edu/ahoegh/teaching/timeseries/data/taxi.csv')

taxirides.diff <- taxi.rides %>% arrange(year, month, day) %>% slice(-c(1:4)) %>% mutate(week.numb = rep(1:234, each = 7)) %>% group_by(week.numb) %>% summarize(total.rides = sum(n)) %>% select(total.rides) %>% pull() %>% diff()

```

