I am using CMLMT for a maximum likelihood estimation. I have parameters whose values I want to keep fixed, so I defined a mask of zeros for those, and I have parameters that should be estimated, for those I set a mask equal to 1. However, when CMLMT runs the iterations, the first parameter is Fixed_pars[1,1]
and it changes value during iterations. It is puzzling as (i) Fixed_pars
is 3x8; and (ii) it should be fixed. Do I miss something?
I know there is also an option c0.Active
that allows to define active parameters. However, in the parameter structure I have matrices, vectors and also scalars, while c0.Active
should be a vector. How does this work in my case? And what is the relation between c0.Active
and the mask defined for the parameters?
Thanks a lot.
Szabolcs
4 Answers
0
The specification of the fixed and free parameters in CMLMT is done by using the pvPackm function for matrices and vectors, and pvPacksm for symmetric matrices. Thus, for a 2x2 matrix, for example,
struct PV pars;
pars = pvCreate; // initialization
mat = { 1 2, 3 4 };
mask = { 1 0, 0 1 }; // mat[1,2] and mat[2,1] will be fixed;
pars = pvPackm(pars, mat, "first matrix", mask);
0
Maybe I was not completely clear, but I know how to specify parameters in a structure. I provide a simple example here to illustrate what my problem is.
Assume that I have three parameter inputs:
fixed_pars
: 3x8 matrix, values fixed and not to be estimated
Phi
: 3x3 matrix to be estimated
delta
: scalar to be estimated
I do the following:
fixed_pars_mask = zeros(3,8);
Phi_mask = ones(3,3);
struct PV p;
p = pvPackmi(p, fixed_pars, "Fixed_pars", fixed_pars_mask, 1);
p = pvPackmi(p, Phi, "Phi", Phi_mask, 2);
p = pvPacki(p, delta, "delta", 3);
Then in the procedure of the likelihood function I have:
fixed_pars = pvUnpack(p,1);
Phi = pvUnpack(p,2);
delta = pvUnpack(p,3);
Now, when I run CMLMT to maximise the objective function, among the parameters shown during the iterations the first is fixed_pars[1,1]
, which is strange as it is fixed and if CMLMT does not treat it as fixed, where are its other elements?
Is there something wrong with my specification?
And how could one use c0.Active
in this case? Isn't it the same thing as defining masks?
Thanks again!
0
Are you saying the entire matrix is fixed parameters? The PV functions require at least one free parameter. If the entire matrix is fixed, it's essentially data not a parameter. You could either bring it into your log-likelihood procedure using the DS data structure, or your could hardwire the matrix into your procedure.
0
Ok, I see, this must be the problem. Then it is better to bring it into the procedure as data, or treat it as a global variable.
What do you mean on "hardwire the matrix into your procedure"?
Your Answer
4 Answers
The specification of the fixed and free parameters in CMLMT is done by using the pvPackm function for matrices and vectors, and pvPacksm for symmetric matrices. Thus, for a 2x2 matrix, for example,
struct PV pars;
pars = pvCreate; // initialization
mat = { 1 2, 3 4 };
mask = { 1 0, 0 1 }; // mat[1,2] and mat[2,1] will be fixed;
pars = pvPackm(pars, mat, "first matrix", mask);
Maybe I was not completely clear, but I know how to specify parameters in a structure. I provide a simple example here to illustrate what my problem is.
Assume that I have three parameter inputs:
fixed_pars
: 3x8 matrix, values fixed and not to be estimated
Phi
: 3x3 matrix to be estimated
delta
: scalar to be estimated
I do the following:
fixed_pars_mask = zeros(3,8);
Phi_mask = ones(3,3);
struct PV p;
p = pvPackmi(p, fixed_pars, "Fixed_pars", fixed_pars_mask, 1);
p = pvPackmi(p, Phi, "Phi", Phi_mask, 2);
p = pvPacki(p, delta, "delta", 3);
Then in the procedure of the likelihood function I have:
fixed_pars = pvUnpack(p,1);
Phi = pvUnpack(p,2);
delta = pvUnpack(p,3);
Now, when I run CMLMT to maximise the objective function, among the parameters shown during the iterations the first is fixed_pars[1,1]
, which is strange as it is fixed and if CMLMT does not treat it as fixed, where are its other elements?
Is there something wrong with my specification?
And how could one use c0.Active
in this case? Isn't it the same thing as defining masks?
Thanks again!
Are you saying the entire matrix is fixed parameters? The PV functions require at least one free parameter. If the entire matrix is fixed, it's essentially data not a parameter. You could either bring it into your log-likelihood procedure using the DS data structure, or your could hardwire the matrix into your procedure.
Ok, I see, this must be the problem. Then it is better to bring it into the procedure as data, or treat it as a global variable.
What do you mean on "hardwire the matrix into your procedure"?