Please use D2L to turn in both the PDF/ Word output and your R Markdown file.

Q1. Random Walk Sims (50 points)

For this question we will simulate a set of random walks to determine various properties

a.

Simulate 1000 random walks (this can be done with the code in lecture 17 or using arima.sim) of length 100. Using the Dickey-Fuller test, how many of random walks reject the null hypothesis of a non-stationary series? What is your expectation for this proportion?

b.

Simulate 1000 pairs of random walks (that is two independent series of random variables) with length 100. Using the Phillips-Ouliaris test, how many of pairs of random walks reject the null hypothesis of a non-cointegrated series? What is your expectation for this proportion?

c. 536 Only

Simulate 1000 pairs of random walks (that is two independent series of random variables) with length 100. Fit a simple linear model with one series regressed against the other. What proportion of these regression models have a significant slope parameter (p-value < .05)? What is your expectation for this proportion?

Q2. Avocados (50 points)

a.

Check whether the organic and conventional avocadoes are cointegrated. Interpret the results from the hypothesis test that you choose to use.

avo <- read_csv('http://www.math.montana.edu/ahoegh/teaching/timeseries/data/avocado_west.csv')
## Parsed with column specification:
## cols(
##   Date = col_date(format = ""),
##   AveragePrice = col_double(),
##   TotalVolume = col_double(),
##   type = col_character()
## )
ggplot(data = avo, aes(y = AveragePrice, x = Date)) + geom_line(aes(color = type))

avo.conv <- avo %>% filter(type == 'conventional') %>% arrange(Date)

avo.org <- avo %>% filter(type == 'organic') %>% arrange(Date)

b.

If the two series are not cointegrated, performing a regression analysis will potentially lead to spurious results and is not advised. Regardless of the results above, fit and intepret a vector autoregressive process for the two series (conventional and organic avocado prices).