---
title: "MATH 5075 R Project 11"
author: "Your Name Here"
date: "March 13, 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
1. *Generate a stationary series with 200 observations using `rnorm()`. Use the function `adf.test()` in the package **tseries** to verify that this series is stationary.*
```{r, tidy=TRUE, error=TRUE}
# Your code here
```
2. *Generate a random walk with Normally-distributed increments with 200 observations using `rnorm()`. Use `adf.test()` to verify that the series is not stationary.*
```{r, tidy=TRUE, error=TRUE}
# Your code here
```
3. *Generate yet a third series that is the sum of the series from the previous two parts. Is this a stationary sequence? Justify your answer.*
```{r, tidy=TRUE, error=TRUE}
# Your code here
```
4. *We know that the series in parts 2 and 3 above are cointegrated. Use the Engle-Granger procedure to verify this. Consider using the `egcm()` function in the **egcm** package.*
```{r, tidy=TRUE, error=TRUE}
# Your code here
```
## Problem 2
*The following code downloads stock data for Chevron and ExxonMobile through 2016 using the package **quantmod** designed for managing financial data.*
```{r, warning=FALSE, message=FALSE}
if (!require("quantmod")) {
install.packages("quantmod")
require("quantmod")
}
from_date <- as.Date("2016-1-1")
to_date <- as.Date("2016-12-31")
CVX <- getSymbols("CVX", return.class="ts", auto.assign=FALSE,
from=from_date, to=to_date)[,"CVX.Adjusted", drop=TRUE]
XOM <- getSymbols("XOM", return.class="ts", auto.assign=FALSE,
from=from_date, to=to_date)[,"XOM.Adjusted", drop=TRUE]
```
1. *Plot these two series. Do they appear stationary? Cointegrated?*
```{r, tidy=TRUE, error=TRUE}
# Your code here
```
2. *Use the augmented Dickey-Fuller test and the Engle-Granger procedure to test the conjectures made above.*
```{r, tidy=TRUE, error=TRUE}
# Your code here
```