Displaying 1 result from an estimated 1 matches for "garchln".
Did you mean:
garching
2005 Dec 29
0
calculating recursive sequences
...calculate a_t and \sigma_t and estimate the
variables using maximum likelihood method. a_t can be estimated
directly using first equation and rt. \sigma_t^2 depends on
sigma_{t-1}^2, so it should be calculated recursively.
The function calculating negative log-likelihood of this problem I wrote:
garchln <- function(p,rt) {
n <- length(rt)
at <- rt[4:n]-p[1]-p[2]*rt[4:n-2]
u <- as.numeric(at>0)
h <- rep(0,length(at))
# h is \sigma_t^2
for(i in 1:(length(h)-1)) {
h[i+1] <- p[3]*at[i]^2+p[4]*h[i]+u[i]*(p[5]+p[6]*at[i]^2+p[7]*h[i])
}
#Maximum...