Conditional expectation

I am interested in getting an estimate of the conditional expectation of a few endogenous variables of my estimated DSGE model. As I understand, this basically means obtaining the best in sample prediction of the relevant variable using the model and observable. Can I use the Kalman smoothed series of the relevant endogenous variables as a proxy for the conditional expectation of my endogenous variables of interest?

Could you please specify which type of conditional expectation you want? From the perspective of the agents in the model? Or from the econometrician’s perspective who does not observe the relevant states of the model.

It is a model based variable not from econometrician’s perspective. I want to get the in sample prediction of a risk premium variable.

To make it more clear, I am interested in generating a model based series for the conditional equity premium. It is a function of all the state variables, I can see it in the policy transition function. I want to get an estimated series for it. Is Kalman smoothed series a way to go? I can do it then easily.

The mod-file at
does this