GLOGL not defined

For questions that don't fall into one of the categories above, such as working with the RATS interface, using Wizards, etc.
adrangi
Posts: 45
Joined: Sun Sep 05, 2010 7:23 pm

GLOGL not defined

Unread post by adrangi »

Hi Tom. I have run somthing like the following before. However, I'm stumped now trying to do it on winrats. I'm sure my coding is problematic. Two questions. Frist, would you be willing to review the following and let me know wht I'm doing wrong? D4 and E4 are measuring volatility spillovers between the two variables. I intend to expand this to three or 4 variables.

Second, would I be able to include options on the canned GARCH (p, Q) command to account or volatility spillovers or any other exogenous (perhaps) variables such as dummies, etc. into the variance and maybe the covariance equations? Any suggestions and help on the econometrics or coding is much appreciated. Thanks. Bahram

OPEN DATA "C:\Users\Bahram\Documents\paps_10\WEA_10\data_wea10.xls"
DATA(FORMAT=XLS,ORG=COLUMNS) 1 4881 png vng ong pcrb vcrb ocrb pho vho oho pcl vcl ocl

set u = 0.0
set v = 0.0
set c11=0.0
set c22=0.0
set c12=0.0

set Y1=pho
set Y2=png

nonlin A0 A1 B0 B1 D0 D1 D2 D3 D4 E0 E1 E2 E3 E4 F0 F1 F2

FRML RESID1=Y1-A0-A1*Y1{1})
FRML RESID2=Y2-B0-B1*Y2{1})

FRML H11 = D0 + D1*C11{1} + D2*U{1}**2 + D3*NG*U{1}**2 + D4*V{1}**2
FRML H22 = E0 + E1*C22{1} + E2*V{1}**2 + E3*NS*V{1}**2 + E4*U{1}**2
FRML H12 = F0 + F1*C12{1} + F2*U{1}*V{1}

DEC SYMM SIGMA
DEC VECT UVECT

FRML GLOGL = C11(T)=H11,C22(T)=H22,C12(T)=H12,U(T)=RESID1,V(T)=RESID2, $ SIGMA=||C11(T)|C12(T),C22(T)||, UVECT=||U(T),V(T)||, $
-.5*LOG(%DET(SIGMA))-.5*%QFORM(INV(SIGMA),UVECT)

LINREG Y1
# CONSTANT Y1{1}
COMPUTE A0=%BETA(1), A1=%BETA(2)
COMPUTE D0=%SEESQ, D1=.5, D2=.1, D3=.1, D4=.1

LINREG Y2
# CONSTANT Y2{1}
COMPUTE B0=%BETA(1), B1=%BETA(2)
COMPUTE E0=%SEESQ, E1=.5, E2=.1, E3=.1, E4=.1
COMPUTE F0=0, F1=0, F2=0

MAXIMIZE (method=bhhh) GLOGL

The result:

## NL3. FRML GLOGL Has Not Been Defined
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: GLOGL not defined

Unread post by TomDoan »

Could you attach your actual program? (Use the "upload attachment" below the text box). What you included has so many syntax errors I can't tell what might be happening.
adrangi
Posts: 45
Joined: Sun Sep 05, 2010 7:23 pm

Re: GLOGL not defined

Unread post by adrangi »

Hi. Thanks again for the response. It's been a while since I've tried to code a program in RATS and I think my program as you mentioned is full of erros. Hope the attachment helps you see where the problem may be. Thanks again for the help. Bahram
Attachments
mgarchspillover.PRG
(1.22 KiB) Downloaded 1238 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: GLOGL not defined

Unread post by TomDoan »

Code: Select all

set u=0.0
set v=0.0
set c11=0.0
set c22=0.0
set c12=0.0

set Y1=pho
set Y2=png
These all need spaces before the =. (There's an implicit pair of range parameters in a SET).

Code: Select all

FRML RESID1=Y1-A0-A1*Y1{1})
FRML RESID2=Y2-B0-B1*Y2{1})
These need spaces before the =. They also have a stray ) at the end.

Code: Select all

MAXIMIZE (method = bhhh) GLOGL
This has an extra space before the option field (between MAXIMIZE and (METHOD=BHHH))
adrangi
Posts: 45
Joined: Sun Sep 05, 2010 7:23 pm

Re: GLOGL not defined

Unread post by adrangi »

