Commit Graph

91 Commits (4733d97cebde01370afaf617f790a70f051d4abc)

Author SHA1 Message Date
Stéphane Adjemian (Charybdis) 3a823c488f
Fix PAC equations with lags on exogenous variables. 2021-04-02 15:52:30 +02:00
Sébastien Villemot 47477e152a
Bump minimal Octave version to 6.2.0 2021-03-12 16:21:57 +01:00
Sébastien Villemot 901d8355e3
PAC iterative OLS: compatibility fix for Octave < 6 2021-02-04 16:01:30 +01:00
Sébastien Villemot 8e9085eea4
PAC NLS estimation: Octave compatibility fix
In regular expressions, the end-of-word operator (\>) does not behave the same
under Octave and under MATLAB. See:
https://savannah.gnu.org/bugs/index.php?59992

In this case, we can simply drop the \> operator, since there is no risk of
matching a partial variable name (since there is already “(-1)” at the end of
the pattern).

By the way, remove a useless parenthesis grouping in the regexp.
2021-02-02 17:02:04 +01:00
Sébastien Villemot e26a5e2805
NLS: compatibility fix for Octave and MATLAB < R2014b 2021-01-15 17:42:00 +01:00
Stéphane Adjemian (Charybdis) a40a940d51
Same as 8aa86a22 in Iterative OLS. 2020-01-06 11:03:58 +01:00
Stéphane Adjemian (Charybdis) 8aa86a2244
Save the list of parameter names in pac estimation results (NLS). 2020-01-06 11:03:26 +01:00
Stéphane Adjemian (Charybdis) d740af10f3 PAC/nls save lhs and fitted variables. 2019-11-25 17:29:45 +01:00
Stéphane Adjemian (Charybdis) fce51c6cc4 Added R² to PAC NLS estimator. 2019-10-28 16:35:45 +01:00
Stéphane Adjemian (Charybdis) 6a959c4629 Put estimated residuals in a dseries object. 2019-10-28 16:34:56 +01:00
Dóra Kocsis 3648ccb8ff Adjust result output for NLS and Iterative OLS. 2019-10-10 10:10:23 +02:00
Sébastien Villemot 3434ec2f9b
NLS estimation of PAC: fmincon now available under Octave 2019-10-09 12:32:26 +02:00
DoraK 41c66583ac Add linear combination support for growth neutrality in Iiterative OLS. 2019-10-08 23:18:40 +02:00
DoraK 8f6647b557 fix typo 2019-10-08 23:15:10 +02:00
Sébastien Villemot 8e1528c1cb
Temporary fix for growth parameter in PAC models
The preprocessor has been modified to allow linear combinations in the growth
parameter (see Dynare/preprocessor@a0f74f5c16 and
Dynare/preprocessor@d873414728).

This commit restores the previous functionality (i.e. it fixes the simple case
where only one parameter/variable is provided for the growth parameter).

The code still needs to be adapted to really handle linear combinations.
2019-09-26 17:35:31 +02:00
Stéphane Adjemian (Charybdis) e3f1ea7e3c Added upper bound to error correction parameter.
Available only for lsqnonlin, fmincon, annealing, and particleswarm algorithms.
2019-07-24 11:21:52 +02:00
Stéphane Adjemian (Charybdis) 9be7568c94 Bug fix in growth neutrality correction.
An index was used instead of a parameter value when modifying the
correction (for handling models with non optimizing agents and/or models with
exogenous variables).
2019-05-17 12:27:15 +02:00
Stéphane Adjemian (Charybdis) d3db092c81
Added a cherry-pick routine.
Extracts equations from a mod file and produce .inc files (equations, lists of
parameters, endogenous variables and exogenous variables) that can be included
in a mod file that will be used to simulate the model.

If an innovation has a tag `(used='estimationonly')` it will be excluded from
the generated files (ie list of shocks and equations).
2019-03-14 11:04:10 +01:00
Stéphane Adjemian (Charybdis) 52eed33c42
Fixed growth neutrality correction in presence of exogenous variables.
Also fixes growth neutrality correction in models with non optimizing
agents (correction was not taking into account the value of the share of non
optimizing agents).
2019-03-11 11:54:53 +01:00
Stéphane Adjemian (Charybdis) 6997e0a4a6
Added the possibility to have exogenous variables in the optimal part of PAC.
Works with iterative ols and nls.
2019-03-08 14:34:41 +01:00
Stéphane Adjemian (Charybdis) 1471b3bfce
Changegd estimator for the exogenous part of pac.estimation.iterative_ols routine. 2019-03-07 12:37:06 +01:00
Stéphane Adjemian (Charybdis) 4d69674874
Partially reverts 1190cab. 2019-03-07 12:31:23 +01:00
Houtan Bastani 1190caba61
pac.estimate.nls: clean up code: remove unused variables, unused output arguments, no need for otherwise in switch 2019-03-07 11:59:59 +01:00
Houtan Bastani b844bc53a0
pac: fix bugs in output of ec component 2019-03-07 11:44:40 +01:00
Stéphane Adjemian (Charybdis) 9eb64a0b64
Updated preprocessor submodule.
Fixes exogenous variables in PAC equation without non optimizing behaviour.
2019-03-06 15:39:00 +01:00
Stéphane Adjemian (Charybdis) 4798c07ced
Avoid infinite loop in pac.estimation.iterative_ols(). 2019-03-05 07:21:08 +01:00
Stéphane Adjemian (Charybdis) d00b57541e
Allow exogenous variables in pac.estimation.iterative_ols routine.
The parameters associated to these additional variables can be estimated or calibrated.
2019-03-01 23:32:47 +01:00
Stéphane Adjemian (Charybdis) f07b1e8028
Account for exogenous variables in PAC's RoT part.
Fixes the iterative_ols estimation of PAC equation when the Rule of Thumbs (non
optimizing) part of the equations contains endogenous and/or exogenous variables.
2019-02-27 15:53:25 +01:00
Stéphane Adjemian (Charybdis) 6500099f4e
Removed debugging display. 2019-02-27 15:08:49 +01:00
Stéphane Adjemian (Charybdis) 1aa7f4a93f
Added PAC with Model Consistent Expectations. 2019-02-25 17:31:58 +01:00
Stéphane Adjemian (Charybdis) ac09ab9dbf
Removed useless condition. 2019-02-25 17:31:58 +01:00
Stéphane Adjemian (Charybdis) 0af3068569
Handle situations where a PAC model is used in more than one equation. 2019-02-22 17:58:24 +01:00
Stéphane Adjemia (Scylla) 74520e77bf
Allow for lags on endogenous variable in growth option of pac_model. 2019-01-28 11:25:30 +01:00
Stéphane Adjemia (Scylla) 3bc6b34161
Bug fix.
Be agnostic about the name of the PAC model.
2019-01-07 13:33:08 +01:00
Stéphane Adjemia (Scylla) c829e7968d
If possible define boundaries for the share of optimizing agents in PAC/NLS.
The parameter is constrained to be in (0,1) for the following algorithms

 - lsqnonlin (without Levenberg-Marquardt)
 - fmincon
 - annealing
 - particleswarm

