[R-SIG-Finance] garchFit and garchSim

Andrey Riabushenko cdome at bk.ru
Fri May 16 15:35:17 CEST 2008


Hi !

I am trying to fit garch(1,1) model to stock returns using fGarch.

m = garchFit(~garch(1,1), data = returns)


But next I need to do 100 simulations of future returns. I am trying to use 
garchSim for that
I have extracted estimated alpha, beta and omega 
	params = model at fit$matcoef[,1]
	mu = params[1]
	omega = params[2]
	alpha = params[3]
	beta = params[4]

and i trying to do future simulation of returns 
	sim = mu + garchSim(list(alpha = alpha, beta = beta, omega = omega), 
resample=???)
	
I see that there is a resample parameter in garchSim function, but can't 
figure out how to use it, docs do not help.

Please help me, I am writing my MA theses and only one week is left till 
submission and my supervisor can't help with that.


P.S.
Also I have done similar thing, but using arima model. Please, check it if I 
am  doing everything right, because I  not sure about it.

forecast_arima = function (returns, n.ahead) {
    model = armaFit(~arma(10, 5), data=returns)
    c = coef(model)
    arma_mean = c["intercept"]
    arma_ar = c[1:10]
    arma_ma = c[11:15]

    m = matrix(NA, n.ahead, MAX_SIM)
						
    for(i in 1:MAX_SIM) {
	m[,i] = arma_mean + armaSim(list(ar = arma_ar, ma = arma_ma, d=0), n = 
n.ahead, start.innov = as.vector(returns))
    }
    return(m)
}


Thank you for you expertise.



More information about the R-SIG-Finance mailing list