Page 1 of 1

GJR(1,1)-m for WTI spot price

Posted: Wed Jan 04, 2012 2:58 am
by filonat
Hi, this is my first post on this forum!And I'm also new on Rats, so please be patient..!
I'm trying to estimate the real-world historical density of WTI crude oil spot price, 20days-ahead with respect of the last day of the sample.
I'm using a sample of 130 daily log returns (rend), and I'm following the Stephen Taylor's book ("Asset price dynamicsvolatility and Prediction") methodology. Using a GARCH(1,1), it works, this is the code (I bootstrap 100.000 residuals to compute the same number of price simulation for the target date):


Code: Select all

********GARCH(1,1)*****************
****************************************
calendar(d) 2008:12:2
all 2009:6:2
open data d:\dati\Ricerca\Petrolio\dati_rats5.xls
data(org=obs, format=excel)
table /


garch(p=1,q=1, resids=u, method=bhhh, hseries=h) / rend
compute b0=%beta(1), chat=%beta(2), ahat=%beta(3), bhat=%beta(4)
frml hf = chat+bhat*h{1}+ahat*u{1}**2
SET ustandard 2008:12:2 2009:6:2 = u/SQRT(H)

com span=10
com ndraws=100000

set h 2009:6:2+1 2009:6:2+span =h (2009:6:2)
dec vect returns(ndraws)


do draws=1, ndraws
boot entries 2009:6:2+1 2009:6:2+span 2008:12:2 2009:6:2
set udraw 2009:6:2+1 2009:6:2+span = ustandard(entries)
set u 2009:6:2+1 2009:6:2+span = (h(t)=hf(t)), udraw(t)*sqrt(h(t))
sstats 2009:6:2+1 2009:6:2+span b0+u>>returns(draws)
end do draws

***WTI spot on june 2nd, 2009, is 70.25 $/bbl,***
***so I use that price to calculate spot prices 20days ahead*****

dec vect prices(ndraws)
dec vect priceok(ndraws)
com prices = 70.25*%exp(returns)
do i=1,ndraws
com priceok(i) = %if(prices(i)<0.1, %NA, prices(i))
end do i

set pr 1 ndraws = priceok(t)

SOURCE(NOECHO) DENSITY.SRC
@DENSITY pr 1 1000 XDENS YDENS
SCATTER(STYLE=LINES,VMIN=0.0) 1
# XDENS YDENS
***********************************************************
So far so good. But GARCH(1,1) doesn't fit well the data. On the contrary, GJR(1,1)-m fit the data very well.
My model doesn't work, i.e. my estimated returns are wrong. I think I included the copnditional mean term in the wrong way.
Could you please help me?this is the code:

Code: Select all

************ GJR(1,1)-M*************************
*****************************************************
***oil price real world density function estimation****


calendar(d) 2008:12:2
all 2009:6:2
open data d:\dati\Ricerca\Petrolio\dati_rats5.xls
data(org=obs, format=excel)
table /

*garch(p=1,q=1, resids=e, asymmetric, method=bhhh,regressors, hseries=h) / rend
*# constant %garchv %mvgavge{1}


***calculation of GJR(1,1)-M model ***

garch(p=1,q=1, resids=e, asymmetric, method=bhhh, regressors, hseries=h) / rend
# constant %garchv


***Rename parameters and add formulas of conditional variance****

*compute gstart=%regstart(), gend=%regend()
com mu=%BETA(1), lambda=%BETA(2), omega=%BETA(3), $
alfa=%BETA(4), alfamin=%BETA(5), beta=%BETA(6)
*frml mf = mu + lambda* sqrt(h)
frml hf = %if(e{1}>0, omega + alfa*e{1}**2 + beta*h{1}, omega + alfa*e{1}**2 + alfamin*e{1}**2 + beta*h{1})

**standardized residuals****

set z 2008:12:2 2009:6:2 = e/sqrt(h)

com span=20
com ndraws=1000


set h 2009:6:2+1 2009:6:2+span =h(2009:6:2)
*set mf2 2009:6:2+1 2009:6:2+span =mf2(2009:6:2)
dec vect returns(ndraws)

*******draws from standard normal, calculate residual "e", compute returns *****

do draws=1, ndraws
boot entries 2009:6:2+1 2009:6:2+span 2008:12:2 2009:6:2
set zsimul 2009:6:2+1 2009:6:2+span = z(entries)
set e 2009:6:2+1 2009:6:2+span = (h(t)=hf(t)), zsimul(t)*sqrt(h(t))
sstats 2009:6:2+1 2009:6:2+span mu+lambda*sqrt(h)+e>>returns(draws)
end do draws
dis returns
************************

