Hello everyone!
I want to simulate the dynamic path of economic recovery to the initial steady state after a disaster occurs. Everyone knows that a disaster will happen, but they don’t know when. When a one-time disaster occurs, the variable values in the model will suddenly deviate from the steady state, and we assume that the disaster has no lasting effects, so the economy will gradually recover to the initial steady state. This sounds similar to impulse response, but I’m not sure if it’s the same. Should I use stochastic simulation or deterministic simulation?
Thanks in advance!

Here are my two current attempts.

Attempt1:

//define endogenous variable
var y c k i
//define exogenous variable
Varexo e
//define parameters
parameters
......;
//equilibrium conditions
Model;
model;
y = k^alpha * (1-z);
k(+1) = (1 - delta) * k + i;
c + i = y;
c = beta * (y - delta * k);
end;
initval;
k = 10;
c = 2;
i = 0.75 * c;
z = 0;
end;
shocks;
var z = 0.5^2;
end;
stoch_simul(order=3, periods=1000, irf=40,nograph);

Attempt 2:

//define endogenous variable
var y c k i
//define exogenous variable
Varexo e
//define parameters
parameters
......;
//equilibrium conditions
Model;
model;
y = k^alpha * (1-z);
k(+1) = (1 - delta) * k + i;
c + i = y;
c = beta * (y - delta * k);
end;
initval;
k = 10;
c = 2;
i = 0.75 * c;
z = 0;
end;
shocks;
var z;
periods 1;
values 0.5;
end;
perfect_foresight_setup(periods = 30);
perfect_foresight_solver;

For a surprise shock, there is no difference between stochastic simulations at first order and perfect foresight ones if the model is linear. You need to decide which properties of the two simulation types you are interested in. Do you need stochastics? Do you want full nonlinearity?

Thank you for your response, Professor!
However, I still don’t quite understand why you said the results of perfect foresight simulations and the impulse response in stochastic simulations are the same for unanticipated shocks. In perfect foresight simulations, agents clearly know that no shocks will occur at any future time except for the current unanticipated shock. In contrast, in the impulse response of stochastic simulations, although the shock only occurs once, agents always expect future shocks to occur.
In other words, although they are subject to the same shock in the current period, their expectations for the future are different. It can also be said that their information sets are different.
I look forward to your explanation, Professor!

Hello Professor, here I am againnnnnn!
Since the equilibrium conditions of the model are highly nonlinear stochastic difference equations, it is generally impossible to directly solve this system to obtain policy functions. We can use a first-order perturbation algorithm, linearizing the system around its steady state and solving this linear stochastic difference equation to get a first-order approximation of the policy functions for the original system.

Intuitively, since the first-order perturbation algorithm removes all nonlinear terms, the expected value of all stochastic terms is zero, resulting in the certainty equivalence problem. This means that the decision rules derived from solving the linear stochastic difference equation are the same as those from the corresponding deterministic difference equation.

Now, let’s address why there is a certainty equivalence issue between perfect foresight simulation and first-order stochastic simulation in Dynare. My personal understanding is that when we perform perfect foresight simulation, we use the classical Newton algorithm, which involves linearizing the system and then simulating the path.

In summary, for a nonlinear stochastic difference equation system, due to certainty equivalence, the solution to its first-order linear approximation stochastic difference equation (1) is equivalent to the solution to the first-order linear deterministic difference equation (2). Moreover, since perfect foresight simulation defaults to the first-order Newton method, the simulated path for an unanticipated shock is the same as (2). Since (2) is equivalent to (1), in Dynare, for an unanticipated shock, first-order stochastic simulation and perfect foresight simulation are equivalent. Is my understanding correct?

If so, according to my understanding, can I say:

If a higher-order Newton method is used, perfect foresight simulation will not be equivalent to first-order stochastic simulation?

For anticipated shocks, even in the first-order sense, perfect foresight simulation and first-order stochastic simulation are not equivalent?

A perfect foresight problem is by construction always deterministic. Hence, if you have a linear model, both approaches will be solving a linear deterministic difference equation. Of course their solution will coincide.