Quick advice: if you are really interested in understanding the work done and the results obtained read the official project report contained in the BTC_analysis.pdf
file in this repo.
This project addresses the study and construction of econometric models in Bayesian frame-
work that can capture the volatility of bitcoin.
Various Bayesian models will then be improved by adjustment of the MCMC-based sampling process and reformulation of prior
beliefs.
The main goal is to build a useful tool in decision analysis/risk management and in general
try to infer the main critical factors when investing on assets of this type.
The Yahoo Finance Bitcoin Historical Data from Kaggle, spanning from 2014 to 2023, capture the evolution of Bitcoin’s price over a decade. We are only interested in the adjusted closing price of bitcoin (in terms of BTC/USD value), from which we also derive the “LogREturns” feature.
\
We report below the decomposition results for prices and returns considering that we have one observation per day (for 9 years).
The following ACF plot suggests that the scale of returns changes in time and the (conditional) variance of the process is time varying.
In order to capture volatility clustering, we need to introduce appropriate time series processes able to model this behavior!
Our model will have to adhere to a number of features to enable consistent results to be obtained:
- It need not be robust to modeling any trends, patterns or forms of seasonality
- Instead, it must provide for strong heteroscedasticity.
- It can be based on the assumption of stationarity of the data.
We use three JAGS (MCMC based) models typically used in econometrics for volatility forecasting:
- ARCH(1)
- GARCH(1, 1)
- t-student GARCH(1, 1)
Then we compare the results of our models and select the one with minimum DIC.
The winner is the Bayesian GARCH(1,1) model with a non-central t-student prior distribution for returns:
where:
$\delta = \mu \cdot \sigma^{- \frac{1}{2}}_t$ is the non-centrality parameter$\nu = 8$ represents the degrees of freedom and we set it equal to a constant
This variables and parameters have a specific meaning in our model:
$y_t$ is the observed value at time t$z_t$ is the white noise (innovation) term at time t$\sigma_t^2$ is the conditional variance of$y_t$ $\omega$ is the baseline volatility$\alpha$ represents the impact of past squared residuals on the conditional variance
Here the JAGS code:
tstud_model_code <- "
model
{
# Likelihood
for (t in 1:N) {
y[t] ~ dt(mu, tau[t], 8)
tau[t] <- 1/pow(sigma[t], 2)
}
sigma[1] ~ dunif(0,10)
for(t in 2:N) {
sigma[t] <- sqrt(omega + alpha * pow(y[t-1] - mu, 2) +
beta * pow(sigma[t-1], 2))
}
# Priors
mu ~ dnorm(0.0, 0.01)
omega ~ dunif(0, 10)
alpha ~ dunif(0, 1)
beta ~ dunif(0, 1)
}
"
Our model is based on Markov Chain Monte Carlo sampling technique (Gibbs sampling) and we have to check for the convergence of its parameters to the target distributions.