I wrote my own EGARCH model via python. When comparing the result from arch_model, they are totally different, both values of parameters and loglikelihood. I Wonder:
- if my understanding of principle of EGARCH is right.
- if the implemention in arch_model is right.
So,
- My understanding of EGARCH(1,1,1) with normal distribution: $$ \begin{aligned} r_t & =\mu+\epsilon_t \\ \ln \left(\sigma_t^2\right) & =\omega+\alpha_1\left(\left|\frac{\epsilon_{t-1}}{\sigma_{t-1}}\right|-\sqrt{\frac{2}{\pi}}\right)+\gamma_1 \frac{\epsilon_{t-1}}{\sigma_{t-1}}+\beta_1 \ln \left(\sigma_{t-1}^2\right) \\ \epsilon_t & =\sigma_t e_t, \quad e_t \stackrel{\text { i.i.d. }}{\sim} N(0,1) \end{aligned} $$ The loglikelihood: $$ 1/2*\sum_{i=1}^{n}[\ln(2\pi)+\ln(\frac{\epsilon_t^2}{\sigma_t^2})] $$
- The first thing I want to make sure is that there are no boundaries for the parameters, right? EGARCH does not like GARCH, which should satisfy non-negative conditions for parameters.
- Are the starting values of parameters sensitive for the results? Both Theoraticaly or Emipricaly?
- Here is my implementation via python:
def egarch_likelihood(parameters, data, lnsigma2, out=None):
mu = parameters[0]
omega = parameters[1]
alpha = parameters[2]
# gamma = parameters[3]
beta = parameters[3]
T = len(data)
eps = data - mu
for t in range(1, T):
lnsigma2[t] = omega
+ alpha * (np.abs(eps[t-1]/np.sqrt(np.exp(lnsigma2[t-1])))-np.sqrt(2/np.pi))
+ gamma*eps[t-1]/np.sqrt(np.exp(lnsigma2[t-1]))
+ beta * lnsigma2[t-1]
logliks = 0.5*(np.log(2*np.pi) + eps**2/np.exp(lnsigma2))
loglik = np.sum(logliks)
return loglik
startingVals = np.array([
data.mean(),
np.log(data.var()),
0.1,
0.1,
0.9
])
lnsigma2 = np.ones(len(data)) * np.log(data.var())
args = (data, lnsigma2)
estimates = scipy.optimize.minimize(egarch_likelihood, startingVals, args=args, bounds=bounds,method="SLSQP")
I find out that in package arch_model, the author seems adding some conditions to the parameter, which disagrees with the principle of EGARCH. Here is the link of EGARCH function in arch_model: https://arch.readthedocs.io/en/latest/univariate/generated/arch.univariate.EGARCH.html#arch.univariate.EGARCH
The result is so different, which really makes me confused. Am I wrong?