$25
Problem 1 (50pt)
Suppose that the monthly log returns, in percentages, of a stock follow the following Markov switching model:
if st = 1 if st = 2
where the transition probability are
P(st = 2 | st−1 = 1) = 0.2, P(st = 1 | st−1 = 2) = 0.1.
Suppose that = 50, and s100 = 2 with probability 1.
(i) What is the 1-step-ahead volatility forecast at the forecast origin t = 100?
(ii) If the probability of s100 = 2 is reduced to 0.75, what is the 1-step-ahead volatility forecast origin t = 100.
Bonus In R create a report in pdf format using RMarkdown (or, if you choose to use Python instead, create a Jupyter notebook) to implement this Markov switching model and compare the forecasts you computed to simulated results.
Problem 2 (50pt)
In R create a report in pdf format using RMarkdown (or, if you choose to use Python instead, create a Jupyter notebook) to:
(i) Download daily price data for January 1, 2000 through December 31, 2020 of Amazon stock from Yahoo Finance. Compute the weekly logarithmic returns rt. You may use the quantmod package in R for this purpose.
(ii) Using lagged returns rt−1,rt−2,rt−3 as input, build a 3-2-1 feed-forward neural network to forecast 1-step-ahead returns. Use data up to December 31, 2018 as the training data set and the remainder as the testing data. Calculate the mean squared error on the test data.
1
(iii) Using lagged returns rt−1,rt−2,rt−3 and their signs (directions) to build a 6-5-1 feedforward neural network to forecast the 1-step-ahead direction of Microsoft stock price movement (with 1 denoting upward movement and 0 downward movement). Use data up to December 31, 2018 as the training data set and the remainder as the testing data. Calculate the mean squared error on the test data.
Note: Let rtn denote a time series in R. To create a direction variable for rtn, use the command drtn = ifelse(rtn > 0, 1, 0)