I want to estimate the parameters and standard errors of the following ARMA/GARCH model:

The code I use is:

Here, my data is R_bel. I get parameter estimates, but I do not get the hessian. I thought that with the hessian I could calculate the standard errors. But I get errors such as: RuntimeWarning: overflow encountered in double_scalars. And as output, I get a matrix with nan. How can I solve this problem?

Thank in advance!

[moderator; latex fixed]

##y_t=a+b y_{t−6}+cy_{t−8}+dϵ_{t−1}+ϵ_t##

##σ^2_t=ω+αϵ^2_{t−1}+βσ^2_{t−1}##

The code I use is:

Code:

```
def main():
x0 = (0.01,0.01,0.01,0.01,0.01, 0.01, 0.01)
b = minimize(garch_loglike, x0, R_bel, bounds = ((None,None),(None,None),(None,None),(None,None),(0.0001, None), (0.0001, None), (0.0001, None)), options={'disp':True})
print(b.x)
value = garch_loglike(b.x, R_bel)
print("Log likelihood value:", -value)
a = nd.Hessian(garch_loglike)
print(a(b.x, R_bel))
def garch_filter(omega, alpha, beta1, eps, R):
iT = len(R)-8
sigma_2 = np.zeros(iT)
for i in range(iT):
if i==0:
sigma_2[i] = omega + alpha*eps[i-1]**2 + beta1*np.var(eps)
else:
sigma_2[i] = omega + alpha*eps[i-1]**2 + beta1*sigma_2[i-1]
return sigma_2
def eps1(a, b, c, d, R):
eps = np.zeros(len(R)-8)
for t in range(len(R)-8):
if t ==0:
eps[t] = R[1]-R[0]
else:
eps[t] = R[t+8]-a - b*R[t+2] - c*R[t] -d*eps[t-1]
return eps
def garch_loglike(vP, R):
iT = len(R)
a = vP[0]
b=vP[1]
c=vP[2]
d=vP[3]
omega = vP[4]
alpha = vP[5]
beta1 = vP[6]
eps = eps1(a,b,c,d,R)
sigma_2 = garch_filter(omega, alpha, beta1, eps, R)
logL = -(-len(eps)/2 * np.log(2*math.pi) -0.5 *np.sum(np.log(sigma_2) + eps**2/sigma_2))
return logL
```

Thank in advance!

[moderator; latex fixed]

Last edited by a moderator: