Differences between revisions 4 and 5
Revision 4 as of 2009-08-26 13:36:25
Size: 1514
Comment:
Revision 5 as of 2009-08-31 17:33:37
Size: 2257
Editor: PabloWinant
Comment:
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
 * Add general labels to equations. Proposed syntax:  * Add general labels to equations. In the current prototype a list of key-values pair can be written in brackets before each equation :
Line 11: Line 11:
[key=value,key=value,...]; [key='value',key='value',...] y = y + 1;
Line 13: Line 13:
 * Internal representation in the preprocessor: a vector of pairs of two lists (list of keys, list of value)
 * Representation in Matlab: for each keyname, a cell array of values with as many entries as number of equations
One may want to attach values of any type to an equation. Currently, only strings of characters are recognized but we ask the user to specify users to enter quoted strings nevertheless. Type of keys should also be restricted so that they can be used as fields in matlab structures if needed, i.e. no numeric character, no space,...

 * Structure in the preprocessor is the same as in Matlab and mimics a database table : an array with 3 columns. It is stored in M_.equations_tags as in :
{{{
M_.equations_tags = {
    1 'name' 'First equation';
    2 'name' 'Second equation';
    2 'portfolio' 'true';
};
}}}
 * It is easy to query this table in matlab as follows
{{{
tags = M_.equations_tags;
tags(cell2mat(tags(:,1))==2,2:3) % all tags for equation 2
tags(strmatch('name',tags(:,2)),[1 3]) % a vector with equations numbers and associated names
}}}

Portfolio models

This page describes the changes and additions that are necessary to handle portfolio allocation problems in Dynare.

Preprocessor

To flag the portfolio equation in the modfile

  • Add general labels to equations. In the current prototype a list of key-values pair can be written in brackets before each equation :

[key='value',key='value',...] y = y + 1;

One may want to attach values of any type to an equation. Currently, only strings of characters are recognized but we ask the user to specify users to enter quoted strings nevertheless. Type of keys should also be restricted so that they can be used as fields in matlab structures if needed, i.e. no numeric character, no space,...

  • Structure in the preprocessor is the same as in Matlab and mimics a database table : an array with 3 columns. It is stored in M_.equations_tags as in :

M_.equations_tags = {
    1 'name' 'First equation';
    2 'name' 'Second equation';
    2 'portfolio' 'true';
};
  • It is easy to query this table in matlab as follows

tags = M_.equations_tags;
tags(cell2mat(tags(:,1))==2,2:3) % all tags for equation 2
tags(strmatch('name',tags(:,2)),[1 3]) % a vector with equations numbers and associated names

To trigger third order derivatives

Portfolios computations involve third order derivative when finding the steady state even if no simulation is to be made.

Currently, the preprocessor computes third derivatives ( g3 ) if order=3 option is passed to stoch_simul and the processing in matlab fails.

stoch_simul may eventually be modfied in order to allow for simulations with portfolios. In this case, it would not be the same as the so-called "third-order" approximation. For this reason, there should be another option somewhere triggering computations of g3

* One proposition : add an option to steady : (portfolios=true) which would imply (order=3)

* Another (cleaner) : differentiate runtime option order=... from preprocessing time option compute_order=...

* Currently : there is a patch that allows instruction steady(order=3) even if no stoch_simul instruction is present.

DynareWiki: PortfolioModels (last edited 2010-11-25 13:19:50 by PabloWinant)