I am an undergraduate student currently exploring DSGE models in my free time. I am particularly interested in understanding how DSGE models can be used to regularize data-driven predictions.

As a personal project, I am trying to compare the slopes obtained from data-driven models with those predicted by DSGE models. Specifically, I am focusing on slopes relative to forecasted inflation. These slopes represent how changes in current variables (like output and interest rates) impact the expected future inflation. In data-driven models, such as neural networks used for forecasting, these slopes are essentially the gradients that indicate the sensitivity of the forecasted variable (inflation) to changes in the input variables.

Here are my main questions:

Calculating Slopes in Dynare: How can I calculate the slopes of variables with respect to forecasted inflation using Dynare? I am aware that solving a DSGE model in Dynare provides policy functions, but I am not entirely sure how to extract these specific slopes. Any step-by-step guidance or examples would be greatly appreciated.

Soundness of Approach: Is comparing data-driven slopes to those predicted by DSGE models a sound approach in the context of DSGEs? I aim to understand if this method is theoretically valid and if it can provide meaningful insights.

Resources and References: Can you recommend any resources or references that might help me better understand this process? I am looking for both theoretical background and practical guides, especially those that are accessible to someone relatively new to this field.

I am considering using a hybrid loss function that combines a standard data-driven metric (e.g., MSE) with a DSGE-based metric (e.g., the difference between the slopes found in the neural network and the slopes predicted by the DSGE model, or other relationships I could derive from the DSGEs).

Are there other pieces of information I could incorporate as part of my loss function? Could I somehow differentiate these DSGEs to find the relationship between the slopes of these variables? (if that makes any sense)

I am no expert in this area, but it sounds a bit like you want to use a structural DSGE model to determine non-structural relationships. I donâ€™t really understand what the point of this would be. The strength of the DSGE model is to provide structural/causal relations.

Of course, you could to indirect inference by simulating data from the DSGE and then estimate the slope using the neural network.

Let me walk you through why I thought this could be a good idea: In physics, Physics-Informed Neural Networks (PiNNs) are used to integrate physical laws into neural networks. There are many ways to do so, but the easiest approach is through a hybrid loss functions (i.e., penalizes data-driven predictions that deviate too much from theory). Similarly, in economics, DSGE models provide valuable causal/theoretical insights (but I do acknowledge that although DSGE models are grounded in theory, they are models rather than absolute laws like in physics). My idea is to use DSGE-derived information to regularize the neural network (through a hybrid loss function). I am hoping that, at least under certain conditions, those theoretical insights allow the model to make predictions that are not counterintuitive (based on economics principles that have been established and are represented through DSGEs) and perhaps more accurate. Do you think this approach/rationale makes sense? Or is there something I am not considering?