Other algorithms do not allow the definition of boundaries... We should add a
penality function to the objective for these algorithms.
2018-12-19 16:05:34 +01:00
Stéphane Adjemia (Scylla) df57bf7eb9
Fixed bug.
PAC/NLS routine was only working if the PAC model was named `pacman`.
2018-12-19 16:00:57 +01:00
Stéphane Adjemia (Scylla) 11b24a0663
Add a constraint on the share of optimizing agents PAC/Iterative OLS.
Ensure that the parameter value lies betwwen 0 and 1.
2018-12-19 15:43:36 +01:00
Stéphane Adjemia (Scylla) c0570ff0af
Fixed typo. 2018-12-19 15:41:32 +01:00
Stéphane Adjemia (Scylla) 38c8462142
If NLS, do not check the ordering of estimated parameters in PAC. 2018-12-12 16:28:19 +01:00
Stéphane Adjemia (Scylla) d501d6d511
Added interface to lsqnonlin (Mathworks' optimization toolbox) in pac.estimate.nls. 2018-11-29 10:29:55 +01:00
Stéphane Adjemia (Scylla) e6c716ae9b
Added the possibility to use Gauss-Newton in pac/nls.
Also added the computation of the covariance matrix of the NLS estimator (using
White and Domovitz approach) and integration test.
2018-11-26 09:53:18 +01:00
Stéphane Adjemia (Scylla) cf35496c06
Fixed bug in the evaluation of the sum of squared residuals (PAC/NLS). 2018-11-21 15:21:23 +01:00
Stéphane Adjemia (Scylla) 7d2d0d6590
Added the possibility to estimate the share of optimizing agents by iterative OLS (PAC). 2018-11-21 15:07:15 +01:00
Stéphane Adjemia (Scylla) a53c63d6d5
Added routines to print PAC_EXPECTATION and VAR_EXPECTATION in files.
Each new routine pac.print() and var_expectation.print(), creates two files
that can be included (using the macro language) in a mod file. The first
file, {pac,var}expectationmodename-parameters.inc saved under
{M_.fname}/model/{pac,var}expectationmodel, contains the declaration of the
parameters created for the expanded (var or pac) expectation model, with
calibrated values. The second file, {pac,var}expectationmodename-parameters.inc
saved in the same subfolder, contains the expanded version of the (pac or var)
expectation term as a linear combination of the variables in the companion
representation of the expectatino model.
2018-10-14 16:57:51 +02:00
Stéphane Adjemian(Charybdis) ae71599292
Switch to new get_companion_matrix routine. 2018-09-28 19:27:17 +02:00
Stéphane Adjemian(Charybdis) 031e2c87c6
New version of get_companion_matrix + new integration test.
The routine is still buggy. In PAC and VAR_EXPECTATION models we
use get_companion_matrix_legacy routine instead.
2018-09-19 17:39:48 +02:00
Stéphane Adjemian(Charybdis) 2518cd9884 Raise error of an optimization algorithm is not available. 2018-09-13 16:16:07 +02:00
Stéphane Adjemian(Charybdis) 2437d7034e Give access to more than one optimizer in PAC estimation (NLS).
Default is to use csminwel optimizer (because it seems to do the job and does
not rely on the Mathworks toolbox).
2018-09-13 16:15:52 +02:00
Stéphane Adjemian(Charybdis) 6815624a6a Fixed bug.
Growth neutrality correction was applied twice.
2018-09-12 15:41:07 +02:00
Stéphane Adjemian(Charybdis) 0f3678ec4a Fixed ordering of variables in error correction term of PAC equation
PAC equation has to be written as

diff(x) = a0*(xstar(-1)-x(-1)) + a1*diff(x(-1)) + ... + ap*diff(x(-p)) + PAC_EXPECTATION(pacmodelname) + ...;

In the error correction term, a0*(xstar(-1)-x(-1)), we must have the difference
between the target (the trend xstar(-1)) and the level of the endogenous
variable (x(-1)). To ensure stability around the trend, the parameter a0 needs
to be positive.

REMARKS

 [1] In the TREND_COMPONENT_MODEL the error correction terms are written in
 reverse order, ie as the difference betwwen the level of the endogenous
 variable and the trend variable.

 [2] In the estimation routine we do not constrain a0 to be positive, but is
 would surely help to satisfy this condition in the initial condition.
2018-09-06 22:07:31 +02:00