1

I am trying to compute the following expected value for Z being lognormally distributed

E[Z^eta w(F_Z (Z))^-eta]

where eta is a real number, F_Z the distribution function of Z and w:[0,1]->[0,1] an increasing function.

First of all, I am pretty new to Matlab so I don't know which way of integrating is the better one, numerically or symbolically. I tried symbolically.

My idea was to subsequently define functions:

syms x;
g_1(x) = x^eta;
g_2(x) = logncdf(x);
g_2(x) = w(x)^-eta;
g_4(x) = g_1(x) * g_3(g_2(x));

And then

exp = int(g_4(x),x,0,inf)

Unfortunately this doesn't work and MATLAB just posts the whole expression of g_4...

Is it better to use the numerical integration quadqk? What am I doing wrong here? I already read something about MATLAB not being the best program for integration but I have to use it so switching to a different program does not help.

Thanks a lot!

Tim
  • 11
  • 1
  • Are you looking for the (integrated) formula, or do you have numbers/data which have to be computed? – Andreas Gnyp Jul 15 '14 at 14:48
  • Why not use Monte Carlo? Generate millions of values of `Z` and compute your expression with sample mean (`mean`) instead of E[...] – Luis Mendo Jul 15 '14 at 15:02
  • You have `g_2(x)` defined twice and no `g_3(x)`. I assume this is a typo, but check that it is not a typo in your actual code. – Engineero Jul 15 '14 at 15:26
  • Engineero, no typo in the code, thanks though. AndreasGnyp: Actually I am looking for the integrated formula. LuisMendo: I assume that this is the way, experienced MATLAB users would do it? Hmmmm.. I'll give it a shot. – Tim Jul 16 '14 at 08:26

0 Answers0