[R-SIG-Finance] Estimation of an GARCH model with conditional skewness and kurtosis
johannes.lips at googlemail.com
Sat Feb 19 15:14:13 CET 2011
I managed to advance a bit. So far the GARCHSK method looks like this:
llhGarchSK11N <- function(par, x)
mu <- par;
omega <- par;
alpha <- par;
beta <- par;
gamma0 <- par;
gamma1 <- par;
delta0 <- par;
delta1 <- par;
eta <- par;
numrowx <- nrow(x)
e <- x - mu
e2 <- e^2
sk <- (((x - mu)^3) / length(x))/ sd(x)^3
ku <- (((x - mu)^4 / length(x))/ sd(x)^4) - 3
#st = γ0 + γ1 ηt−1 + γ2 st−1
skt <- gamma0 + gamma1*c(mean(sk),sk[-length(x)])
# Conditional Kurtosis
#kt = δ0 + δ1 ηt−1 + δkt−1
kut=delta0 + delta1*c(mean(ku),ku[-length(x)])
e2t <- omega + alpha*c(mean(e2),e2[-length(x)])
s2 <- filter(e2t, beta, "recursive", init = mean(e2))
sk <-filter(skt, gamma, "recursive", init = mean(skt))
ku <- filter(kut, delta, "recursive", init = mean(kut))
# -sum(log(dnorm(e, mean = 0, sd = sqrt(abs(s2)))))
#Augmented Likelihood function
-sum( -0.5*(log(h) - 0.5*(eta)^2 +
If I execute the function with the following command:
mu <- mean(x) ;omega <- 0.1*var(x); alpha <- 0.1; beta <- 0.1; gamma0
<- 0; gamma1 <-0; delta0 <- 0; delta1 <- 0; eta<- 0
parNSK <- c(mu,omega, alpha, beta, gamma0, gamma1, delta0, delta1, eta)
I only get the following error:
cannot coerce type 'builtin' to vector of type 'double'
In addition: Warning message:
In is.na(filter) :
is.na() applied to non-(list or vector) of type 'builtin'
I don't really know if the method is working somehow and would be
grateful to any hints.
Thanks in advance!
On 02/18/2011 11:57 AM, Yohan Chalabi wrote:
> Hi Johannes,
> You can start with the code I sent you on R-help https://stat.ethz.ch/pipermail/r-help/2011-February/268953.html and
> * add the definition of skewness and kurtosis in the likelihood function
> * modify the conditional variance as defined in the paper
> * replace the normal probability function by the one defined in the paper.
> You might get more help if you show us what you have tried.
> On Feb 18, 2011, at 11:05 AM, Johannes Lips wrote:
>> I'm quite new to R but tried to learn as much as possible in the last
>> few months.
>> My problem is that I would like to estimate the model of Leon et al. (2005).
>> I have shortly summarised the most important equations in the following
>> pdf file:
>> My main question is now how could I introduce these two additional terms
>> into the Likelihood function of a(n) (existing) GARCH method.
>> I looked into some GARCH packages but wasn't really sure where to start.
>> I know that this is not really an easy task but I would be very grateful
>> if you could help me out by giving me some hints on how to solve this
>> Thanks in advance!
>> Johannes Lips
>> P.S. I sent this e-mail also to the R-help mailing list but was told I
>> should better send it to the finance-sig.
>> [[alternative HTML version deleted]]
>> R-SIG-Finance at r-project.org mailing list
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions should go.
> PhD candidate
> Swiss Federal Institute of Technology
More information about the R-SIG-Finance