शुरू करेंमुफ़्त में शुरू करें

Normal distribution के लिए VaR

Value at Risk (VaR) मेट्रिक से परिचित होने के लिए इसे किसी ज्ञात distribution पर लागू करना उपयोगी रहता है. Normal (या Gaussian) distribution खास तौर पर अच्छा है क्योंकि 1) इसका विश्लेषणात्मक रूप सरल है, और 2) यह अनेक empirical घटनाओं का प्रतिनिधित्व करता है. इस अभ्यास में आप मानेंगे कि किसी पोर्टफोलियो का loss normally distributed है, अर्थात् distribution से निकली वैल्यू जितनी बड़ी, loss उतना अधिक.

आप सीखेंगे कि standard Normal distribution के लिए scipy.stats.norm के ppf() (percent point function) और numpy के quantile() फंक्शन का उपयोग करके क्रमशः 95% और 99% confidence levels पर VaR कैसे निकाला जाए. आप Normal distribution के प्लॉट पर एक threshold के रूप में VaR का visualization भी करेंगे.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में Quantitative Risk Management

पाठ्यक्रम देखें

अभ्यास निर्देश

  • 95% confidence level पर VaR निकालने के लिए norm का .ppf() percent point function उपयोग करें.
  • अब Numpy के quantile() फंक्शन का उपयोग करते हुए 100,000 रैंडम Normal draws पर 99% VaR निकालें.
  • print स्टेटमेंट के जरिए 95% और 99% VaR की तुलना करें.
  • Normal distribution का प्लॉट बनाएँ, और 95% VaR दर्शाने के लिए एक लाइन जोड़ें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# Create the VaR measure at the 95% confidence level using norm.ppf()
VaR_95 = norm.ppf(____)

# Create the VaR measure at the 99% confidence level using numpy.quantile()
draws = norm.rvs(size = 100000)
VaR_99 = np.quantile(____, 0.99)

# Compare the 95% and 99% VaR
print("95% VaR: ", ____, "; 99% VaR: ", ____)

# Plot the normal distribution histogram and 95% VaR measure
plt.hist(draws, bins = 100)
plt.axvline(x = ____, c='r', label = "VaR at 95% Confidence Level")
plt.legend(); plt.show()
कोड संपादित करें और चलाएँ