Recently, cryptocurrencies such as Bitcoins have been one of the most heated topics around the world. Cryptocurrencies are being used in multiple areas including decentralized finance [1], application development [2], art collections [3], etc. The market value of Bitcoin also increased dramatically in the past 3 years, as can be seen by the charts of Bitcoin return below.
This project will perform a time series analysis to investigate into the price as well as other indicators of Bitcoin so that we can have more insight and deeper understanding. Our question of interest is “Can we use time series analysis to gain insight into the nature of Bitcoin, or more specifically, the Bitcoin prices?”
Our data set is from blockchain.com [4], and we mainly use 2 fields of Bitcoin from past 3 years.
Market Price: The price of each Bitcoin calculated in USD.
Trade Volume: The number of Bitcoin traded at major exchanges every day.
In the graph above, we apply Loess smoothing upon the market price of Bitcoin, and it shows a increasing trend. The Loess smoothing curve at a point is computed by finding the linear regression of the data within a certain local neighborhood of the point, and evaluating the resulting line at the desired point. By applying this method to every point, we get the loess smoothing of the whole data. To find a loess smoothing of the data, we have to choose the size of the neighborhood, i.e. the span [5]. For our analysis, we chose a span of 1, since the resulting graph seemed to capture the long term trends of Bitcoin.
From the plot of price, we can also identify two high peaks in past months. On the other hand, it looks like the trend is becoming more and more flat recently.
To check whether there is seasonal effect, we plot the frequency domain of original data and smoothed data. From the periodgram of the Bitcoin market price, we can’t identify any obvious peak in it. There is rumor that the Bitcoin has a cycle of 4 years [6], but our time series data doesn’t cover such a long range (it only covers 3 years).
Now, we will calculate the return of Bitcoin’s price movement every day. It’s calculated by \(r_t=\frac{p_t}{p_{t-1}} - 1\).
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -0.391404 -0.015128 0.002197 0.003030 0.020755 0.191024
The mean of the return is very close to 0, but given that we have over a thousand data points, let’s calculate the 95% confidence interval of the mean return:
## [1] "[ 0.00066 , 0.0054 ]"
We can therefore conclude that the mean return is non-zero. In addition, the plot of the returns seems to be stationary, so we’re going to conclude that a strictly stationary model [7] is appropriate for the return data.
In this case, the ACF function of the returns refers to the sample autocorrelation of the return data evaluated at many lags in time [8]. The return has a significantly large autocorrelation value when the lag is equal to 1 and 4, implying that there may some information that can be captured by fitting an ARMA model.
From the periodogram of the Bitcoin returns, there is no clear peak shown in the periodogram, so an ARMA model (without seasonality) seems appropriate for this data.
The ARMA(p,q) model is in the form of
\[\begin{eqnarray}Y_n = \mu + \phi_1(Y_{n-1} - \mu) +...+ \phi_p(Y_{n-p} - \mu) + \epsilon_n + \psi_1\epsilon_{n-1} +...+ \psi_q\epsilon_{n-q}\end{eqnarray}\]
where \[\begin{eqnarray} \mu &=& {\mathbb{E}}[X_n] \\ {\phi}(x)&=&1-{\phi}_1 x-\dots -{\phi}_px^p, \\ {\psi}(x)&=&1+{\psi}_1 x+\dots +{\psi}_qx^q, \\ \epsilon_n&\sim&\mathrm{ iid }\, N[0,\sigma^2]. \end{eqnarray}\]
The parameters for this model are \(\theta=({\phi}_{1:p},{\psi}_{1:q},\mu,\sigma^2)\) [9]
MA0 | MA1 | MA2 | MA3 | MA4 | |
---|---|---|---|---|---|
AR0 | -3938.80 | -3946.62 | -3945.83 | -3944.00 | -3947.68 |
AR1 | -3947.25 | -3947.55 | -3946.11 | -3944.20 | -3945.72 |
AR2 | -3946.15 | -3946.06 | -3944.11 | -3943.23 | -3943.74 |
AR3 | -3944.54 | -3944.26 | -3943.36 | -3944.23 | -3942.91 |
AR4 | -3947.12 | -3945.47 | -3943.48 | -3942.87 | -3940.91 |
[10]
AIC, or Akaike’s information criterion, is a measure of a model fitting a certain dataset. The AIC value will be lower if the likelihood of the model for the data is higher, but the value will be higher if the model is more complex. By using the model with minimal AIC value, we ideally choose a model that has both a relatively high likelihood and low complexity [11]. The table of AIC values show that ARMA(1,1), AR(1,0) and MA(4) are good choices with low AIC value, but we choose to work with ARMA(1,1) due to relatively lower AIC and model simplicity.
All the characteristic roots of the model are in the unit circle, implying that our model is causal and invertible [12].
By plotting the ACF and Q-Q plot of the residual, we can see that our ARMA(1,1) effectively capture the time-series information of the return, but our assumption of normally distributed errors is violated. The Q-Q plot shows that the residual has a much heavier tail than normal distribution
It turns out that the a T-distribution with degree of freedom 4 can fit the tail of residuals well, but we may need some other tools to combine T-distribution with ARMA model.
##
## Call:
## arima(x = df$Return, order = c(1, 0, 1))
##
## Coefficients:
## ar1 ma1 intercept
## -0.6384 0.5553 0.0030
## s.e. 0.2068 0.2237 0.0011
##
## sigma^2 estimated as 0.001575: log likelihood = 1977.78, aic = -3947.55
[13]
Coefficient | \(\theta_{mle}\) | MLE CI | Profile Likelihood CI |
---|---|---|---|
AR1 | \(-0.6384\) | \([-1.1937, -0.0831]\) | \([-0.8776,0]\) |
MA1 | \(0.5553\) | \([0.3316, 0.779]\) | \([0, 0.8367]\) |
The profile likelihood give us a narrower confidence interval than MLE for AR1, while the confidence for MA1 is wider. It essentially depends on the shape of likelihood function near to the MLE estimates [14].
[15]
The result from bootstrap is similar to the profile likelihood estimation result.
To generate a more intuitive understanding of the ARMA model, we’re going to use the estimated return from the ARMA model to simulate the price of Bitcoin.
It looks like the simulation from return from ARMA model is very different from the true price movement of Bitcoin. It generally follows the trend shown in the red line, but the high volatility behavior of the Bitcoin rarely occurs. We believe it’s due to our model can’t catch the heavy tail of the residuals.
Another interesting aspect to examine is whether there is sufficient evidence of a relationship between returns and other values, like trade volume. First, let’s plot the trade volume over time.
It does not seem like a stationary model would fit this data well because the mean seems to be at a higher level around the time that the Bitcoin price rose to a higher price. As a next step, let’s examine some sample cross correlation functions [16] between returns and trade volume.
Interestingly, there seems to be a significant relationship between trade volume and the return 15 and 16 days earlier. In addition, all of the autocorrelation values for lags between 2 and 30 are positive, which seems strange, but we should run statistical tests to see if there is anything significant to be found.
This motivates us to fit some AIC models to the returns, where we additionally include the trade volume as an “independent” variable.
MA0 | MA1 | MA2 | MA3 | MA4 | |
---|---|---|---|---|---|
AR0 | -3937.17 | -3944.84 | -3944.08 | -3942.24 | -3945.86 |
AR1 | -3945.47 | -3945.78 | -3944.31 | -3942.39 | -3943.90 |
AR2 | -3944.41 | -3944.29 | -3942.30 | -3941.34 | -3941.93 |
AR3 | -3942.78 | -3942.45 | -3941.54 | -3942.43 | -3941.08 |
AR4 | -3945.30 | -3943.64 | -3942.06 | -3941.07 | -3938.99 |
[10]
The models with the lowest AIC values in this table are ARMA(1,1) and ARMA(0,4). Although the ARMA(1,1) model has a slightly larger AIC value than ARMA(1,1), it is also a much simpler model, so we will examine the ARMA(1,1) model (i.e. regression with ARMA(1,1) errors).
However, the ARMA(1,1) & Trade Volume AIC value, -3945.78, is actually greater than the AIC value of the ARMA model without considering trade volume -3947.55, so there is no significant evidence that considering the Trade Volume in this way improves the model.
In conclusion for this section, it is better to leave the trading volume out of the model for Bitcoin returns.
The square of return can show how volatile the market in some way, because when there is huge change in the price, more people may make reaction, so the price may move up and down in a dramatic way.
We also plot the sample ACF function of the square of return, showing how dramatic the market is. The plot shows that there is a significant ACF when the lag is 1 and 7. There is also high ACF when the lag is 4 or 11. Hence, it looks like that there’s a clustering affect for the return square.
There is no high peak in the smoothed periodogram of the return sqaure, therefore there is no obvious cycle in it.
MA0 | MA1 | MA2 | MA3 | MA4 | |
---|---|---|---|---|---|
AR0 | -8227.14 | -8240.17 | -8239.85 | -8238.09 | -8240.64 |
AR1 | -8241.15 | -8239.93 | -8237.80 | -8237.10 | -8242.44 |
AR2 | -8239.82 | -8237.85 | -8235.93 | -8239.04 | -8241.02 |
AR3 | -8237.85 | -8236.65 | -8239.03 | -8243.41 | -8243.28 |
AR4 | -8240.73 | -8241.66 | -8240.26 | -8243.34 | -8240.75 |
[10]
We choose AR(1) model because it has a low AIC among all simple models. The ARMA model doesn’t fit well for the return square, because when the ACF is out of the confidence interval when the lag is 4, 7, 11 and 18. What’s more, the residuals are not fitting the normal distribution well, since it also has a much heavier tail.
In this report, we have analyzed Bitcoin price and return of Bitcoin’s daily price movement. We first fitted ARMA(1,1) model to examine the time series of the return. We have also discovered that the residual has a heavy tail. The simulation we have ran using our result from the ARMA(1,1) model did not successfully capture the actual price movement of Bitcoin. We believe this is again due the heavy residual tail influencing the model. Because T distribution with degree of freedom 4 seem to compesate such problem, we believe further investigation is needed to improve the model in combining that with ARMA(1,1).
Alertantively, we could find variables to add into the model to improve such problem. So, we looked into the relationship between returns and trade volume to further explore what influences Bitcoin. However, AIC value of ARMA model including trade volume is greater than that of the ARMA model without trade volume, so we did not include the trade volume into the model.
Another approach taken was examining the squared return instead. However, the ARMA did not fit well and again the heavier tail of residual problem was still remaining. Bitcoin price is influenced by various factors including its supply and demand, competing cryptocurrencies, etc. Therefore, there are various possible studies that could be added from our current models and modfications.
[1] S. Hirsh and S. W. Alman, “Blockchain,” Amazon, 2020. [Online]. Available: https://aws.amazon.com/blockchain/what-is-defi/.
[2] “Solidity,” Solidity. [Online]. Available: https://docs.soliditylang.org/en/v0.8.12/.
[3] “Non-fungible tokens (NFT),” ethereum.org. [Online]. Available: https://ethereum.org/en/nft/.
[4] “Blockchain.com charts summary,” Blockchain.com. [Online]. Available: https://www.blockchain.com/charts.
[5] Used explanation of loess smoothing from section 3 of chapter 8.
Ionides, Edward L. “Smoothing in the time and frequency domains”
[6] “The bitcoin and crypto market cycles: What you need to know,” CryptoPotato, 22-Sep-2021. [Online]. Available: https://cryptopotato.com/what-are-crypto-market-cycles/.
[7] Added this reference for the meaning of stationarity from section 1 of chapter 3.
Ionides, Edward L. “Stationarity, white noise, and some basic time series models”
[8] Used explanation of ACF function from section 3 of chapter 2.
Ionides, Edward L. “Estimating trend and autocovariance”
[9] Used ARMA equations from section 2.1 of chapter 4
Ionides, Edward L. “Linear time series models and the algebra of ARMA models”
[10] Code is modified from section 3 of chapter 5.
Ionides, Edward L. “Parameter estimation and model identification for ARMA models”
[11] Explanation of AIC is based on section 2.2 of chapter 5.
Ionides, Edward L. “Parameter estimation and model identification for ARMA models”
[12] Used causality and invertibility of ARMA models from section 2.2 of chapter 4.
Ionides, Edward L. “Linear time series models and the algebra of ARMA models”
[13] Based profile likelihood code off of section 3.1 of chapter 5
Ionides, Edward L. “Parameter estimation and model identification for ARMA models”
[14] Used maximum likelihood estimator and fisher information from section 1 of chapter 5.
Ionides, Edward L. “Parameter estimation and model identification for ARMA models”
[15] Based bootstrap algorithm off of code on section 3.1, page 12 of chapter 5
Ionides, Edward L. “Parameter estimation and model identification for ARMA models”
[16] Used cross correlation from section 6.1 of chapter 9
Ionides, Edward L. “Case study: An association between unemployment and mortality?”