---
title: "MATH 5075 R Project 12"
author: "Your Name Here"
date: "March 15, 2017"
output:
pdf_document:
keep_tex: TRUE
---
*Remember: I expect to see commentary either in the text, in the code with comments created using `#`, or (preferably) both! **Failing to do so may result in lost points!***
*Since this assignment involves simulation, I set the seed to the following in order to get the same results:*
```{r}
set.seed(3132017)
```
## Problem 1
*The following code uses the **quantmod** package to get data for Apple (ticker symbol AAPL) stock:*
```{r, tidy=TRUE, error=TRUE, warning=FALSE, message=FALSE}
library(quantmod)
AAPL <- getSymbols("AAPL", from = as.Date("2016-01-01"), to = as.Date("2016-12-31"), env = NULL, return.class = "ts")[,"AAPL.Adjusted"]
```
1. *After fitting a $\text{GARCH}(1,1)$ process to the first log differences of the data, estimate the one-day 5% value at risk for the next trading day; that is, find the quantity such that the probability of the next trading day's return is below this quantity (which would be a loss) is 5%.*
```{r, tidy=TRUE, error=TRUE}
# Your code here
```
## Problem 2
1. *Simulate three data sets of size 100, one following a standard Normal distribution, and two folowing $t$ distributions with two and four degrees of freedom, respectively. Perform the Shapiro-Wilks Normality test and the Jarque-Bera test to determine whether each of these data sets are Normally distributed.*
```{r, tidy=TRUE, error=TRUE}
# Your code here
```
2. *Generate 100 observations of an $\text{AR(1)}$ with autoregressive parameter $\rho = 0.5$, with the error term following a standard Normal distribution. Repeat both tests.*
```{r, tidy=TRUE, error=TRUE}
# Your code here
```