Page 1 of 1

Setting up a maximization problem

Posted: Wed May 18, 2016 4:11 pm
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.

Re: Setting up a maximization problem

Posted: Wed May 18, 2016 4:42 pm
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.

Re: Setting up a maximization problem

Posted: Fri May 20, 2016 10:54 am
by jjulioro
Great!
It worked perfectly as it supposed to do.

Regards,

Juan