Error while estimating bv GARCH

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

yussel
Posts: 6
Joined: Wed Feb 10, 2010 3:40 pm

Error while estimating bv GARCH

Postby yussel » Thu Nov 18, 2010 5:24 am

Dear Eviews forum operators,

While estimating an bivariate GARCH in Eviews 6 I run into the following error:

"Insufficient number of observations"

This occurs when the program is in line "equation eq1.arch....". I think the problem is in the starting values the program defines, but I don´t completely understand how I can fix this. What does the "m=100" and "c=1 e-5" mean? I already tried to shift around with the sample size, but this did not fix it. My data are two series containing residuals of a VEC model I estimated earlier on two series containing daily closing prices for 2006 and 2008 of a stock.

Could you please help me out? Do I simply have too few obserrvations?

Thanks and kind regards!

The Eviews bivariate GARCH program I already adjusted a little (so please ignor my adjustments) looks like:

Code: Select all

' BV_GARCH.PRG (3/30/2004) ' Revised for 6.0 (3/7/2007) ' example program for EViews LogL object ' ' restricted version of ' bi-variate BEKK of Engle and Kroner (1995): ' ' y = mu + res -> y = mu + H*lambda + res ' res ~ N(0,H) (YK: So H is the variance-covariance that will be modelled, Brooks page 509 first few lines of text) ' (YK But H is used twice! In the residual and with lambda, what is lambda?) ' H = omega*omega' + beta H(-1) beta' + alpha res(-1) res(-1)' alpha' (YK: Brooks page 509, BEKK model) ' ' where ' ' y = 2 x 1 (YK: the variables/series) ' mu = 2 x 1 (YK: Wat is this?) ' -> lambda = 2 x 1 ' H = 2 x 2 (symmetric) ' H(1,1) = variance of y1 (saved as var_y1) ' H(1,2) = cov of y1 and y2 (saved as var_y2) ' H(2,2) = variance of y2 (saved as cov_y1y2) ' omega = 2 x 2 low triangular ' beta = 2 x 2 diagonal (YK: Brooks page 509, "A") ' alpha = 2 x 2 diagonal (YK: Brooks page 509, "B") ' 'change path to program path '%path = @runpath 'cd %path ' load workfile 'load intl_fin.wf1 'select right page pageselect Closing_bids 'YK: delete all NAs from series by making them 0 series resid_nyse_ret_2=@recode(resid_nyse_ret=NA,0,resid_nyse_ret) series resid_nonnyse_ret_2=@recode(resid_nonnyse_ret=NA,0,resid_nonnyse_ret) 'YK: make all resids positive (not necessary) 'series resid_nyse_ret_3=@abs(resid_nyse_ret_2) 'series resid_nonnyse_ret_3=@abs(resid_nonnyse_ret_2) ' dependent variables of both series must be continues smpl @all series y1 = resid_nyse_ret_2 'YK: removed dlog as data are already on squared return series y2 = resid_nonnyse_ret_2 'YK: removed dlog as data are already on squared return ' set sample ' first observation of s1 need to be one or two periods after ' the first observation of s0 sample s0 3/22/2006 11/17/2008 sample s1 3/24/2006 11/17/2008 ' initialization of parameters and starting values ' change below only to change the specification of model smpl s0 'get starting values from univariate GARCH 'equation eq1.arch(m=100,c=1e-5) y1 c 'equation eq2.arch(m=100,c=1e-5) y2 c equation eq1.arch(archm=var,m=100,c=1e-5) y1 c '(YK: Set the number of observations???) equation eq2.arch(archm=var,m=100,c=1e-5) y2 c 'save the conditional variances eq1.makegarch garch1 eq2.makegarch garch2 ' declare coef vectors to use in bi-variate GARCH model ' see above for details 'coef(2) mu ' mu(1) = eq1.c(1) ' mu(2)= eq2.c(1) 'coef(3) omega ' omega(1)=(eq1.c(2))^.5 ' omega(2)=0 ' omega(3)=eq2.c(2)^.5 'coef(2) alpha ' alpha(1) = (eq1.c(3))^.5 ' alpha(2) = (eq2.c(3))^.5 'coef(2) beta ' beta(1)= (eq1.c(4))^.5 ' beta(2)= (eq2.c(4))^.5 'new values ' declare coef vectors to use in GARCH model coef(2) lambda lambda(1) = eq1.c(1) lambda(2) = eq2.c(1) coef(2) mu mu(1) = eq1.c(2) mu(2)= eq2.c(2) coef(3) omega omega(1)=(eq1.c(3))^.5 omega(2)=0 omega(3)=eq2.c(3)^.5 coef(2) alpha alpha(1) = (eq1.c(4))^.5 alpha(2) = (eq2.c(4))^.5 coef(2) beta beta(1)= (eq1.c(5))^.5 beta(2)= (eq2.c(5))^.5 ' constant adjustment for log likelihood !mlog2pi = 2*log(2*@acos(-1)) 'old values ' use var-cov of sample in "s1" as starting value of variance-covariance matrix 'series cov_y1y2 = @cov(y1-mu(1), y2-mu(2)) 'series var_y1 = @var(y1) 'series var_y2 = @var(y2) 'series sqres1 = (y1-mu(1))^2 'series sqres2 = (y2-mu(2))^2 'series res1res2 = (y1-mu(1))*(y2-mu(2)) series cov_y1y2 = @cov(y1-mu(1)-lambda(1)*garch1, y2-mu(2)-lambda(2)*garch2) series var_y1 = @var(y1-lambda(1)*garch1) series var_y2 = @var(y2-lambda(2)*garch2) series sqres1 = (y1-mu(1)-lambda(1)*garch1)^2 series sqres2 = (y2-mu(2)-lambda(2)*garch2)^2 series res1res2 = (y1-mu(1)-lambda(1)*garch1)*(y2-mu(2)-lambda(2)*garch2) ' ........................................................... ' LOG LIKELIHOOD ' set up the likelihood ' 1) open a new blank likelihood object (L.O.) name bvgarch ' 2) specify the log likelihood model by append (YK: "Append" means "to add") ' ........................................................... logl bvgarch 'old values 'bvgarch.append @logl logl 'bvgarch.append sqres1 = (y1-mu(1))^2 'bvgarch.append sqres2 = (y2-mu(2))^2 'bvgarch.append res1res2 = (y1-mu(1))*(y2-mu(2)) ' squared errors and cross errors bvgarch.append @logl logl bvgarch.append sqres1 = (y1-mu(1)-lambda(1)*garch1)^2 bvgarch.append sqres2 = (y2-mu(2)-lambda(2)*garch2)^2 bvgarch.append res1res2 = (y1-mu(1)-lambda(1)*garch1)*(y2-mu(2)-lambda(2)*garch2) ' calculate the variance and covariance series bvgarch.append var_y1 = omega(1)^2 + beta(1)^2*var_y1(-1) + alpha(1)^2*sqres1(-1) bvgarch.append var_y2 = omega(3)^2+omega(2)^2 + beta(2)^2*var_y2(-1) + alpha(2)^2*sqres2(-1) bvgarch.append cov_y1y2 = omega(1)*omega(2) + beta(2)*beta(1)*cov_y1y2(-1) + alpha(2)*alpha(1)*res1res2(-1) ' determinant of the variance-covariance matrix bvgarch.append deth = var_y1*var_y2 - cov_y1y2^2 ' inverse elements of the variance-covariance matrix bvgarch.append invh1 = var_y2/deth bvgarch.append invh3 = var_y1/deth bvgarch.append invh2 = -cov_y1y2/deth ' log-likelihood series bvgarch.append logl =-0.5*(!mlog2pi + (invh1*sqres1+2*invh2*res1res2+invh3*sqres2) + log(deth)) ' remove some of the intermediary series ' bvgarch.append @temp invh1 invh2 invh3 sqres1 sqres2 res1res2 deth ' estimate the model smpl s1 bvgarch.ml(showopts, m=100, c=1e-5) ' change below to display different output show bvgarch.output graph varcov.line var_y1 var_y2 cov_y1y2

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13603
Joined: Tue Sep 16, 2008 5:38 pm

