Analysis of the Bitcoin Exchange Using Particle MCMC Methods
Total Page:16
File Type:pdf, Size:1020Kb
Analysis of the Bitcoin Exchange Using Particle MCMC Methods by Michael Johnson M.Sc., University of British Columbia, 2013 B.Sc., University of Winnipeg, 2011 Project Submitted in Partial Fulfillment of the Requirements for the Degree of Master of Science in the Department of Statistics and Actuarial Science Faculty of Science c Michael Johnson 2017 SIMON FRASER UNIVERSITY Spring 2017 All rights reserved. However, in accordance with the Copyright Act of Canada, this work may be reproduced without authorization under the conditions for “Fair Dealing.” Therefore, limited reproduction of this work for the purposes of private study, research, education, satire, parody, criticism, review and news reporting is likely to be in accordance with the law, particularly if cited appropriately. Approval Name: Michael Johnson Degree: Master of Science (Statistics) Title: Analysis of the Bitcoin Exchange Using Particle MCMC Methods Examining Committee: Chair: Dr. Jiguo Cao Associate Professor Dr. Liangliang Wang Senior Supervisor Assistant Professor Dr. Dave Campbell Supervisor Associate Professor Dr. Tim Swartz Internal Examiner Professor Date Defended: March 24, 2017 ii Abstract Stochastic volatility models (SVM) are commonly used to model time series data. They have many applications in finance and are useful tools to describe the evolution of asset returns. The motivation for this project is to determine if stochastic volatility models can be used to model Bitcoin exchange rates in a way that can contribute to an effective trading strategy. We consider a basic SVM and several extensions that include fat tails, leverage, and covariate effects. The Bayesian approach with the particle Markov chain Monte Carlo (PMCMC) method is employed to estimate the model parameters. We assess the goodness of the estimated model using the deviance information criterion (DIC). Simulation studies are conducted to assess the performance of particle MCMC and to compare with the traditional MCMC approach. We then apply the proposed method to the Bitcoin exchange rate data and compare the effectiveness of each type of SVM. Keywords: Stochastic volatility model; hidden Markov model; sequential Monte Carlo; particle Markov chain Monte Carlo; Bitcoin. iii Table of Contents Approval ii Abstract iii Table of Contents iv List of Tables vi List of Figures vii 1 Introduction 1 1.1 Stochastic Volatility Models and Particle Markov Chain Monte Carlo . 1 1.2 Bitcoin and Bitcoin Exchanges . 3 1.3 Research Objective . 5 1.4 Thesis Organization . 6 2 Stochastic Volatility Models 7 2.1 Hidden Markov Models . 7 2.2 Basic Stochastic Volatility Model . 8 2.2.1 Basic SVM Version 1 . 8 2.2.2 Basic SVM Version 2 . 9 2.3 Stochastic Volatility Model with Fat Tails . 9 2.4 Stochastic Volatility Model with Leverage Effect . 10 2.5 Stochastic Volatility Model with Covariate Effects . 11 2.6 Chapter Summary . 11 3 Bayesian Inference for Stochastic Volatility Models 13 3.1 Bayesian Inference . 13 3.2 Monte Carlo Integration . 14 3.3 Posterior Inference via Markov Chain Monte Carlo . 15 3.3.1 Markov Chain Monte Carlo (MCMC) . 15 3.3.2 Gibbs Sampling . 16 3.4 Posterior Inference via Sequential Monte Carlo (SMC) . 18 iv 3.4.1 Importance Sampling (IS) . 18 3.4.2 Sequential Importance Sampling (SIS) . 19 3.4.3 Sequential Monte Carlo (SMC) . 21 3.5 Particle Markov Chain Monte Carlo (PMCMC) . 22 3.6 Model Comparison . 24 3.7 Chapter Summary . 25 4 Simulation Studies 27 4.1 Gibbs Sampler and PMCMC for Basic SVM Version 1 . 27 4.1.1 PMCMC . 27 4.1.2 Gibbs Sampler . 30 4.1.3 Comparison of PMCMC and Gibbs Sampler . 31 4.2 PMCMC for Basic SVM Version 2 . 32 4.3 PMCMC for SVM with Fat Tails . 34 4.4 PMCMC for SVM with Leverage Effect . 37 4.5 PMCMC for SVM with Covariate Effects . 39 4.6 Chapter Summary . 43 5 Applications to Bitcoin Exchange Rate Data 44 5.1 Data . 44 5.2 Bitcoin Data Analysis with Basic SVM . 46 5.3 Bitcoin Data Analysis for SVM with Fat Tail . 48 5.4 Bitcoin Data Analysis for SVM with Leverage Effect . 49 5.5 Bitcoin Data Analysis for SVM with Covariate Effect . 51 5.6 Summary of Bitcoin Data Analysis . 54 6 Conclusion and Future work 55 Bibliography 57 v List of Tables Table 3.1 Gibbs Sampler Algorithm. 17 Table 3.2 Sequential Importance Sampling Algorithm. 21 Table 3.3 Sequential Monte Carlo Algorithm. 22 Table 3.4 Particle MCMC Algorithm. 24 Table 4.1 Summary of Basic SVM Version 1 parameter posterior distributions resulting from PMCMC and Gibbs Sampler for simulated data. 31 Table 4.2 Summary of Basic SVM Version 2 parameter posterior distributions resulting from PMCMC for simulated data. 34 Table 4.3 Summary of SVM Fat Tails parameter posterior distributions resulting from PMCMC for simulated data. 36 Table 4.4 Summary of SVM with Leverage Effect parameter posterior distribu- tions resulting from PMCMC for simulated data. 39 Table 4.5 Summary of SVM with Covariate Effect parameter posterior distribu- tions resulting from PMCMC for simulated data. 42 Table 5.1 Summary of Basic SVM Version 2 parameter posterior distributions resulting from PMCMC for Bitcoin data. 48 Table 5.2 Summary of SVM with Fat Tails parameter posterior distributions re- sulting from PMCMC for Bitcoin data. 49 Table 5.3 Summary of SVM with Leverage Effect parameter posterior distribu- tions resulting from PMCMC for Bitcoin data. 51 Table 5.4 Summary of SVM with Covariate Effect parameter posterior distribu- tions resulting from PMCMC for Bitcoin data. 53 Table 5.5 A summary of the DIC for each stochastic volatility model that was fit to the Bitcoin exchange rate data set. 54 vi List of Figures Figure 2.1 Illustration of a Hidden Markov Model. 7 2 Figure 4.1 Basic SVM Version 1 trace plots of α, µx, µy and σ resulting from PMCMC for simulated data. 28 2 Figure 4.2 Basic SVM Version 1 histograms of α, µx, µy and σ resulting from PMCMC for simulated data. 29 Figure 4.3 Basic SVM Version 1 simulated data and PMCMC estimates, with observations Y1:n and hidden process X1:n for simulated data. 29 2 Figure 4.4 Basic SVM Version 1 trace plots of α, µx, µy and σ resulting from Gibbs Sampler for simulated data. 30 2 Figure 4.5 Basic SVM Version 1 histograms of α, µx, µy and σ resulting from Gibbs Sampler for simulated data. 31 2 Figure 4.6 Basic SVM Version 2 trace plots of α, µx, µy and σ resulting from PMCMC for simulated data. 33 2 Figure 4.7 Basic SVM Version 2 histograms of α, µx, µy and σ resulting from PMCMC for simulated data. 33 Figure 4.8 Basic SVM Version 2 simulated data and PMCMC estimates, with observations Y1:n and hidden process X1:n for simulated data. 34 2 Figure 4.9 SVM Fat Tails trace plots of α, µx, df and σ resulting from PMCMC for simulated data. 35 2 Figure 4.10 SVM Fat Tails histograms of α, µx, df and σ resulting from PM- CMC for simulated data. 36 Figure 4.11 SVM Fat Tails simulated data and PMCMC estimates, with obser- vations Y1:n and hidden process X1:n for simulated data. 37 2 Figure 4.12 SVM with Leverage Effect trace plots of α, µx, ρ and σ resulting from PMCMC for simulated data. 38 2 Figure 4.13 SVM with Leverage Effect histograms of α, µx, ρ and σ resulting from PMCMC for simulated data. 38 Figure 4.14 SVM with Leverage Effect simulated data and PMCMC estimates, with observations Y1:n and hidden process X1:n for simulated data. 39 2 Figure 4.15 SVM with Covariate Effect trace plots of α, µx, η1, η2 and σ result- ing from PMCMC for simulated data. 41 vii 2 Figure 4.16 SVM with Covariate Effect histograms of α, µx, η1, η2 and σ re- sulting from PMCMC for simulated data. 42 Figure 4.17 SVM with Covariate Effect simulated data and PMCMC estimates, with observations Y1:n and hidden process X1:n for simulated data. 43 Figure 5.1 Daily Bitcoin exchange rate. 44 Figure 5.2 Relative change in daily Bitcoin exchange rate. 45 Figure 5.3 Number of Bitcoin Transactions per Day. 45 Figure 5.4 Number of Unique Bitcoin Addresses Used per Day. 46 2 Figure 5.5 Basic SVM Version 2 trace plots of α, µx, µy and σ resulting from PMCMC for Bitcoin data. 47 2 Figure 5.6 Basic SVM Version 2 histograms of α, µx, µy and σ resulting from PMCMC for Bitcoin data. 47 2 Figure 5.7 SVM with Fat Tails trace plots of α, µx, df and σ resulting from PMCMC for Bitcoin data. 48 2 Figure 5.8 SVM with Fat Tails histograms of α, µx, df and σ resulting from PMCMC for Bitcoin data. 49 2 Figure 5.9 SVM with Leverage Effect trace plots of α, µx, ρ and σ resulting from PMCMC for Bitcoin data. 50 2 Figure 5.10 SVM with Leverage Effect histograms of α, µx, ρ and σ resulting from PMCMC for Bitcoin data. 50 2 Figure 5.11 SVM with Covariate Effect trace plots of α, µx, η1, η2 and σ result- ing from PMCMC for Bitcoin data. 52 2 Figure 5.12 SVM with Covariate Effect histograms of α, µx, η1, η2 and σ re- sulting from PMCMC for Bitcoin data. 53 viii Chapter 1 Introduction 1.1 Stochastic Volatility Models and Particle Markov Chain Monte Carlo Stochastic volatility models (SVM) are widely used in the field of economics and finance.