Dear Sir:

I tried to use the codes provided by Yohan Chalabi and Diethelm Würtz in
their presentation "GARCH Modeling with R/Rmetrics
A Case Study presented at the Meielisalp Workshop on Computational Finance
and Financial Engineering" ( or see
www.*rmetrics*.org/Meielisalp2007/Presentations/Chalabi.pdf<http://www.rmetrics.org/Meielisalp2007/Presentations/Chalabi.pdf>
).
I used the data from the package fPortfolio like the following.
But the results seem not right as the estimated parameters such as alpha and
beta didn't change at all. Can someone or the authors help me out? Another
question is how to compute the standard errors and t values "numerically" by
the R code? Any hint or help is highly appreciated.

Best regards,

ShyhWeir

library("fPortfolio")
SBI.RET<-SWX.RET$SBI

garchInit=function(series) {
    Mean=mean(series); Var=var(series); S=1e-6
    params=c(mu=Mean, omega=0.1*Var, alpha=0.1, beta=0.8)
    lowerBounds=c(mu=-10*abs(Mean), omega=S^2, alpha=S, beta=S)
    upperBounds=c(mu=10*abs(Mean), omega=100*Var, alpha=1-S, beta=1-S)
    cbind(params=params, lowerBounds=lowerBounds, upperBounds=upperBounds)
}

init<-garchInit(SBI.RET)

garchDist=function(z,hh) {dnorm(x=z/hh)/hh}

garchLLH=function(parm, series){
    mu=parm[1]; omega=parm[2]; alpha=parm[3]; beta=parm[4]
    z=(series-mu)
    Mean=mean(z^2)
    #Use Filter Representation;
    e=omega+alpha*c(Mean, z[-length(series)]^2)
    h=filter(e, beta, "r", init=Mean)
    hh=sqrt(abs(h))
    llh=-sum(log(garchDist(z, hh)))
    llh
}

garchllFit=function(series, params, lowerBounds, upperBounds) {
     fit=nlminb(start=params, objective=garchLLH,
               lower=lowerBounds, upper=upperBounds,
                control=list(trace=3), series=series)
     fit
}

garchllFit(SBI.RET, init[,1], init[,2],init[,3])

	[[alternative HTML version deleted]]

