diff --git a/matlab/cli/+cli/check.m b/matlab/cli/+cli/check.m new file mode 100644 index 0000000000000000000000000000000000000000..afadaa2b8c0e6c355f61c97ac2b76bdf4877307e --- /dev/null +++ b/matlab/cli/+cli/check.m @@ -0,0 +1,40 @@ +function check(printflag) + +% Computes and displays the generalized eigenvalues. Also checks BK conditions. +% +% INPUTS +% - printflag [logical] scalar, print eigenvalues if true (default value is true). +% +% OUTPUTS +% None + +% Copyright (C) 2021 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <https://www.gnu.org/licenses/>. + +global options_ M_ oo_ + +if ~nargin || isempty(printflag) + printflag = true; +end + +noprint = options_.noprint; + +options_.noprint = ~printflag; + +check(M_, options_, oo_); + +options_.noprint = noprint; \ No newline at end of file diff --git a/matlab/cli/+cli/evaluate_likelihood.m b/matlab/cli/+cli/evaluate_likelihood.m new file mode 100644 index 0000000000000000000000000000000000000000..0801fd245c44af2e6d50f8904d68fe80f9b989b5 --- /dev/null +++ b/matlab/cli/+cli/evaluate_likelihood.m @@ -0,0 +1,37 @@ +function llik = evaluate_likelihood(parameters) + +% Evaluates the likelihood function. +% +% INPUTS +% - parameters [char,double] If row char array, possible values are 'posterior mode', 'posterior mean', +% 'posterior median', 'prior mode' or 'prior mean'. Otherwise, parmaters must +% be a vector of doubles (arbitrary values for the parameters). +% +% OUTPUTS +% None + +% Copyright (C) 2021 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <https://www.gnu.org/licenses/>. + +global M_ estim_params_ oo_ options_ bayestopt_ + +llik = evaluate_likelihood(parameters, M_, estim_params_, oo_, options_, bayestopt_); + +if ~nargout + dprintf('\nValue of the log-likelihood: %20.6f\n', llik); + clear ('llik'); % Do not display the value returned by the function. +end \ No newline at end of file diff --git a/matlab/cli/+cli/evaluate_posterior_kernel.m b/matlab/cli/+cli/evaluate_posterior_kernel.m new file mode 100644 index 0000000000000000000000000000000000000000..b7a2dddb4101fe300300d2dc2c65650b2cf22961 --- /dev/null +++ b/matlab/cli/+cli/evaluate_posterior_kernel.m @@ -0,0 +1,37 @@ +function lpk = evaluate_posterior_kernel(parameters) + +% Evaluates the posterior kernel function. +% +% INPUTS +% - parameters [char,double] If row char array, possible values are 'posterior mode', 'posterior mean', +% 'posterior median', 'prior mode' or 'prior mean'. Otherwise, parmaters must +% be a vector of doubles (arbitrary values for the parameters). +% +% OUTPUTS +% None + +% Copyright (C) 2021 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <https://www.gnu.org/licenses/>. + +global M_ estim_params_ oo_ options_ bayestopt_ + +lpk = evaluate_posterior_kernel(parameters, M_, estim_params_, oo_, options_, bayestopt_); + +if ~nargout + dprintf('\nValue of the logged posterior kernel: %20.6f\n', lpk); + clear ('lpk'); % Do not display the value returned by the function. +end \ No newline at end of file diff --git a/matlab/cli/+cli/evaluate_prior.m b/matlab/cli/+cli/evaluate_prior.m new file mode 100644 index 0000000000000000000000000000000000000000..fc470b6b93506633a6f14f5c7de0b9f75cd74fc4 --- /dev/null +++ b/matlab/cli/+cli/evaluate_prior.m @@ -0,0 +1,37 @@ +function ldens = evaluate_prior(parameters) + +% Evaluates the posterior kernel function. +% +% INPUTS +% - parameters [char,double] If row char array, possible values are 'posterior mode', 'posterior mean', +% 'posterior median', 'prior mode' or 'prior mean'. Otherwise, parmaters must +% be a vector of doubles (arbitrary values for the parameters). +% +% OUTPUTS +% None + +% Copyright (C) 2021 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <https://www.gnu.org/licenses/>. + +global M_ estim_params_ oo_ options_ bayestopt_ + +ldens = evaluate_prior(parameters, M_, estim_params_, oo_, options_, bayestopt_); + +if ~nargout + dprintf('\nValue of the logged prior density: %20.6f\n', ldens); + clear ('ldens'); % Do not display the value returned by the function. +end \ No newline at end of file diff --git a/matlab/cli/+cli/steady.m b/matlab/cli/+cli/steady.m new file mode 100644 index 0000000000000000000000000000000000000000..f69a5c900298113c0f6e3e9e6e3cf92b17dcc6ce --- /dev/null +++ b/matlab/cli/+cli/steady.m @@ -0,0 +1,40 @@ +function steady(printflag) + +% Computes and prints the steady state. +% +% INPUTS +% - printflag [logical] scalar, print steady state if true (default value is true). +% +% OUTPUTS +% None + +% Copyright (C) 2021 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <https://www.gnu.org/licenses/>. + +global options_ + +if ~nargin || isempty(printflag) + printflag = true; +end + +noprint = options_.noprint; + +options_.noprint = ~printflag; + +steady(); + +options_.noprint = noprint; \ No newline at end of file