An NGARCH(1,1) Likelihood Setup for Intraday Returns
Summary
The document presents an R implementation of a normal-innovation NGARCH(1,1) model intended for five-minute stock returns. The conditional variance updates from a constant, a lagged variance term, and a squared lagged standardized shock shifted by an asymmetry parameter. The function estimates parameters by minimizing a Gaussian quasi negative log-likelihood with Nelder–Mead, initializes variance from a short sample, and then returns residuals and a volatility series. It also derives standard errors from the inverse Hessian.
The author asks whether realized volatility should be added and how the implementation could be improved, but the document contains no answer or empirical results. It does not show that this specification is suitable for high-frequency data. Its normal innovation assumption, initialization choice, unconstrained optimizer call, and Hessian-based inference all warrant scrutiny; parameter bounds are present only in a commented alternative. The model should be checked for valid variance dynamics and estimated with diagnostics appropriate to the sampling frequency.
Key ideas
- The code specifies an asymmetric NGARCH(1,1) conditional variance recursion for return data.
- It estimates the parameters by minimizing a Gaussian likelihood objective.
- The implementation initializes variance using the sample variance and reports residuals and conditional volatility.
- The normal innovation assumption and parameter constraints may need review for the data and model use.
- The question about combining NGARCH with realized volatility is left unanswered.
Tags
Full text
# how to model NGARCH using 5min frequency data?
# how to model NGARCH using 5min frequency data?
NGARCH model using 5-min High-frequency data in R
I wanted to analyze some 5 minute frequency data of stock market. My teacher asked me to use NGARCH to model, but I didn't know how to program.Here is the NGARCH code that I found in a book, usually the GARCH model has a significant effect only on low-frequency data.
```
"Ngarch" <- function(rtn){
# Estimation of a non-symmertic GARCH, NGARCH(1,1), model.
# Assume normal innovations
# rtn: return series
glkn <- function(par){
glkn=0
ht=var(rtn)
T=length(rtn)
if(T > 40)ht=var(rtn[1:40])
at=rtn[1]-par[1]
for (i in 2:T){
ept=rtn[i]-par[1]
at=c(at,ept)
sig2t=par[2]+par[3]*ht[i-1]+par[4]*ht[i-1]*(at[i-1]/sqrt(ht[i-1])-par[5])^2
ht=c(ht,sig2t)
glkn=glkn + 0.5*(log(sig2t) + ept^2/sig2t)
}
glkn
}
# obtain initial estimates
mu=mean(rtn)
par=c(mu,0.01,0.8,0.01,0.7)
mm=optim(par,glkn,method="Nelder-Mead",hessian=TRUE)
low=c(-10,0,0,0,0)
upp=c(10,1,1,0.4,2)
#mm=optim(par,glkn,method="L-BFGS-B",hessian=T,lower=low,upper=upp)
par=mm$par
H=mm$hessian
Hi = solve(H)
se=sqrt(diag(Hi))
tra=par/se
# compute the volatility series and residuals
ht=var(rtn)
T=length(rtn)
if(T > 40)ht=var(rtn[1:40])
at=rtn-par[1]
for (i in 2:T){
sig2t=par[2]+par[3]*ht[i-1]+par[4]*(at[i-1]-par[5]*sqrt(ht[i-1]))^2
ht=c(ht,sig2t)
}
sigma.t=sqrt(ht)
## Print the results
names(par) <- c(
"mu", "beta0", "beta1", "beta2", "theta"
)
cat(" ","\n")
cat("Estimation results of NGARCH(1,1) model:","\n")
print(rbind("Estimate"=par, "SE"=se, "t-ratio"=tra))
list(residuals=at,volatility=sigma.t)
}
```
Does the NGARCH model need to be combined with realized volatility? How can I improve the above code?Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.