# Taking "within period" expectations

Hi,

My understanding is that Dynare interprets all variables with t subscript as being known at time t. Is it possible to treat a time t exogenous shock as unknown, so that one can take expectations over an expression that contains this shock? The shock variable is iid over time. I bet this is very unclear, so here is my specific problem:

Imagine that within each period, a firm faces a two-stage price-setting problem. First, it has to choose how much information to acquire about some relevant variable (i.e. a demand shifter), and then based on this information it has to set the price that maximizes expected profit. Information acquisition means observing a noisy signal of the true state. Both the true state and the noise shock is iid, so the signal itself is iid over time. The firm solves the problem backwards: First, for a given signal it finds the price that maximizes expected profit. At this stage, I want my time t signal variable (true state+noise shock) to be known. Second, the firm chooses the signal precision that maximizes ex ante expected profit taking into account the pricing rule derived in step 1. In the optimality condition for this decision, I want to take expectations over possible signals (which include the time t noise shock). Is there a way to achieve something like this in Dynare?

I am not sure I was able to explain it clearly, but please let me know if further clarification would help answer the question.

Thanks a lot.

Unfortunately, I also don’t know the answer. Dynare usually can only handle time-invariant problems and yours does sound time-variant. You could maybe use auxiliary variables like in the case of Epstein-Zin preferences. But the bigger problem is typically how to implement the signal-extraction part itself as there is often not a closed-form solution available. The only case like this with Dynare I know is the Blanchard, L’Huillier, Lorenzoni AER paper (code at the AER homepage). Here, the solution to the signal extraction is basically solved using the Kalman filter in the steady state file and then provided to Dynare so that the within period expectation part does not appear to Dynare.

Johannes,

thanks for your reply! You helped understand my problem much better – as you always do.

I still think my problem is time-invariant, because both the true state and the signal noise is iid over time in my model (at least in the current version). So there is no complicated Kalman-filtering; the signal extraction part is not that hard for a given signal precision, and I can do it by hand. The only problem is that once I have the solution to the signal extraction, I want to take expected value of the objective so that I can choose the optimal precision. It seems to me that the following can work: since the signal, s(t) is iid, I can just use s(t+1) whenever I want to take ex ante expectations of an expression which contains the signal. So when I solve for the optimal pricing rule, I use s(t) in the equations (since price setting takes place after observing the signal), but when I write the optimality condition for the choice of signal precision, I use s(t+1). This way Dynare will “see it” as a random variable with exactly the same distribution that I want (because of the iid assumption.) Does this make sense?

Sounds good and correct to me.