4
$\begingroup$

I would like to solve an equation that looks like this

UPDATE

$E[(R^{1-\gamma})(r_k+\theta-r_z)]=0$ , where $R=\phi r_z+(1-\phi)(r_k+\theta)$ and $\phi\in[0,1]$,

$\theta$, is a random variable normaly distributed with zero mean, and some variance $\sigma^2$. Thus, the $E[.]$ stands for the expectation operator over this random variable.

An alternative version of the problem, solves a similar equation, but now $\theta$ is lognormally distributed.

The computational task, is to find $\phi$, such as the condition/equation above holds, for some given numbers/values for $r_z,r_k$ and $\gamma$ all of which are positive real numbers.

Can someone help on how I can calculate this, ideally in MATLAB ?

$\endgroup$
  • $\begingroup$ Welcome to SciComp.SE! What do you mean by "optimizing an equation"? How do you know such a $\phi$ even exists? $\endgroup$ – Christian Clason Oct 18 '14 at 11:53
  • $\begingroup$ This particular equation, comes from a first order condition of a maximization problem from a particular economic model. The nature of the problem and the theoretical foundations of the model, assure that a solution exist. I am interested on the computational task on how to solve this equation with respect to $\phi$, that's my main scope. I used the "optimize" in the sense that the $\phi$ has to satisfy this equation. $\endgroup$ – user17880 Oct 18 '14 at 12:09
  • $\begingroup$ I see; that usage is slightly misleading so I took the liberty of editing your question accordingly. If you don't agree, feel free to revert the edit. $\endgroup$ – Christian Clason Oct 18 '14 at 14:01
  • $\begingroup$ Not a problem at all. Thx for the effort anyway. $\endgroup$ – user17880 Oct 18 '14 at 14:18
5
$\begingroup$

Since $\phi$ is a scalar between $0$ and $1$, the easiest method for finding a root is bisection. If you cannot calculate the expectation of the nonlinear function $$f_\phi(\theta) = \left(\phi r_z +(1-\phi)(r_k+\theta)\right)^{1-\gamma}(r_k+\theta-r_z)$$ in terms of $\phi$ analytically, you can use quadrature to approximate. For the first variant, this amounts to $$E[f_\phi(\theta)] = \frac{1}{\sigma\sqrt{2\pi}}\int_{-\infty}^{\infty} e^{-\frac{t^2}{2\sigma^2}} f_\phi(t)\,dt \approx \sum_{i=1}^N \frac{w_i}{\sqrt{\pi}} f_\phi(\sqrt2 \sigma t_i),$$ where $t_i$ and $w_i$ are the Gauss-Hermite quadrature nodes and weights of order $N$. If $\theta$ is log-normally distributed, then $\theta=e^\beta$, where $\beta$ is normally distributed, so you can just replace $t_i$ by $s_i:=e^{t_i}$ in the above to get a quadrature rule (with the same weights) for the log-normal variant.

This procedure is straightforward to implement in Matlab; you can download functions to calculate the quadrature weights and nodes here or here.

$\endgroup$
  • $\begingroup$ Thank you very much. I think I got the main point, but I make a slight mistake in my equation. Can you please check my update. The only modification is that rk is a function of the random variable. And there are two variants of the problem. $\endgroup$ – user17880 Oct 18 '14 at 15:05
  • $\begingroup$ One clarifications, by $R_{\phi}(\sqrt(2)\sigma t_i)$ you mean that $R_{\phi}$ is a function of the term or it multiplies the term ? I understood the second. Second, why we do not also multiply with the $\sqrt(2)\sigma t_{i}$ since the expection that i want to estimate it multiplies the nonlinear function with the random variable. $\endgroup$ – user17880 Oct 18 '14 at 18:26
  • $\begingroup$ Thanks for the clarification. But something that cannot understand then, since I have to approximate $E[R^{1-\gamma}\theta]$. Using your notation, this shouldn't be $$E[R_\phi(\theta)*\theta] = \frac{1}{\sigma\sqrt{2\pi}}\int_{-\infty}^{\infty} e^{-\frac{t^2}{2\sigma^2}} R_\phi(t)\,dt \approx \sum_{i=1}^N \frac{w_i}{\sqrt{\pi}} R_\phi(\sqrt2 \sigma t_i)*\sqrt2 \sigma t_i,$$ ? since theta also multiplies the $R^{1-\gamma}$. Is something that I am missing? $\endgroup$ – user17880 Oct 19 '14 at 12:17
  • $\begingroup$ Maybe you wish to ignore my last, I thought you defined $R_{\phi}$ in the way I defined $R$ $\endgroup$ – user17880 Oct 19 '14 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.