1. Learn
  2. /
  3. Courses
  4. /
  5. Foundations of Inference in Python

Exercise

Effect size for correlations

The volatility of an asset is roughly defined by how much its price changes. In this exercise you'll measure volatility on a per-day basis, defined as the (high price - low price) / closing price.

What factors explain the volatility of Bitcoin? Is the volatility of the S&P500 closely related to this? Does volatility increase or decrease as prices rise? In other words, what is the effect size of the correlation between these different factors? You'll compute both of these effect size in this exercise.

A DataFrame of S&P 500 and Bitcoin prices (btc_sp_df) has been loaded for you, as have the packages pandas as pd, NumPy as np, Matplotlib as plt, and stats from SciPy.

Instructions 1/2

undefined XP
    1
    2
  • Compute the volatility of BTC.
  • Repeat for the S&P 500.
  • Compute \(R^2\) between the volatility of each asset.
  • Compute \(R^2\) between the volatility and closing price of BTC.