[R-SIG-Finance] Estimation of an GARCH model with conditional skewness and kurtosis

Johannes Lips johannes.lips at googlemail.com
Sat Feb 19 15:14:13 CET 2011


Hi,

I managed to advance a bit. So far the GARCHSK method looks like this:
llhGarchSK11N <- function(par, x)
{
mu		<- par[1];
omega 	<- par[2];
alpha 	<- par[3];
beta 	<- par[4];
gamma0	<- par[5];
gamma1	<- par[6];
delta0	<- par[7];
delta1	<- par[8];
eta		<- par[9];
numrowx <- nrow(x)
#Error
e <- x - mu
eta=e/e2t
e2 <- e^2
#Skewness
sk <- (((x - mu)^3) / length(x))/ sd(x)^3
#Kurtosis
ku <- (((x - mu)^4 / length(x))/ sd(x)^4) - 3

#Conditional Skewness
#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)])
#Conditional Variance
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))

#Likelihood function
# -sum(log(dnorm(e, mean = 0, sd = sqrt(abs(s2)))))
  #Augmented Likelihood function
  -sum( -0.5*(log(h) - 0.5*(eta)^2 + 
log(1+(sk/6)*(eta^3-3*eta)+((ku-3)/24)*(eta^4-6*eta^2+3))^2-log(1+((sk^2)/6)+(ku-3)^2/24)))
}

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)
llhGarchSK11N (parNSK,x)

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!

Johannes

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.
>
> HTH,
> Yohan
>
> On Feb 18, 2011, at 11:05 AM, Johannes Lips wrote:
>
>> Hello,
>>
>> 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:
>> http://hannes.fedorapeople.org/leon2005.pdf
>>
>> 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
>> problem.
>>
>> 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.
>> https://stat.ethz.ch/pipermail/r-help/2011-February/268871.html
>>
>> 	[[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-SIG-Finance at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- 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
> Zurich
>
> www.ethz.ch
>



More information about the R-SIG-Finance mailing list