Constraining Time-Varying MLE Parameters with Logistic Mapping
Summary
The document describes using a logistic transformation to keep time-varying parameters within specified lower and upper bounds during maximum likelihood estimation. The proposed mapping converts an unconstrained parameter into a value between those limits, allowing the optimizer to work without direct vector constraints on each time step.
An example Matlab routine perturbs a parameter in transformed space, maps it back to the permitted range, compares log-likelihood values, and keeps improved candidates. It also applies a separate normalization-style constraint to another parameter vector. The example is an ad hoc iterative search, not a general implementation of fmincon or a demonstration of convergence. It provides no empirical results, and readers would need to check how the mapping, other constraints, and optimization procedure fit their own likelihood model.
Key ideas
- A logistic transformation maps an unconstrained parameter to a specified bounded interval.
- The example searches by perturbing parameters in transformed space and comparing likelihood values.
- The code applies an additional constraint by rescaling a vector of parameters.
- The routine is an example search procedure and does not establish general convergence properties.
Tags
Full text
# Imposing MLE restrictions by logistic mapping
# Imposing MLE restrictions by logistic mapping
I am doing some Maximum Likelihood Estimation with a density that has time-varying parameters. I am using the `fmincon` function in Matlab, but I do not know how to impose restrictions on a vector of parameters. To be clear, I have a vector of parameters (that do not change over time) and I know how to impose restrictions on them. However I want to make two parameters time-varying and I do not know how to impose restrictions on vectors containing those time-varying parameters. Summing up, I have a vector of a few time-invariant parameters and two vectors of time-varying parameters.
I found a paper that suggests using logistic mapping of the form $ \Theta_{t, restricted} = L + \frac{(U-L)}{1+exp(-\Theta_t)}$ where $\Theta_t = (x_1, x_2)$ and U and L are the upper and lower bounds respectively, for the restricted parameter. $x_1, x_2$ are the time-varying parameters on which I want to impose restrictions.
I would be grateful for any help regarding implementing this logistic mapping into my optimization problem.
## Answer by jeff bodington (score 1, accepted)
https://quant.stackexchange.com/a/22497
Here is an MLE I built that uses logistic mapping.
```
%MLE iterator:
for cxm = 1:cxmax
for cxth = 1:wx; %thx
%Incr. theta within asymptotic min and max.
thi1 = thA1(cxth,1); mint = thA1(cxth,2); maxt = thA1(cxth,3);
thix = -log((maxt - mint)/(thi1 - mint) - 1); %Logistic inverse.
if rand > 0.5; signx = -1; else signx = 1; end
expn = thix + 0.25 * signx / cxm;
thi2 = mint + ((maxt - mint)/(1 + exp(-expn))); %Logistic.
%Calc. change in log likelihood.
thA2 = thA1;
thA2(cxth,1) = thi2;
%Constraint(s):
thA2(wx+1:wx*2,1) = min(1,thA2(wx+1:wx*2,1) / sum(thA2(wx+1:wx*2,1)));
[llk1] = llkF(rC,thA1,tx,wx);
[llk2] = llkF(rC,thA2,tx,wx);
%Calc. update.
thA3 = thA1;
expn = thix + 1 * ((llk2 - llk1) / (expn - thix)) / cxm;
thA3(cxth,1) = mint + ((maxt - mint)/(1 + exp(-expn))); %Logistic.
%Constraint(s):
thA3(wx+1:wx*2,1) = min(1,thA3(wx+1:wx*2,1) / sum(thA3(wx+1:wx*2,1)));
[llk3] = llkF(rC,thA3,tx,wx);
%Update thA1 only if thA2 or thA3 is better.
disp([llk1 llk2 llk3]); %<<<<<<<<<<<<<<<<<<<<<<
if llk2 > llk1 && llk2 > llk3; thA1 = thA2; llk1 = llk2; end
if llk3 > llk1 && llk3 > llk2; thA1 = thA3; llk1 = llk3; end
end%theta loop.
llkV(cxm) = llk1;
%disp([' MLE: ', num2str(cxm),', ll = ',num2str(llk1)])
%Test for MLE convergence.
if cxm > 5;
d5llk = (llkV(cxm) - llkV(cxm - 5)); %Calc. change in llk, lag 5.
if d5llk < 0.0001; llkV(cxm + 1:cxmax) = llkV(1);
break; end;
end%test
end%MLE loop.
llkV = llkV(1:cxm); %Truncate away the zeros.
thA = thA1; %Reset theta array.
```Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.