-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathprocess.py
More file actions
34 lines (21 loc) · 745 Bytes
/
process.py
File metadata and controls
34 lines (21 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pandas as pd
import numpy as np
import pot
df = pd.read_csv("data/msci.csv")
df.index = pd.to_datetime(df["Date"], format='%m/%d/%Y')
df = df.drop(['Date'], axis=1)
for col in df.columns.values:
df[col] = np.log(df[col]) - np.log(df[col].shift(1))
df = df.dropna()
data = -df["Italy"]
#US UK Switzerland Sweden Spain Singapore Norway Netherlands Japan Italy
fitted_gpd = pot.gpd_pot(data, tu=0.95, fit="mle")
print(fitted_gpd.Beta, fitted_gpd.Xi)
fitted_gpd = pot.gpd_pot(data, tu=0.95, fit="mom")
print(fitted_gpd.Beta, fitted_gpd.Xi)
fitted_gpd = pot.gpd_pot(data, tu=0.95, fit="pwm")
print(fitted_gpd.Beta, fitted_gpd.Xi)
print(fitted_gpd.quantile(q=0.99))
pot.mean_exc(data)
fitted_gpd.qq_plot()
fitted_gpd.pp_plot()