IRIS-Solutions-Team / IRIS-Toolbox

[IrisToolbox] for Macroeconomic Modeling
Other
90 stars 41 forks source link

Quick command for plain maximum likelihood estimation. #340

Open tosapola opened 1 year ago

tosapola commented 1 year ago

Hi,

The case is like when have some small model and do not have any preference on Bayesian priors. Can we (or should we or do we currently) have a quick command (or option) for simple maximum likelihood estimation? i.e. just input the model + data and that's it.

Best, Tos

jaromir-benes commented 1 year ago

Hi - you don't need to specify any priors whatsoever. The only thing you need to supply is at least the list of parameters you want to estimate. This is done by creating struct with the parameters to be estimated as its fields. This "estimation specification struct" is then passed into the estimate function as its fourth input argument.

The fields themselves can be empty, or cell arrays with as many as four elements:

est = struct();
est.alpha = {start, lower, upper, prior};
est.beta = {start, lower, upper, prior};

where NONE of the elements in {start, lower, upper, prior} is mandatory; any of them can be left empty or you simply supply a shorter cell array. The starting value (for iterations) can be NaN in which case the currently assigned values in the model object are used for starters.

All the specifications below are equivalent - they set up an estimation run with no priors, no lower/upper bounds, and the starting value assigned from the model object.

est = struct();
est.alpha = {};
est.beta = {};
est = struct();
est.alpha = {NaN};
est.beta = {NaN};
est = struct();
est.alpha = {NaN, -Inf, Inf};
est.beta = {NaN, -Inf, Inf};

Hope this helps. Jaromir

tosapola commented 1 year ago

So, if IRIS allows me to use:

est = struct();
est.alpha = {};
est.beta = {};

The quickest (I mean less code) way I could think of is to use: E = structfun(@(x) {},get(m,'param','std'),'UniformOutput',false); which I think is quick enough.

Hope this is correct.

Thank you, Tos