Commit f94d4e91 by MichelJuillard

### allowing for vector of deterministic shocks

parent 0a3545f2
 ... ... @@ -2070,9 +2070,10 @@ It is possible to specify shocks which last several periods and which can vary over time. The @code{periods} keyword accepts a list of several dates or date ranges, which must be matched by as many shock values in the @code{values} keyword. Note that a range in the @code{periods} keyword must be matched by only one value in the @code{values} keyword: this syntax means that the exogenous variable will have a constant value over the range. @code{periods} keyword can be matched by only one value in the @code{values} keyword. If @code{values} represents a scalar, the same value applies to the whole range. If @code{values} represents a vector, it must have as many elements as there are periods in the range. Note that shock values are not restricted to numerical constants: arbitrary expressions are also allowed, but you have to enclose them ... ... @@ -2097,6 +2098,18 @@ values (1+p) (exp(z)); end; @end example A second example with a vector of values: @example xx = [1.2; 1.3; 1]; shocks; var e; periods 1:3; values (xx); end; @end example @customhead{In stochastic context} For stochastic simulations, the @code{shocks} block specifies the non ... ...
 ... ... @@ -48,11 +48,19 @@ end switch flag case 0 oo_.exo_simul(k,ivar) = repmat(values,length(k),1); if size(values,1) == 1 oo_.exo_simul(k,ivar) = repmat(values,length(k),1); else oo_.exo_simul(k,ivar) = values; end case 1 oo_.exo_simul(k,ivar) = oo_.exo_simul(k,ivar).*values; case 2 oo_.exo_det_simul(k,ivar) = repmat(values,length(k),1); if size(values,1) == 1 oo_.exo_det_simul(k,ivar) = repmat(values,length(k),1); else oo_.exo_det_simul(k,ivar) = values; end case 3 oo_.exo_det_simul(k,ivar) = oo_.exo_det_simul(k,ivar).*values; end ... ...
 var c k; varexo x; parameters alph gam delt bet aa; alph=0.5; gam=0.5; delt=0.02; bet=0.05; aa=0.5; model; c + k - aa*x*k(-1)^alph - (1-delt)*k(-1); c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam); end; initval; x = 1; k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1)); c = aa*k^alph-delt*k; end; steady; check; a=[1.2; 1.1]; shocks; var x; periods 1:2; values (a); end; simul(periods=200); rplot c; rplot k;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!