Panel GARCH with dummy variable
Posted: Tue Dec 25, 2018 10:03 am
Dear Tom
I'm a new user of RATS and I have been trying to understand its coding system since few days, now I need to run Panel GARCH model with three dummy variables for panel data on weekly stock prices of 15 countries, the dummies stand for the periods when the capital inflows are either high, low or normal. I want to check whether the conditional variance of stock prices have significant changes during these periods or not.
I got the code of Panel GARCH model from the link below
https://estima.com/forum/viewtopic.php?f=11&t=715
And I tried to adjust it according to the inputs I'm using by typing the following code
I tried many times and still don't know how to introduce dummy variables in the equations of the mean and conditional variance.
Thanks in advance
I'm a new user of RATS and I have been trying to understand its coding system since few days, now I need to run Panel GARCH model with three dummy variables for panel data on weekly stock prices of 15 countries, the dummies stand for the periods when the capital inflows are either high, low or normal. I want to check whether the conditional variance of stock prices have significant changes during these periods or not.
The variables TSD, TOD and TND represent the dummy variables.DATA(FORMAT=XLSX,ORG=COLUMNS) 1//2000:01:05 2//2088:09:22 index TSD TOD TND
I got the code of Panel GARCH model from the link below
https://estima.com/forum/viewtopic.php?f=11&t=715
And I tried to adjust it according to the inputs I'm using by typing the following code
Code: Select all
all 13981
open data Threshold.xls
data(format=xls,org=columns) / index TSD TOD TND
*
set Xindex = 100.0*log(index/index{1})
*
* Estimation using MAXIMIZE
* The initial few lines of this set the estimation range, which needs to
* be done explicitly, and the number of variables. Then, vectors for the
* dependent variables, residuals and residuals formulas are set up. The
* SET instructions copy the dependent variables over into the slots in
* the vector of series.
*
compute gstart=2,gend=13981
compute n=4
dec vect[series] y(n) u(n)
dec vect[frml] resid(n)
set y(1) = Xindex
set DUMMY1 = TSD
set DUMMY2 = TOD
set DUMMY3 = TND
* This is specific to a mean-only model. It sets up the formulas (the &i
* are needed in the formula definitions when the FRML is defined in a
* loop), and estimates them using NLSYSTEM. This both initializes the
* mean parameters, and computes the unconditional covariance matrix. If
* you want more general mean equations, the simplest way to do that
* would be to define each FRML separately.
*
dec vect b(n)
nonlin(parmset=meanparms) b
do i=1,n
frml resid(i) = (y(&i)-b(&i))
end do i
nlsystem(parmset=meanparms,resids=u) gstart gend resid
compute rr=%sigma
*
* The paths of the covariance matrices and uu' are saved in the
* SERIES[SYMM] names H and UU. UX and HX are used to pull in residuals
* and H matrices.
*
declare series[symm] h uu
*
* ux is used when extracting a u vector
*
declare symm hx(n,n)
declare vect ux(n)
*
* These are used to initialize pre-sample variances.
*
gset h * gend = rr
gset uu * gend = rr
*
* This is a standard (normal) log likelihood formula for any
* multivariate GARCH model. The difference among these will be in the
* definitions of HF and RESID. The function %XT pulls information out of
* a matrix of SERIES.
*
declare frml[symm] hf
*
frml logl = $
hx = hf(t) , $
%do(i,1,n,u(i)=resid(i)) , $
ux = %xt(u,t), $
h(t)=hx, uu(t)=%outerxx(ux), $
%logdensity(hx,ux)
*****************************************************
*
* Panel GARCH - DVECH with restrictions
*
dec symm vcs(n,n)
dec real delta lambda gamma rho
dec symm vbs(n,n) vas(n,n)
*
compute vcs=rr*.1,delta=lambda=.8,gamma=rho=.1
nonlin(parmset=garchparms) vcs delta lambda gamma rho
frml hf = vcs+vbs.*h{1}+vas.*uu{1}
*
* Call once during START option to fill in the VAS and VBS arrays
*
function PGARCHInit
local integer i j
ewise vbs(i,j)=%if(i==j,delta,lambda)
ewise vas(i,j)=%if(i==j,gamma,rho)
end
*
maximize(start=PGARCHInit(),parmset=meanparms+garchparms,pmethod=simplex,piters=10,method=bfgs,iters=400) logl gstart gend
Thanks in advance