Thanks very much. I might have added the parants in desperation! Cannot even remember doing that. Thanks for the detailed comments. There are no option commands to add variables in the GARCH (p, q) commend are there? Thanks again. Bahram
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: GLOGL not defined

Unread post by TomDoan »

Yes, there are. REGRESSORS for additions to the mean model and XREGRESSORS for additions to the variance model.
adrangi
Posts: 45
Joined: Sun Sep 05, 2010 7:23 pm

Re: GLOGL not defined

Unread post by adrangi »

Thanks much.
adrangi
Posts: 45
Joined: Sun Sep 05, 2010 7:23 pm

Re: GLOGL not defined

Unread post by adrangi »

Hi again. I corrected the spaces and checked other things too. The data are being read, used stat to check it. I've tried all sorts of things with my program and I'm still stumped. The progrm looks good to me but WinRats still doesn't recognize my FRML GLOGL. I've tried many things in the last few days to no avail. I'm uploading the program. Any help is much appreciated. Thaks very much. Bahram
Attachments
mgarchspillover.PRG
(1.31 KiB) Downloaded 1262 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: GLOGL not defined

Unread post by TomDoan »

That won't work as written, but I don't see how it could possibly give you a message about GLOGL not being defined. The problem with how it's written is that you have to give a hard start entry on the MAXIMIZE. From page 424 in the User's Guide:
It’s important to note that when you use MAXIMIZE, you must provide an explicit start for the estimation range. Because of the recursive nature of the calculation, MAXIMIZE can’t easily figure out which entry is the first one computable. In this case, the first entry is 3, allowing for one lag due to the ar(1), and another because the input series was generated as a log first difference.
The 3 for the start period is correct in your case as well.
adrangi
Posts: 45
Joined: Sun Sep 05, 2010 7:23 pm

Re: GLOGL not defined

Unread post by adrangi »

Hi Tom. Thanks very much. I had given 2 and then another number, partially because I was missing that hard start point. I gotta read the section again to understand better for other cases as well. Thanks again. Bahram
adrangi
Posts: 45
Joined: Sun Sep 05, 2010 7:23 pm

Re: GLOGL

Unread post by adrangi »

Hi Tom. I tried some more variations a few months back, again no dice! So I figured I better come back to this after everything else is done and take a fresh look at it. The error message is below. Does this give you any hints? My program is still uploaded. By the way, I did add the hard start 3 and testes 4, up to 8. I'm importing the data from an Excel file with variable lables in the first row. Thanks for any help or insight. Happy Holidays. Bahram

Identifier GLOGL is Not Recognizable. Incorrect Option Field or Parameter Order?
>>>>METHOD=BHHH) GLOGL <<<<

The following is the frml.

FRML GLOGL = C11(T)=H11 , C22(T)=H22 , C12(T)=H12 , $
U(T) = RESID1 , V(T) = RESID2 , $
SIGMA = ||C11(T)|C12(T),C22(T)|| , $
UVECT = ||U(T),V(T)||, $
-.5*LOG(%DET(SIGMA)) - .5* %QFORM(INV(SIGMA),UVECT)
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: GLOGL not defined

Unread post by TomDoan »

You probably need some tweaking of your guess values (your initial "GARCH" parameters are too small; use something more like .5 on the lagged variance and covariance). However, the only way that you'll get that message is if you execute the MAXIMIZE without executing the lines above it. Try opening the file, selecting all and hitting the running man icon. If you do that there is no way that you should get GLOGL undefined.
adrangi
Posts: 45
Joined: Sun Sep 05, 2010 7:23 pm

Re: GLOGL not defined

Unread post by adrangi »

Thanks very much Tom. Will give this a try. I also saw the MV EGRACH model you posted in 2009. May try to tweak and apply that too. Thanks. Happy Holidays. Bahram
adrangi
Posts: 45
Joined: Sun Sep 05, 2010 7:23 pm

Re: GLOGL not defined

Unread post by adrangi »

Hi Tom. Thanks for the help. I ran it!! :-)) These were the issues:

1. As you recommended, I changed the initial matrix values.
2. Edit Select all, as recommended.
3. GLOGL 3 4000 ( I guess it wanted to see the ending observation!).

Thanks again. Now, I will try to run the MV EGARCH you got (the revised Koutmus) program.
adrangi
Posts: 45
Joined: Sun Sep 05, 2010 7:23 pm

Re: Error when running the sign bias test