Re: Error while estimating bv GARCH

Postby EViews Gareth » Thu Nov 18, 2010 8:40 am

Probably best to post your workfile.

yussel
Posts: 6
Joined: Wed Feb 10, 2010 3:40 pm

Re: Error while estimating bv GARCH

Postby yussel » Fri Nov 19, 2010 3:47 am

Dear Gareth,
Thank you for your reply. I uploaded the relevant part of my workfile. There are 6 series, for each two markets: a bid series per day, a squared return series and the residual series of a VEC M on the squared return series. I´d like to make a B GARCH M on the latter ones using the code I posted earlier.

Thanks for your help!

Yussel
Attachments
ibm vecm resids 2006 and 2008 155945_160500 bgarch.wf1
(41.52 KiB) Downloaded 303 times

yussel
Posts: 6
Joined: Wed Feb 10, 2010 3:40 pm

Re: Error while estimating bv GARCH

Postby yussel » Thu Nov 25, 2010 6:32 am

Hi everyone,

Does any one have an idea how to deal with the error described above? The problem seems to be in either one of the two lines containing: "equation eq1.arch(m=100,c=1e-5) y1 c", what does m=100 mean? I currently have some 750 obs, is that too few for a bv GARCH? I still did not find a solution.

Would be great if anyone could help me!

Thanks,

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Error while estimating bv GARCH

Postby trubador » Thu Nov 25, 2010 8:10 am

The code you are using is a bivariate garch-in-mean program and the line you are referring to is a univariate garch-in-mean specification, which is estimated in order to supply good initial values for the multivariate case. I do not think your problem results from anything related to code or EViews. There are significant outliers in your variables along with some problematic clusters. I am not sure if such data can be modeled within a simple multivariate and/or univariate garch framework.

Since you are using the residuals from a previous model as dependent variables, I believe the original model is ill-defined and may well be the source of your problem. As far as I understand, you are implementing a two-step procedure. I suggest you to build a system in the multivariate framework and estimate the parameters jointly.

yussel
Posts: 6
Joined: Wed Feb 10, 2010 3:40 pm

Re: Error while estimating bv GARCH

Postby yussel » Fri Nov 26, 2010 4:58 am

Dear Trubador,
Thank you for your explanation.

1) Though this might 'hurt' the information contained by the data, couldn't I just remove the 2 outliers and apply dummies for the clusters?

2) Indeed I apply two steps, first check for cointegration and accordingly estimate a VEC model on the 2 series, then saving the residuals, and accordingly estimate a bv GARCH on those residuals. I think I now understand the "insufficient obs error", as this probably indicates "too few obs to explain your data, including outliers and clustering".

3) Your suggestion seems a good idea I should probably have tried in the first place. Unfortunately, I'm not an expert in Eviews-programming and though I read some on systems in the User's Guides, I do not really know how to start concatenating the VEC and GARCH and jointly estimate the parameters. I tried look to look for related topics on the forum and among the example files and programs but couldn't find anything useful. Could you give some suggestions/ topics/example files of such joint estimation to have a look at? By the way, this user seemed to have applied more or less the same two-step procedure without estimating them jointly: http://forums.eviews.com/viewtopic.php? ... ecm#p11126

Thank you very much for your help and patience!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests