Resources

Specifying parameter names using control structure or PV structure in MaxLikMT

0

Hi,

I would appreciate your help on how to specify the name of different parameters (of a vector or matrix) using maxlikmtcontrol structure or PV structure.

Thanks and Regards

Annesha

 

asked April 10, 2014

1 Answer

0

When setting up your PV structure containing the starting values, use names,

struct PV p1;
p1 = pvPack(pvCreate,2,"constant");
p1 = pvPack(p0,1,"b");

and then in your log-likelihood procedure unpack them using their names.

proc lnlk(struct PV p, struct DS d, ind);
   local b0,b,dev,s2,y,x,r,w;
   b0 = pvUnpack(p,"constant");
   b = pvUnpack(p,"b");
   .
   .
   .
endp;

After Maxlikmt is finished you can retrieve the names and a vector parameter estimates:

struct cmlmtResults out1;
out1 = CMLmt(&lnlk,p0,d0,c0);

nms = pvGetParNames(out.par);
ests = pvGetParVector(out.par);

for i(1,rows(nms),1);
  print nms[i];;
  print ests[i];
endfor;

It is likely that "b" is a vector.  It's names will be printed as
b[1,1]
b[2,1]
.
.
.

Similarly with a matrix or an array containing parameters.