Unread post by adrangi »

Hi Tom. I've run the modified MV EGARCH, ala Koutmos and you. All works fine except at the end when I run the sign bias test (for the first equation) I get an error messge. The following is my program, which works and give all the estimates and the error message! Please see the end. Hope you can offer some insights. I've run sign bias test in a similar manner a few years back, i.e., right after maximize command and got results. By the way, I changed the starting observation a few times to no avail. Thanks and Happy New Year. Bahram

compute n=2
*
* Define the return series
*
dec vect[series] r(n)
**compute start=1986:1:3, end=1991:12:31
set r(1) = 100*log(nf/nf{1})
set r(2) = 100*log(sp/sp{1})
*
* Template for mean equation. This is a VAR(1)
*
equation meaneq *
# constant r(1){1} r(2){1}
*
table
*
dec vect[series] u(n) ;* Residuals
dec vect[series] v(n) ;* Variances
dec vect[frml] e(n) ;* Model for mean
dec vect[frml] z(n) ;* EGARCH indexes
dec vect d(n) ;* Asymmetry coefficients in EGARCH
dec vect g(n) ;* Lagged variance coefficients in EGARCH
*
* Subdiagonal for correlation matrix
*
dec symm rr(n-1,n-1)
*
* Coefficient vectors for the VAR (b) and the EGARCH with spillover (a).
* The variance for equation i takes the form:
*
* log h(i) = a(i)(1)+sum_j a(i)(j+1) z(j){1} + g(i) log h(i){-1}
*
* z(i) = abs(u(i)/sqrt(h(i))) - sqrt(2/pi) + d(i)*u(i)/sqrt(h(i))
*
dec vect[vect] b(n)
dec vect[vect] a(n)
*
* Set up the formulas for the mean and for calculating the "z"
*
do i=1,n
frml(equation=meaneq,vector=b(i)) e(i)
frml z(i) = abs(u(&i){0})/sqrt(v(&i){0})-sqrt(2/%pi)+d(&i)*u(&i){0}/sqrt(v(&i){0})
end do i
*
dec symm sigma
*
* Do calculations at time <<t>> for the residuals (u), variances (v) and
* full covariance matrix (return value for function).
*
function EGARCHSpillover t
type symmetric EGARCHSpillover
type integer t
*
local integer i j
local real hlog
*
do i=1,n
compute hlog=a(i)(1)+g(i)*log(v(i)(t-1))
do j=1,n
compute hlog=hlog+a(i)(j+1)*z(j)(t-1)
end do j
compute v(i)(t) = exp(hlog)
compute u(i)(t) = r(i)(t)-e(i)(t)
end do i
dim EGARCHSpillover(n,n)
ewise EGARCHSpillover(i,j)=%if(i==j,v(i)(t),rr(i-1,j)*sqrt(v(i)(t)*v(j)(t)))
end EGARCHSpillover
*
* Log likelihood
*
frml Lt = sigma=EGARCHSpillover(t),%logdensity(sigma,%xt(u,t))
*
* Initial guess values from running regressions. The b's are the OLS
* estimates, a's, g's and d's are (except for the constant) standard
* guess values.
*
do i=1,n
linreg(equation=meaneq,noprint) r(i)
set u(i) = %if(%valid(%resids),%resids,0.0)
compute b(i) = %beta
compute a(i) = %zeros(n+1,1)
compute a(i)(1)=log(%seesq),a(i)(i+1)=.25
compute g(i)=.80,d(i)=0.0
set v(i) = %seesq
end do i
*
compute rr=%zeros(n-1,n-1)
*
nonlin b a d g rr
maximize(pmethod=simplex,piters=2,method=bfgs,trace,iters=200) Lt 3 2240

***from Brooks text, signbias program, by bahram***

Set w = resid1
Set w1 = w(T)/SQRT(v(1)(T))
Set w2 = w(T)*w(T)/v(1)(T)
Set sminus = w1<0.0
Set splus = 1-sminus
Set wsminus = w1*sminus
set wsplus = w1*splus
linreg w2
#constant sminus{1}
Linreg w2
#constant wsminus{1}
Linreg w2
#constant wsplus{1}
Linreg w2
#constant simuns{1} wsminus{1} wsplus{1}
Compute chistat = %nobs*%rsquared
Cdf chisq chistat 3
end


Error at the end:
## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points
Post Reply