Differences between revisions 2 and 3
Revision 2 as of 2009-06-23 13:57:01
Size: 2073
Editor: PabloWinant
Comment: Added two needed modifications
Revision 3 as of 2009-06-23 14:42:31
Size: 2090
Editor: PabloWinant
Comment:
Deletions are marked like this. Additions are marked like this.
Line 32: Line 32:
Currently, {{{g3|}}} is computed by :
 * g3 = sparse([],[],[],nrows,ncols,maxsize)
Currently, {{{g3}}} is computed by :
 * {{{g3 = sparse([],[],[],nrows,ncols,maxsize)}}}
Line 39: Line 39:
 * v3 = zeros(n_non_zero_elements, 3)  * {{{v3 = zeros(n_non_zero_elements, 3)}}}
Line 41: Line 41:
 * g3 = sparse(v3(1,:),v3(2,:),v3(3,:),nrows,ncols)  * {{{g3 = sparse(v3(1,:),v3(2,:),v3(3,:),nrows,ncols)}}}

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. Proposed syntax:

[key=value,key=value,...];
  • 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

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.

Initialize {{{g3}}}

Currently, g3 is computed by :

  • g3 = sparse([],[],[],nrows,ncols,maxsize)

  • each element is then written in g3

It is very time consuming.

Another method consists in defining a vector with non zero-content, then to expand it to a sparse matrix :

  • v3 = zeros(n_non_zero_elements, 3)

  • define kth non zero element with index (i,j) and value v by : v3(k,i,j) = v;

  • g3 = sparse(v3(1,:),v3(2,:),v3(3,:),nrows,ncols)

There is a patch and a test for it waiting for review.

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