the xls dataset is attached. thank you very much!!

Re: GJR(1,1)-m for WTI spot price

Posted: Fri Jan 06, 2012 7:46 am
by TomDoan
I don't think either one fits particularly well. You have a rather short data set for daily data (130 observations) and there are no obvious signs of any ARCH effects. The original series passes a test for absence of ARCH (@ARCHTEST procedure) so the GARCH parameter estimates are near zero. Adding asymmetry and "M" effects to a model where GARCH isn't really present isn't a good idea. If you look at your GARCH-M, you'll see that they didn't converge. (Don't use BHHH as your main estimation method; BFGS is better at handling most models).

Re: GJR(1,1)-m for WTI spot price

Posted: Mon Jan 09, 2012 10:33 am
by filonat
Yes your're right, I did the arch test with a larger sample but then I used a smaller one and I didn't repeat it for that.
For a sample of daily returns starting from June 2,2009, to June 24, 2011, the arch test rejects the no arch effect null hypotesis, and using for example a GJR(1,1)-M, the BFGS algorithms converge.
I've also modified the loop, and now it seems to work also with conditional mean.

Code: Select all

************ GJR(1,1)-M*************************
*****************************************************
***oil price real world density function estimation****
calendar(d) 2009:6:2
all 2011:6:24
open data d:\dati\Ricerca\Petrolio\Risk_appetite\dati_rats7.xls
data(org=obs, format=excel)
table /

*garch(p=1,q=1, resids=e, asymmetric, method=bfgs,regressors, hseries=h) / rend
*# constant %garchv %mvgavge{1}


***calculation of GJR(1,1)-M model ***

garch(p=1,q=1, resids=e, asymmetric, method=bfgs, regressors, hseries=h) / rend
# constant %garchv
set mut = rend - e

***Rename parameters and add formulas of conditional variance****

compute gstart=%regstart(), gend=%regend()
com mu=%BETA(1), lambda=%BETA(2), omega=%BETA(3), $
alfa=%BETA(4), alfamin=%BETA(5), beta=%BETA(6)
*frml mf = mu + lambda* sqrt(h)
frml hf = %if(e{1}>0, omega + alfa*e{1}**2 + beta*h{1}, omega + alfa*e{1}**2 + alfamin*e{1}**2 + beta*h{1})

**standardized residuals****

set z gstart gend = e/sqrt(h)

com span=20
com ndraws=10000


set h gend+1 gend+1 = h(gend)
set mut gend+1 gend+1 = mut(gend)
dec vect sumret(ndraws)

*******draws from standard normal, calculate residual "e", compute returns *****

do draws = 1, ndraws
	do spans = 1, span
		set z gend+spans gend+spans = %ran(1.0)
		set e gend+spans gend+spans = (h=hf), z(gend+spans)*sqrt(h(gend+spans))
		set rend gend+spans gend+spans = mu + lambda*sqrt(h(gend+spans))+ e
		statistics(noprint) rend gstart gend+spans
		set mut gend+spans+1 gend+spans+1 = %mean
		set h gend+spans+1 gend+spans+1 = sqrt(%variance)
	end do spans
	accumulate rend gend+1 gend+span rendsum
	sstats gend+span gend+span rendsum>>sumret(draws)
 end do draws

dis sumret

dec vect prices(ndraws)
dec vect priceok(ndraws)
com prices = 91.16*%exp(sumret)

do i=1,ndraws
	com priceok(i) = %if(prices(i)<0.1, %NA, prices(i))
end do i

set pr 1 ndraws = priceok(t)

SOURCE(NOECHO) DENSITY.SRC
@DENSITY pr 1 ndraws XDENS YDENS
SCATTER(STYLE=LINES,VMIN=0.0) 1
# XDENS YDENS
Do you think it's ok?
I'm now comparing this one with a risk-neutral option-implied density (with the June 24, 2011 close-of-business option prices), built in the same way the book of Stephen Taylor shows (last chapter)...with respect to that one (that I estimated using visual basic), the GARCH curve is more concentrated around the mean with thinner tails and higher peak than the risk-neutral one... I'll figure out why. thanks!

Re: GJR(1,1)-m for WTI spot price

Posted: Mon Jan 09, 2012 10:34 am
by filonat
sorry, here is the new dataset :)