# Differentiating a conditional expectation: RBC models with uncertainty

Is the following true? $$\frac{\partial}{\partial X_{t+1}}E_t(f(X_{t+1}))=E_t(\frac{\partial}{\partial X_{t+1}}f(X_{t+1}))\tag{1}$$ where $f$ is some affine function (e.g., $f(x)=a+bx$), $E_t(X_s)=E(X_s|I_t)$ denotes the conditional expectation of $X_s$ given information $I_t$ in time period $t$, and where $X_s$ denotes the value of some variable $X$, say financial asset holdings, in time period $s$, such that $X_s$ is unknown (i.e., stochastic) given information at time periods $0\leq t<s$ but known otherwise.

Edit 3: I think we should view $X_{t+1}$ as a function of information in time period $t$, i.e. $X_{t+1}=X_{t+1}(I_t)$. This hinders $(1)$ from being zero (see Alecos' comment below). If this is the right way to look at the problem (see "Edit 2" below; I do not know how to look at the problem, that's why I'm asking!) then $(1)$ may be written in detail as $$\frac{\partial}{\partial X_{t+1}}E(f(X_{t+1}(I_t))|I_t)=E(\frac{\partial}{\partial X_{t+1}}f(X_{t+1}(I_t))|I_t).\tag{1'}$$

I often notice that $(1)$ (or $(1')$) seems to be used when studying real business cycle models with uncertainty where the Lagrange method is applied (this framwork is outlined in e.g. Gregory C. Chow's Dynamic Economics: Optimization by the Lagrange Method).

For example, we may have a situation where we have to differentiate $$-\lambda_t A_{t+1}+E_t(\lambda_{t+1}(1+r_t)A_{t+1})+\Phi\tag{2}$$ w.r.t. financial asset holdings $A_{t+1}$ in time period $t+1$, where $\lambda_t,\lambda_{t+1}\geq 0$, $r_t\in\mathbb{R}$ and $\Phi$ are independent of $A_{t+1}$ (i.e., they are not functions of $A_{t+1}$), and seem to use $(1)$ to arrive at the conclusion that the partial derivative of $(2)$ w.r.t. $A_{t+1}$ is $$-\lambda_t+E_t(\lambda_{t+1}(1+r_t)).\tag{3}$$

I neither understand if $(1)$ is used to justify the implication from $(2)$ to $(3)$, nor if $(1)$ is true, within the framework mentioned in the parenthesis above, but know of other treatments which begin by discussing measure theory and stochastic processes (e.g., Lecture notes for Macroeconomics I: Chapter 6), and then deriving similar, but not exactly analogous, first order conditions to that derived by using fact $(1)$ and the Lagrange method.

Edit 1: I was asked to post a reference. The reference is lecture notes written by my lecturer. It says the following. If we have a representativve household's maximization problem $$\max_{\{C_t,A_{t+1}\}_{t=0}^{\infty}}E_0\sum_{t=0}^{\infty}\beta^tu(C_t)$$ subject to the budget constraint $$C_t+A_{t+1}=Y_t+(1+r)A_t,\quad\forall t\in\mathbb{Z}_{\geq 0},$$ then we want to investigate the first order conditions for the Lagrangian$$\mathcal{L}=E_0\left[\sum_{t=0}^{\infty}\beta^tu(C_t)+\sum_{t=0}^{\infty}\lambda_t[Y_t+(1+r)A_t-C_t-A_{t+1}]\right].\tag{4}$$ One first order condition is the partial derivative of $\mathcal{L}$ w.r.t. $A_{t+1}$: $$-\lambda_t+E_t[\lambda_{t+1}(1+r)].$$ (To be exact he writes that the above is a first order condition for the Lagrangian $\mathcal{L}$. I've interpreted that as meaning that he partially differentiates $\mathcal{L}$ w.r.t. $A_{t+1}$.) My question is then: Why is that true?

Edit 2: I've also used the following reference: Chapter 5. Real Business Cycles. See equation $(5.7)$. How does the author derive that equation? Does he differentiate inside the conditional expectations, as expressed by me in $(1)$?

Edit 4: To be more exact, $I_t$ may capture the value of e.g. output $Y_t$ (compare with the budget constraint above).

• Can you please provide some references? Because as it stands the argument is wrong in the following sense : the function "conditional expectation" $E(X \mid Y) = g(Y)$ and so differentiating with respect to $X$ gives zero. – Alecos Papadopoulos Nov 19 '16 at 22:29
• @AlecosPapadopoulos Thanks for the comment! I've edited my question. You are correct: $E(X|Y)$ is a function of $Y$ and so its partial derivative w.r.t. $X$ is zero. That's why I guess I'm missing something important. – Elias Nov 20 '16 at 10:53

As I noted in a comment, to consider non-trivially a derivative, we must have a non-constant function in the first place. So, in generic terms, we are looking at the conditional expectation function $E(X\mid Z)$ and not at the conditional expected value of $X$ given a specific value $Z= z$.

Then, $E(X\mid Z)=g(Z)$, i.e. it is a function of $Z$ only, not of $X$, so it appears that its derivative with respect to $X$ should be zero.

But: the way the problem is formulated, we treat the $X$, ($A_{t+1}$ in the OP's example), as a decision variable. Namely as a variable for which we can choose the value that it takes. But this conflicts with the fundamental characteristic of a random variable, i.e. that it is not under our control and its actual realization is unknown. By treating it as a decision/command variable, we effectively neutralize any aspect related to a random variable, the conditional expectation aspect in our case. And it is in that sense that we can consider the derivative "ignoring" the existence of the conditional expectation operator.

Note that, for the problem laid out at the end of OP's question, if income $Y_t$ is known at the time of the decision for current consumption, then $A_{t+1}$ is also completely determined, there is nothing random/unknown/uncertain about it. This then allows, in a Lagrangian formulation, to treat $A_{t+1}$ also as a decision variable and consider derivatives with respect to it.

• Okay, mathematically, you mean that given information in time period $t$, which includes information on $C_t$ and $Y_t$, we have that $E_t(A_{t+1})=A_{t+1}$ as determined by the budget constraint in "Edit 1" and that we because of that fact have e.g. $E_t(\lambda_{t+1}(1+r)A_{t+1})=A_{t+1}E_t(\lambda_{t+1}(1+r))$ and then may take the derivative w.r.t. $A_{t+1}$? This seems to be the right answer. – Elias Nov 20 '16 at 12:32
• @MB1992 Yes this is how this can be dealt with. – Alecos Papadopoulos Nov 20 '16 at 12:34
• Okay! Then, intuitively, the budget constraint is unrealistic. Why would $A_{t+1}$ be determined given information in time period $t$? But mathematically, we just have to be sure that $A_{t+1}$ is determined by information in time period $t$. In some sense, this seems to assume something similar to the rational expectations theory that all households make their forecasts given all available information and their past experiences. – Elias Nov 20 '16 at 12:39
• @MB1992 Because of our assumptions: the only thing random here is presumably current income $Y_t$. Since we assume no other source of randomness, then once $Y_t$ is realized, by deciding consumption we also decide next period's beginning wealth. We do not assume any other random shock that we do not know of, and affecting directly assets – Alecos Papadopoulos Nov 20 '16 at 12:42
• Yes, I understood that (question was rhetorical, sorry)! I guess the problem has to be treated differently if random shocks enter the model. – Elias Nov 20 '16 at 12:50