-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
3,794 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,28 @@ | ||
#using Retry | ||
using DelimitedFiles | ||
datadir = joinpath(@__DIR__, "..", "src", "data") | ||
if ~isdir(datadir) | ||
mkdir(datadir) | ||
end | ||
download("http://people.stern.nyu.edu/wgreene/Text/Edition7/TableF20-1.txt", joinpath(datadir, "bollerslev_ghysels.txt")) | ||
isdir(datadir) || mkdir(datadir) | ||
@info "Downloading Bollerslev and Ghysels data..." | ||
isfile(joinpath(datadir, "bollerslev_ghysels.txt")) || download("http://people.stern.nyu.edu/wgreene/Text/Edition7/TableF20-1.txt", joinpath(datadir, "bollerslev_ghysels.txt")) | ||
|
||
# @info "Downloading stock data..." | ||
# #"DOW" is excluded because it's listed too late | ||
# tickers = ["AAPL", "IBM", "XOM", "KO", "MSFT", "INTC", "MRK", "PG", "VZ", "WBA", "V", "JNJ", "PFE", "CSCO", "TRV", "WMT", "MMM", "UTX", "UNH", "NKE", "HD", "BA", "AXP", "MCD", "CAT", "GS", "JPM", "CVX", "DIS"] | ||
# alldata = zeros(2786, 29) | ||
# for (j, ticker) in enumerate(tickers) | ||
# @repeat 4 try | ||
# @info "...$ticker" | ||
# filename = joinpath(datadir, "$ticker.csv") | ||
# isfile(joinpath(datadir, "$ticker.csv")) || download("http://quotes.wsj.com/$ticker/historical-prices/download?num_rows=100000000&range_days=100000000&startDate=03/19/2008&endDate=04/11/2019", filename) | ||
# data = parse.(Float64, readdlm(joinpath(datadir, "$ticker.csv"), ',', String, skipstart=1)[:, 5]) | ||
# length(data) == 2786 || error("Download failed for $ticker.") | ||
# alldata[:, j] .= data | ||
# rm(filename) | ||
# catch e | ||
# @delay_retry if 1==1 end | ||
# end | ||
# end | ||
# alldata = 100 * diff(log.(alldata), dims=1) | ||
# open(joinpath(datadir, "dow29.csv"), "w") do io | ||
# writedlm(io, alldata, ',') | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Introduction | ||
|
||
ARCH models naturally generalize to the multivariate setting. Consider a time series of daily asset returns $\{r_t\}_{t\in 1, \ldots, T}$, where now $r_t\in\mathbb{R}^d$. Similarly to the univariate case, the general model structure is | ||
|
||
\[ | ||
r_t=\mu_t+\Sigma_t^{1/2}z_t,\quad \mu_t\equiv\mathbb{E}[r_t\mid\mathcal{F}_{t-1}],\quad \Sigma_t\equiv\mathbb{E}[(r_t-\mu_t)(r_t-\mu_t)^\mathrm{T}]\mid\mathcal{F}_{t-1}]. | ||
\] | ||
|
||
A multivariate ARCH model specifies the conditional covariance matrix $\Sigma_t$ in terms of past returns, conditional (co)variances, and potentially other variables. The main challenge in multivariate ARCH modelling is the _curse of dimensionality_: allowing each of the $(d)(d+1)/2$ elements of $\Sigma_t$ to depend on the past returns of all $d$ other assets requires $O(d^4)$ parameters without imposing additional structure. Multivariate ARCH models differ in which structure they impose. | ||
|
||
The following multivariate ARCH models are currently available in this package: | ||
|
||
* The CCC model of [Bollerslev (1990)](https://doi.org/10.2307/2109358) | ||
* The DCC model of [Engle (2002)](https://doi.org/10.1198/073500102288618487) | ||
|
||
These may be combined with different mean specifications as in the univariate case, and (in principle) with different specifications for the joint distribution of the $z_t$, although at present, only the multivariate standard normal is supported. Multivariate ARCH models are represented as instances of [`MultivariateARCHModel`](@ref), which like [`UnivariateARCHModel`](@ref) subtypes [`ARCHModel`](@ref). | ||
|
||
# Type hierarchy | ||
## [Covariance specifications](@id covspec) | ||
Volatility specifications describe the evolution of $\Sigma_t$. They are modelled as subtypes of [`MultivariateVolatilitySpec`](@ref). | ||
|
||
### CCC | ||
The CCC (and DCC, see below) models are examples of _conditional correlation_ models. They decompose | ||
$\Sigma_t$ as | ||
\[ | ||
\Sigma_t=D_t R_t D_t, | ||
\] | ||
where $R_t$ is the conditional correlation matrix and $D_t$ is a diagonal matrix containing the volatilities of the individual assets, which are modelled as univariate ARCH processes. In the constant conditional correlation (CCC) model, $R_t=R$ is assumed constant. The model is typically, including here, estimated in a two-step procedure: first, univariate ARCH models are fitted to the $d$ asset returns, and then $R$ is estimated as the sample correlation matrix of the standardized residuals. | ||
|
||
### DCC | ||
The DCC model extends the CCC model by making the $R_t$ dynamic (hence the name, dynamic conditional correlation model). In particular, | ||
|
||
\[ | ||
R_{ij, t} = \frac{Q_{ij,t}}{\sqrt{Q_{ii,t}Q_{jj,t}}}, \ | ||
\] | ||
where | ||
\[Q_{t} =(1-\theta _{1}-\theta _{2})\bar{Q}+\theta _{1}\epsilon | ||
_{t-1}\epsilon _{t-1}^{\prime }+\theta _{2}Q_{t-1}, | ||
\] | ||
$\epsilon _{t}=D_{t}^{-1}a_{t}$, $Q_{t}=\mathrm{cov}% | ||
(\epsilon _{t}|F_{t-1})$, and $\bar{Q}=\mathrm{cov}(\epsilon _{t})$. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.