Model generated data with exogenous series

I want to solve a model with a given exogenous variable instead of stochastic shock, for instance, a standard RBC model with tfp observed for t periods(tfp = a1, a2, a3, … aT). Providing the observed tfp series and the initial capital stock and structure parameters, I want to generated some artificial data over consumption, capital and gnp based on the model. How could I achieve this? Thanks!

Maybe this will help. It talks about deterministic (perfect foresight).

Some nice guides also here: https://sebastien.villemot.name/pdf/talks/2018/deterministic.pdf

The question is whether the TFP series is known in advance or whether agents experience the shows as a surprise. If the shocks are a surprise, you would use the simult_-function to generate simulations. See e.g. DSGE_mod/RBC_news_shock_model.mod at master · JohannesPfeifer/DSGE_mod · GitHub

Thank you very much! Your advice and reference help me a lot!!

You are right professor and your words let me think about the data generating process in the real economy. Although the series of history TFP is known to us researchers nowadays, for agent in economy at any time only known about the data before that point and they just maximized their expected return or utility under the assumption of rational expectation using available information at that time. It is a mistake to simulate the model in the view of perfect foresight albeit we know the information ex post. So your suggestion is that I can use simult_ function to do the work? Ordinary simulation command will simulate a model by sampling from a given distribution, normal distribution for example, and the result of which will be the same if the sampling data are coincide with the shock ex post. Is that right professor? Thank you very much for helping me !!

Yes, Dynare internally relies on this function to simulate the model with random shocks, but you can use it to simulate with given shocks.

Thank you very much professor! Your really helps me a lot!!