Possible error in garchSpec (package fGarch)

Alban.Moura at midgard.univ-tlse1.fr Alban.Moura at midgard.univ-tlse1.fr
Sun Feb 6 17:29:44 CET 2011


Good evening,

I'm currently working on the function garchSpec from package fGarch (version 2110.80) and I don't understand the last part of the code, which deals with the presample option. To set the things, I reproduce this part of the code at the bottom of the mail.

I have two questions:

1/ The help states that "the number of rows must be at least max(m,n,p,q)+1, longer presamples are cutted", but there is no part of the code to perform this cutting. Was something forgotten?

2/ For long presamples, the last part of the code iterates the computation of the conditional variance, but then the result is not stored back in presample, and will certainly not be returned by the function. Something must me missing here.

I thank you for your attention and I wait for your answer,

Respectfully yours,

Alban Moura

% CODE FOR PRESAMPLE (FUNCTION garchSpec)
    iterate = TRUE
    if (!is.matrix(presample)) {
        if (is.null(presample)) {
            iterate = FALSE
            n.start = order.max
        }
        else {
            n.start = presample
        }
        z = rnorm(n = n.start)
        h = rep(model$omega/(1 - sum(model$alpha) - sum(model$beta)), 
            times = n.start)
        y = rep(model$mu/(1 - sum(model$ar)), times = n.start)
    }
    else {
        z = presample[, 1]
        h = presample[, 2]
        y = presample[, 3]
    }
    presample = cbind(z, h, y)
    if (iterate) {
        n.iterate = length(z) - order.max
        deltainv = 1/model$delta
        for (i in n.iterate:1) {
            h[i] = model$omega + sum(model$alpha * (abs(abs(y[i + 
                (1:order.alpha)]) - model$gamma * y[i + (1:order.alpha)])^model$delta)) + 
                sum(model$beta * h[i + (1:order.beta)])
            y[i] = model$mu + sum(model$ar * y[i + (1:order.ar)]) + 
                sum(model$ma * (h[i + (1:order.ma)]^deltainv)) + 
                h[i]^deltainv * z[i]
        }
    }


More information about the Rmetrics-core mailing list