Setting up a maximization problem

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
jjulioro
Posts: 8
Joined: Mon Sep 07, 2015 3:36 pm

Setting up a maximization problem

Unread post by jjulioro »

Dear Group,

I am performing the following maximization. I have my data in a symmetric matrix of time series MV, and want to estimate two matrices of parameters PARM_M and PARM_S.

DECLARE SYMMETRIC[SERIES] MV(6,6)
SET MV(1,1) = X1
SET MV(1,2) = X2
.
.
.
SET MV(6,6) = X36

DECLARE RECTANGULAR[REAL] PARM_M(6,6)
DECLARE RECTANGULAR[REAL] PARM_S(6,6)
* SET INITIAL VALUES
DO II=1,6
DO JJ=1,6
COMPUTE PARM_M(II,JJ) = (II==JJ)
COMPUTE PARM_S(II,JJ) = 10.0*(II==JJ)
END DO JJ
END DO II

* PERFORM MAXIMIZATION
NONLIN(PARMSET=BASE) PARM_M PARM_S
FRML LOGLT = -%NORMSQR(%XT(MV,T)-TR(PARM_M)*%XT(MV,T-1)*PARM_M-PARM_S
MAXIMIZE(PMETHOD=SIMPLEX,PITERS=10000) LOGLT START+1 END AUX

This code actually works.

Now I want to impose restrictions on particular elements of PARM_M, but when I try

NONLIN(PARMSET=CONSTRAINT) PAR_M(1,6) = PAR_M(2,6) = PAR_M(3,6) = PAR_M(4,6) = 0

after the first NONLIN instruction, it does not recognize the restrictions and cannot continue to the maximization.

How can I impose these restrictions in this particular problem?

Best regards,

Juan M.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Setting up a maximization problem

Unread post by TomDoan »

First of all, the names are all wrong in this:

NONLIN(PARMSET=CONSTRAINT) PAR_M(1,6) = PAR_M(2,6) = PAR_M(3,6) = PAR_M(4,6) = 0

You also have to get rid of the extra spaces---the fields on NONLIN are delimited by spaces.

Finally, once you start using named PARMSETS, you need to use a PARMSET option on MAXIMIZE (or whatever) instruction. The empty PARMSET option only uses the last unnamed PARMSET that you've defined. If you want to add the constraints, you would need PARMSET=BASE+CONSTRAINT on the MAXIMIZE.
jjulioro
Posts: 8
Joined: Mon Sep 07, 2015 3:36 pm

Re: Setting up a maximization problem

Unread post by jjulioro »

Great!
It worked perfectly as it supposed to do.

Regards,

Juan
Post Reply