Bitcoin Linear Regression: Correlation Exploration

Words
1113
Reading
5 min
Listen
Play
8y

1_sDtjzNpm6FtMi4qhXOkJhw.jpegAs you may know, Bitcoin is a decentralized digital currency notorious for extreme price volatility. I set out to build a multivariable linear regression model which can be used to predict the price of Bitcoin. In this post, I will:

Introduce a predictive model for the price of Bitcoin
Explore a couple significant underlying features of the model
Provide my key insights and takeaways from this project
Model Overview
The model is a multiple linear regression model, defined as more than one explanatory variable predicting a single dependent variable. Three key features (independent variables) are utilized which are highly correlated with the price of Bitcoin (dependent variable).

The project scope required standard linear regression rather than a time series analysis; I plan to reconfigure this model into a time series analysis at a later time. The difference primarily relates to whether the train-test split is shuffled or sequential — discussed later in this post.

Regularization was evaluated but deemed not necessary given the already high correlation, resulting in a coefficient of determination (R squared) accuracy of 96.8%.

Feature Exploration
The goal here is to target features that have a high correlation to Bitcoin, but ideally reside outside the Bitcoin universe (an example of this would be cryptocurrency universe market capitalization, of which the Bitcoin market capitalization represents ~35% per coinmarketcap.com at the time of this writing). Features considered include:

Bitcoin related:

Cryptocurrency universe market capitalization
Ethereum price
Volume
Number of transactions
Average block size
Transaction fees
Unique addresses
Hash rate
Market related:

Price of Gold
Nasdaq Composite Index
Other:

Google search interest
Social media sentiment analysis (via Twitter)
Most of these features were also transformed onto a natural log scale as they relate exponentially / multiplicatively, so this transformation allows a more linear, “apples to apples” relationship on this basis.

From this set of features, I was able to narrow down to the following for use in the model:
0_85yuZCJLj8HChGnc.png
log of Google search interest
log of Nasdaq Composite Index
log of Bitcoin network transaction fees
With only three features, the model achieves high correlation and accuracy with an R squared of ~97%. Taking a look at the diagnostic below, it appears that all major statistical tests largely check out with the exception of Condition Number which signals multicollinearity, or significant correlation amongst the independent variables. This isn’t necessarily a major issue, and can be addressed by removing features (although 3 is already a small number of features). The real issue would be if there were perfect multicollinearity amongst any two independent variables. Fortunately, each of the three variables represents metrics relatively distant from each other. By this I mean it would be highly unlikely for google search metrics to perfectly track Nasdaq, nor for Nasdaq to perfectly track Bitcoin network transaction fees.
0_GTv_Q6ijlUPnSmSx.png
In the chart above we see the linear relationships of the three independent variables against the log Bitcoin price dependent variable. However, this chart also serves as prime evidence of multicollinearity as discussed above. The chart also features semitransparent data points to depict relative frequency.

I will now dive into some of the key features of the model to see what insights we may uncover.

The most interesting relationship in this analysis would arguable be the high correlation between the price of Bitcoin and its search popularity on google.

As you can see, the two metrics closely track each other. The google search metric may even potentially be a promising leading indicator. This merits continued observation.

Below we also see the single feature regression of the log of google search interest against the log of the Bitcoin price — again depicting a strong linear relationship.
0_GZsRV0OQIx-FccA5.png
Another interesting feature of the prediction model is the Nasdaq Composite Index. The correlation is high for both metrics. However, I would caveat this relationship by saying that Bitcoin has been in existence for nine years. Those entire nine years, the Nasdaq has been on a “bull run”. Only time will tell how any bearish trends affecting the Nasdaq will affect the price of Bitcoin.
0_yjS6T5he6Ar9XI9k.png
And once again we note a strong linear relationship between the log of the Nasdaq and the log of Bitcoin.

And now we look at the three feature model as a whole, noting strong correlation between the log linear relationship of the model and the log of the price of Bitcoin. The predicted vs. actual results utilize a train-test split of 70% / 30%. This means that the model was trained on 70% of the data, and then the remaining 30% was fed into the model to generate a prediction and compare this to the actual result for each data point.
0_rtgwwiex-pn1LUQI.png
As mentioned above, the train-test split is the key difference between this linear regression model and a time series predictive model. In this model, the data is “shuffled”, or randomized, before being fed into the train-test split. As such, there is no resulting time relation. This limits the predictive ability of the model to any point in time, as long as the three independent features are fed in at that point in time. In a time series analysis, the model would actually make a price prediction over a certain period of time — to come!

Adjusting for the log, we now see the predictive price results of our model. The below chart maps the model’s prediction for the price of Bitcoin against actual results from our test sample.
0_UxMrttDGsL7UsNX7.png
To interpret this, you would essentially feed the metrics of the three features into the model, and it will then provide a prediction of the price of Bitcoin. I would note that most of the data points remain in the sub $5,000 range, while the actual vs prediction seems to get a bit noisier at the higher values. Again, you can see relative frequency via the semitransparent data points.

Further Thoughts
Regularization was considered but not ultimately incorporated into the model. This is because the model only has three features with a very high accuracy as gauged by an R squared score of ~97%. While Ridge, Lasso and ElasticNet regularization methods were evaluated within the model, it was not deemed to improve the performance of the model.

Key Insights / Takeaways
In this analysis, the price of Bitcoin has been found to be a function of:

Google search interest
Nasdaq Composite Index
Bitcoin network transaction fees
Google search interest closely tracks the price of Bitcoin and may even be a prime candidate as a leading indicator of the digital currency.

Nasdaq is also historically correlated with the price of Bitcoin; however, we will want to keep watching this relationship after Nasdaq experiences bearish trends / downside pressure upon the stock market index.

Bitcoin Linear Regression: Correlation Exploration | Ecency