<p>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 <em>function</em> $E(X\mid Z)$ and not at the conditional expected value of $X$ given a specific value $Z=  z$. </p>

<p>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.  </p>

<p><strong>But:</strong> the way the problem is formulated, we treat the $X$, ($A_{t+1}$ in the OP's example), <em>as a decision variable</em>. Namely as a variable for which we can <em>choose</em> 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. </p>

<p>Note that, for the problem laid out at the end of OP's question, <em>if</em> 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.</p>

CC BY-SA 3.0
2016-11-20T12:32:51.903Z
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
CC BY-SA 3.0
2016-11-20T12:34:14.660Z
@MB1992 Yes this is how this can be dealt with.
Alecos Papadopoulos
CC BY-SA 3.0
2016-11-20T12:39:55.877Z
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
CC BY-SA 3.0
2016-11-20T12:42:09.570Z
@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
CC BY-SA 3.0
2016-11-20T12:50:21.423Z
Yes, I understood that (question was rhetorical, sorry)! I guess the problem has to be treated differently if random shocks enter the model.
Elias
CC BY-SA 3.0
2016-11-20T15:36:58.483Z
I do not feel that my question is satisfactorily answered though. In this case, the derivative of the expectation was not 0 as $A_{t+1}$ was determined by $I_t$. Hence, I am still wondering about $(1')$ in my original question.
Elias
CC BY-SA 3.0
2016-11-20T15:40:16.200Z
@MB1992 But it is since, what's there to wonder about $(1')$ since by standard properties, $E(f(X_{t+1}(I_t))|I_t) = f(X_{t+1}(I_t))$?
Alecos Papadopoulos
CC BY-SA 3.0
2016-11-20T20:27:30.760Z
Yes, I understand that. I was just thinking of the fact that if $X_{t+1}$ is completely determined by $I_t$, then you cannot treat it as a variable, for it would mean changing the information $I_t$. In this case, given $Y_t, A_t, C_t$ and $r$, $A_{t+1}=Y_t+(1+r)A_t-C_t$. Hence, given $I_t$, $X_{t+1}$ is completely determined. In what way, then, is the derivative w.r.t. $X_{t+1}$ meaningful if the information at time $t$, that is $I_t$, is unchanged? Somehow we seem to differentiate a functional $X_{t+1}(I_t)$ here.
Elias
CC BY-SA 3.0
2016-11-20T20:29:52.070Z
@MB1992 If $X_{t+1}$ is treated as a command variable, it cannot be "completely determined" by $I_t$ now, can it?
Alecos Papadopoulos
CC BY-SA 3.0
2016-11-20T20:32:48.020Z
Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/48853/discussion-between-mb1992-and-alecos-papadopoulos).
Elias
CC BY-SA 3.0
2016-11-20T12:19:29.090Z
2016-11-20T12:19:29.090Z
Alecos Papadopoulos
<p>Is the following true? \begin{equation}\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}\end{equation} 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&lt;s$ but known otherwise.</p>

<p>Edit 3: I <em>think</em> 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 \begin{equation}\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'}\end{equation}</p>

<p>I often notice that $(1)$ (or $(1')$) <em>seems</em> 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 <em>Dynamic Economics: Optimization by the Lagrange Method</em>). </p>

<p>For example, we may have a situation where we have to differentiate \begin{equation}-\lambda_t A_{t+1}+E_t(\lambda_{t+1}(1+r_t)A_{t+1})+\Phi\tag{2}\end{equation} 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 <em>seem</em> to use $(1)$ to arrive at the conclusion that the partial derivative of $(2)$ w.r.t. $A_{t+1}$ is \begin{equation}-\lambda_t+E_t(\lambda_{t+1}(1+r_t)).\tag{3}\end{equation}  </p>

<p>I neither understand <em>if</em> $(1)$ is used to justify the implication from $(2)$ to $(3)$, nor <em>if</em> $(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., <a href="http://www.econ.yale.edu/smith/econ510a/book.pdf" rel="nofollow noreferrer">Lecture notes for Macroeconomics I: Chapter 6</a>), and then deriving similar, but not exactly analogous, first order conditions to that derived by using fact $(1)$ and the Lagrange method. </p>

<p>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\begin{equation}\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}\end{equation} 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?</p>

<p>Edit 2: I've also used the following reference: <a href="http://www.sfu.ca/~bkrauth/econ808/808_lec5.pdf" rel="nofollow noreferrer">Chapter 5. Real Business Cycles</a>. See equation $(5.7)$. How does the author derive that equation? Does he differentiate inside the conditional expectations, as expressed by me in $(1)$?</p>

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

CC BY-SA 3.0
2016-11-19T22:29:04.553Z
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
CC BY-SA 3.0
2016-11-20T10:53:37.623Z
@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
<macroeconomics><mathematical-economics>
Differentiating a conditional expectation: RBC models with uncertainty
Elias
# Differentiating a conditional expectation: RBC models with uncertainty

(Asked by: username_0 on 2016-11-19)

Is the following true? \begin{equation}\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}\end{equation} 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

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 \begin{equation}\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'}\end{equation}

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 \begin{equation}-\lambda\_t A\_{t+1}+E\_t(\lambda\_{t+1}(1+r\_t)A\_{t+1})+\Phi\tag{2}\end{equation} 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 \begin{equation}-\lambda\_t+E\_t(\lambda\_{t+1}(1+r\_t)).\tag{3}\end{equation}

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](http://www.econ.yale.edu/smith/econ510a/book.pdf)), 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\begin{equation}\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}\end{equation} 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](http://www.sfu.ca/~bkrauth/econ808/808_lec5.pdf). 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).

**Tags:** macroeconomics, mathematical-economics
> **Comments:**
> **username_1**: 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.  
> **username_0**: @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.  

---

## 1 answers

### Answer by username_1 on 2016-11-20. Score: 5 | Accepted answer

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.

> **Comments:**
> **username_0**: 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.  
> **username_1**: @MB1992 Yes this is how this can be dealt with.  
> **username_0**: 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.  
> **username_1**: @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  
> **username_0**: Yes, I understood that (question was rhetorical, sorry)! I guess the problem has to be treated differently if random shocks enter the model.  
> **username_0**: I do not feel that my question is satisfactorily answered though. In this case, the derivative of the expectation was not 0 as $A_{t+1}$ was determined by $I_t$. Hence, I am still wondering about $(1')$ in my original question.  
> **username_1**: @MB1992 But it is since, what's there to wonder about $(1')$ since by standard properties, $E(f(X_{t+1}(I_t))|I_t) = f(X_{t+1}(I_t))$?  
> **username_0**: Yes, I understand that. I was just thinking of the fact that if $X_{t+1}$ is completely determined by $I_t$, then you cannot treat it as a variable, for it would mean changing the information $I_t$. In this case, given $Y_t, A_t, C_t$ and $r$, $A_{t+1}=Y_t+(1+r)A_t-C_t$. Hence, given $I_t$, $X_{t+1}$ is completely determined. In what way, then, is the derivative w.r.t. $X_{t+1}$ meaningful if the information at time $t$, that is $I_t$, is unchanged? Somehow we seem to differentiate a functional $X_{t+1}(I_t)$ here.  
> **username_1**: @MB1992 If $X_{t+1}$ is treated as a command variable, it cannot be "completely determined" by $I_t$ now, can it?  
> **username_0**: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/48853/discussion-between-mb1992-and-alecos-papadopoulos).  

---

