## Theory

The skew-t EGARCH model follows the same principle as Beta-t-EGARCH models, but uses the skew-t distribution of Fernandez and Steel (1998) to take into account skewness in the time series. See Harvey (2011) for the full exposition. In particular, the Fernandez and Steel (1998) method takes a continuous probability density function $f\left(z\right)$ that is unimodal and symmetric and constructs a skewed probability density as follows:

$f\left(\epsilon_{t}\mid\gamma\right) = \frac{2}{\gamma + \gamma^{-1}}\left[{f}\left(\frac{\epsilon_{t}}{\gamma}\right)I_{\left[0,\infty\right]}\left(\epsilon_{t}\right) + f\left(\epsilon_{t}\gamma\right)I_{\left(-\infty,{0}\right)}\left(\epsilon_{t}\right)\right]$

The $\gamma$ latent variable represents the degree of skewness; for $\gamma=1$, there is no skewness, for $\gamma>1$ there is positive skewness, and below 1 there is negative skewness.

## PyFlux

First let us load some financial time series data from Yahoo Finance:

import numpy as np
import pyflux as pf
import pandas as pd
from datetime import datetime
import matplotlib.pyplot as plt
%matplotlib inline

jpm = DataReader('JPM',  'yahoo', datetime(2006,1,1), datetime(2016,3,10))
returns.index = jpm.index.values[1:jpm.index.values.shape[0]]
returns.columns = ['JPM Returns']

plt.figure(figsize=(15,5));
plt.plot(returns.index,returns);
plt.ylabel('Returns');
plt.title('JPM Returns');


Let’s fit an skew-t EGARCH model to the series using a point mass estimate $z^{MLE}$.

skewt_model = pf.SEGARCH(p=1,q=1,data=returns,target='JPM Returns')
x = skewt_model.fit()
x.summary()

SEGARCH(1,1)
======================================================= =================================================
Dependent Variable: JPM Returns                         Method: MLE
Start Date: 2006-01-05 00:00:00                         Log Likelihood: 6664.2692
End Date: 2016-03-10 00:00:00                           AIC: -13316.5384
Number of observations: 2562                            BIC: -13281.4472
=========================================================================================================
Latent Variable                          Estimate   Std Error  z        P>|z|    95% C.I.
======================================== ========== ========== ======== ======== ========================
Vol Constant                             -0.0586    0.0249     -2.3589  0.0183   (-0.1073 | -0.0099)
p(1)                                     0.9932
q(1)                                     0.104
Skewness                                 0.9858
v                                        6.0465
Returns Constant                         0.0015     0.0057     0.271    0.7864   (-0.0096 | 0.0127)
=========================================================================================================


We can plot the skewness latent variable $\gamma$ with plot_z:

skewt_model.plot_z([3],figsize=(15,5))


So the series is slightly negatively skewed – which is consistent with the direction of skewness for most financial time series. We can plot the fit with plot_fit:

skewt_model.plot_fit(figsize=(15,5))


We can plot predictions with plot_predict:

skewt_model.plot_predict(h=10,figsize=(15,5))


We can also extend the model with leverage (as with the Beta-t-EGARCH model).

skewt_model = pf.SEGARCH(p=1,q=1,data=returns,target='JPM Returns')
x = skewt_model.fit()
x.summary()

SEGARCH(1,1)
======================================================= =================================================
Dependent Variable: JPM Returns                         Method: MLE
Start Date: 2006-01-05 00:00:00                         Log Likelihood: 6684.9381
End Date: 2016-03-10 00:00:00                           AIC: -13355.8762
Number of observations: 2562                            BIC: -13314.9364
=========================================================================================================
Latent Variable                          Estimate   Std Error  z        P>|z|    95% C.I.
======================================== ========== ========== ======== ======== ========================
Vol Constant                             -0.1203    0.0152     -7.898   0.0      (-0.1501 | -0.0904)
p(1)                                     0.9857
q(1)                                     0.1097
Leverage Term                            0.0713     0.0095     7.5284   0.0      (0.0527 | 0.0899)
Skewness                                 0.9984
v                                        5.9741
Returns Constant                         0.0004     0.0001     6.9425   0.0      (0.0003 | 0.0006)
=========================================================================================================


And plot the fit with plot_fit:

skewt_model.plot_fit(figsize=(15,5))


And make predictions with plot_predict:

skewt_model.plot_predict(h=30,figsize=(15,5))