var garch in mean program

i have difficuty in programing  trivariate VAR(2) GARCH in Mean using FANPACMT. Any suggestion for making option on puting each conditional standard deviation in each mean equations ?

1 Answer



0



The option for a diagonal in-mean for multivariate models is a great suggestion which will get passed on to the developers.  In the meantime, you could get the same result by constraining the off-diagonal elements to zero.   First, run the model setting maxIters to 1 and print the vector of parameters.  This will give you the order of the parameters so that you can then use apply linear constraints in sqpSolvemt:

library fanpacmt; 
#include fanpacmt.sdf

load index[368,9] = index.asc;
x0 = index[.,2:3];
x = 200 * ln(x0[2:368,.]./x0[1:367,.]);

struct FanControl f0;
f0 = fanControlCreate;
f0.p = 1;
f0.q = 1;
f0.inmean = 1;  // nonzero is in-mean model
f0.sqrtcv = 1;  // square root of conditional variance is used
f0.SQPsolveMTControlProc = &sqpc;

proc sqpc(struct sqpsolvemtControl c0);
  c0.maxiters = 1;
  retp(c0);
endp;

struct DS d0;
d0 = dsCreate;
d0.dataMatrix = x;
struct fanEstimation out;
out = CCCGarch(f0,d0);
lbl = pvGetParNames(out.par);
x = pvGetParVector(out.par);

format /rd 10,4; 
for i(1,rows(x),1);
  print lbl[i];;
  print x[i];
endfor;
beta0[1,1]    0.2759 
beta0[2,1]    0.0355 
delta_s[1,1]   -0.0507 
delta_s[1,2]    0.0508 
delta_s[2,1]    0.0053 
delta_s[2,2]   -0.0507 
omega[1,1]    2.3277 
omega[2,1]    0.6059 
garch[1,1]    0.0106 
garch[1,2]    0.0201 
arch[1,1]    0.1112 
arch[1,2]   -0.0900 
cor[2,1]    0.0509 

We will want to constrain the off-diagonal elements of delta_s to zero, which are the 4th and 5th parameters of the 13 parameters in the parameter vector. We do this by adding lines to the linear constraints in sqpSolvemt:

proc sqpc(struct sqpsolvemtControl c0);
	c0.printIters = 1;
	c0.maxiters = 5;
	
	local A,B;
	A = zeros(2,13);
	B = zeros(2,1);
	A[1,4] = 1;
	A[2,5] = 1;
	
	c0.A = c0.A | A;
	c0.B = c0.B | B;
		
	retp(c0);
endp;

The rows of A are the constraints we want to add, and the columns is equal to the number of parameters in the parameter vector. The constraint is Ax = B where x is the parameter vector. Next rerun the command file and we get

beta0[1,1]    0.3029 
beta0[2,1]    0.1124 
delta_s[1,1]   -0.0223 
delta_s[1,2]    0.0000 
delta_s[2,1]    0.0000 
delta_s[2,2]   -0.0220 
omega[1,1]    2.3488 
omega[2,1]    0.6270 
garch[1,1]    0.1316 
garch[1,2]    0.0311 
arch[1,1]    0.1318 
arch[1,2]    0.0311 
cor[2,1]    0.1213

Your Answer

1 Answer

0

The option for a diagonal in-mean for multivariate models is a great suggestion which will get passed on to the developers.  In the meantime, you could get the same result by constraining the off-diagonal elements to zero.   First, run the model setting maxIters to 1 and print the vector of parameters.  This will give you the order of the parameters so that you can then use apply linear constraints in sqpSolvemt:

library fanpacmt; 
#include fanpacmt.sdf

load index[368,9] = index.asc;
x0 = index[.,2:3];
x = 200 * ln(x0[2:368,.]./x0[1:367,.]);

struct FanControl f0;
f0 = fanControlCreate;
f0.p = 1;
f0.q = 1;
f0.inmean = 1;  // nonzero is in-mean model
f0.sqrtcv = 1;  // square root of conditional variance is used
f0.SQPsolveMTControlProc = &sqpc;

proc sqpc(struct sqpsolvemtControl c0);
  c0.maxiters = 1;
  retp(c0);
endp;

struct DS d0;
d0 = dsCreate;
d0.dataMatrix = x;
struct fanEstimation out;
out = CCCGarch(f0,d0);
lbl = pvGetParNames(out.par);
x = pvGetParVector(out.par);

format /rd 10,4; 
for i(1,rows(x),1);
  print lbl[i];;
  print x[i];
endfor;
beta0[1,1]    0.2759 
beta0[2,1]    0.0355 
delta_s[1,1]   -0.0507 
delta_s[1,2]    0.0508 
delta_s[2,1]    0.0053 
delta_s[2,2]   -0.0507 
omega[1,1]    2.3277 
omega[2,1]    0.6059 
garch[1,1]    0.0106 
garch[1,2]    0.0201 
arch[1,1]    0.1112 
arch[1,2]   -0.0900 
cor[2,1]    0.0509 

We will want to constrain the off-diagonal elements of delta_s to zero, which are the 4th and 5th parameters of the 13 parameters in the parameter vector. We do this by adding lines to the linear constraints in sqpSolvemt:

proc sqpc(struct sqpsolvemtControl c0);
	c0.printIters = 1;
	c0.maxiters = 5;
	
	local A,B;
	A = zeros(2,13);
	B = zeros(2,1);
	A[1,4] = 1;
	A[2,5] = 1;
	
	c0.A = c0.A | A;
	c0.B = c0.B | B;
		
	retp(c0);
endp;

The rows of A are the constraints we want to add, and the columns is equal to the number of parameters in the parameter vector. The constraint is Ax = B where x is the parameter vector. Next rerun the command file and we get

beta0[1,1]    0.3029 
beta0[2,1]    0.1124 
delta_s[1,1]   -0.0223 
delta_s[1,2]    0.0000 
delta_s[2,1]    0.0000 
delta_s[2,2]   -0.0220 
omega[1,1]    2.3488 
omega[2,1]    0.6270 
garch[1,1]    0.1316 
garch[1,2]    0.0311 
arch[1,1]    0.1318 
arch[1,2]    0.0311 
cor[2,1]    0.1213

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.