<jupyter_start><jupyter_text>Deviation from normality<jupyter_code>%reload_ext autoreload
%autoreload 2

import pandas as pd
import risk_kit as rk
hfi = rk.get_hfi_returns()
pd.concat([hfi.mean(), hfi.median(), hfi.mean() > hfi.median()], axis = "columns")
rk.skewness(hfi).sort_values()
import scipy.stats as ss
sorted(ss.skew(hfi))
import numpy as np
normal_rets = np.random.normal(0, .15, size=(263000, 1))
rk.skewness(normal_rets)
rk.kurtosis(normal_rets)
rk.kurtosis(hfi)
ss.jarque_bera(normal_rets)
rk.is_normal(normal_rets, level=0.01)
rk.is_normal(hfi)
hfi.aggregate(rk.is_normal)<jupyter_output><empty_output><jupyter_text>*Quiz 2* 1. Use the EDHEC Hedge Fund Indices data set that we used in the lab assignment as well as in the previous week’s assignments. Load them into Python and perform the following analysis based on data since 2000 (including all of 2000): What was the Monthly Parametric Gaussian VaR at the 1% level (as a +ve number) of the Distressed Securities strategy? Enter the positive number as a percent .e.g. For 5.32% enter 5.32<jupyter_code>dist_sec_ret = hfi['Distressed Securities']['2000':]
#dist_sec_ret
round(rk.var_gaussian(dist_sec_ret, level=1)*100, 2)<jupyter_output><empty_output><jupyter_text>2. Use the same data set at the previous question. What was the 1% VaR for the same strategy after applying the Cornish-Fisher Adjustment? Enter the answer as a positive number, in percent terms. e.g. for 5.32% enter 5.32<jupyter_code>round(rk.var_gaussian(dist_sec_ret, level=1, modified=True)*100, 2)<jupyter_output><empty_output><jupyter_text>3. Use the same dataset as the previous question. What was the Monthly Historic VaR at the 1% level (as a +ve number) of the Distressed Securities strategy? Enter the answer as a positive number, in percent terms. e.g. for 5.32% enter 5.32<jupyter_code>round(rk.var_hist(dist_sec_ret, level=1)*100, 2)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10355648535564854, 'fraction_numerical': 0.034518828451882845, 'mean_word_length': 6.246212121212121, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '31098', 'license': 'MIT', 'n_tokens_mistral': 733, 'n_tokens_neox': 660, 'n_words': 211, 'path': 'normality_q2.ipynb', 'repo_name': 'allaccountstaken/risk_toolkit', 'size': '1912'}