MulaiMulai sekarang secara gratis

Fourth moment: Kurtosis

Finally, to calculate the fourth moment of a distribution, you can use the kurtosis() function from scipy.stats.

Note that this function actually returns the excess kurtosis, not the 4th moment itself. In order to calculate kurtosis, simply add 3 to the excess kurtosis returned by kurtosis().

clean_returns from the previous exercise is available in your workspace.

Latihan ini adalah bagian dari kursus

Introduction to Portfolio Risk Management in Python

Lihat Kursus

Petunjuk latihan

  • Import kurtosis from scipy.stats.
  • Use clean_returns to calculate the excess_kurtosis.
  • Derive the fourth_moment from excess_kurtosis.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Import kurtosis from scipy.stats
from ____ import ____

# Calculate the excess kurtosis of the returns distribution
excess_kurtosis = ____
print(excess_kurtosis)

# Derive the true fourth moment of the returns distribution
fourth_moment = ____
print(fourth_moment)
Edit dan Jalankan Kode