# Expected value of a lognormal distribution

I wonder why I couldn't compute the expected value of this function:

ExpectedValue[b*x*(1 + ω*x^ρ)^κ, LogNormalDistribution[μ, σ], x]

• The documentation lists ExpectedValue as an outdated function. Try Expectation instead. – Sjoerd Smit Aug 31 '19 at 13:54
• Thanks I did but its the same. – Yoseph Getachew Aug 31 '19 at 14:25

The expression whose expectation you seek can be expanded as a power series in x. (You might need to worry about whether this converges).

expr = b*x*(1 + ω*x^ρ)^κ;
coeff = Assuming[κ > 0 && n >= 0,
SeriesCoefficient[expr /. x^ρ -> z, {z, 0, n}]];


We see that the power series converges to your original expression.

Sum[coeff x^(ρ n), {n, 0, ∞}] == expr
(* True *)


We can take the expectation of a general term in this series

expectation =
FullSimplify[
Expectation[coeff x^(ρ n),
x \[Distributed] LogNormalDistribution[μ, σ]]];


You can them sum the series to obtain the expectation.

Sum[expectation, {n, 0, ∞}] // InputForm
(* Sum[b*E^(((1 + n*ρ)*(2*μ + (1 + n*ρ)*σ^2))/2)*ω^n*Binomial[κ, n],
{n, 0, Infinity}] *)


Unfortunately, Mathematica doesn't return a simple expression for this sum, but you might find for the parameter values of interest it converges quite quickly.

The function is Expectation not ExpectedValue. Unfortunately,

Expectation[b*x*(1 + ω*x^ρ)^κ, x \[Distributed] LogNormalDistribution[μ, σ]]


If κ is an integer, it does appear to work:

Expectation[b*x*(1 + ω*x^ρ)^3, x \[Distributed] LogNormalDistribution[μ, σ]]
(* b E^(μ + σ^2/2) (1 + 3 E^(μ ρ + 1/2 ρ (2 + ρ) σ^2) ω +
3 E^(2 ρ (μ + (1 + ρ) σ^2)) ω^2 + E^(3/2 ρ (2 μ + (2 + 3 ρ) σ^2)) ω^3) *)

• Thanks Chris. But I I have κ as a parameter that could take any value both integer and non-integer. May be there are some alternative to compute that? – Yoseph Getachew Aug 31 '19 at 14:24
• If you don't need an explicit formula (which might be impossible to get), you can use NExpectation for numerical values of your parameters. – Chris K Aug 31 '19 at 14:31
• @YosephGetachew - Do you know any constraints on {b, ω, ρ, κ}? – Bob Hanlon Aug 31 '19 at 14:48
• I think that your expression might be written as a power series in x. You could then find the expectation of each term. Perhaps a small number of terms might be sufficient. – mikado Sep 1 '19 at 10:35
• @YosephGetachew - As a general rule, the more constraints there are on the parameters/variables, the easier it is to solve problems. Since you indicated that you did not want to constrain κ to be an integer, the alternative is to hope for constraints on the other parameters. If any exist (e.g., positive, nonnegative), then they should be provided to Mathematica to simplify the problem. – Bob Hanlon Sep 2 '19 at 14:52

I know you want the expectation for any positive value of $$\kappa$$ but here is the resulting expectation for integer values of $$\kappa$$:

mean[κ_, b_, μ_, σ_, ρ_, ω_] := b Exp[μ + σ^2/2] *
Sum[Binomial[κ, i] ω^i Exp[i ρ (μ + (1 + i ρ/2) σ^2)],
{i, 0, κ}]


For example,

mean[4, b, μ, σ, ρ, ω]


$$b e^{\mu +\frac{\sigma ^2}{2}} \left(\omega ^4 e^{4 \rho \left(\mu +(2 \rho +1) \sigma ^2\right)}+4 \omega ^3 e^{3 \rho \left(\mu +\left(\frac{3 \rho }{2}+1\right) \sigma ^2\right)}+6 \omega ^2 e^{2 \rho \left(\mu +(\rho +1) \sigma ^2\right)}+4 \omega e^{\rho \left(\mu +\left(\frac{\rho }{2}+1\right) \sigma ^2\right)}+1\right)$$

As a partial check on that formula:

d = TransformedDistribution[b*x*(1 + ω*x^ρ)^κ, x \[Distributed] LogNormalDistribution[μ, σ],
Assumptions -> {b > 0, w ∈ Reals, ρ > 0, κ >= 1}];
ExpandAll[mean[#, b, μ, σ, ρ, ω] - Mean[d /. κ -> #]] & /@ Range[6]
(* {0, 0, 0, 0, 0, 0} *)

• Thanks @JimB! But the parameter k is non-integer. The problem is that it only works when it is polynomial. I know I could get a solution for it if I can get a solution for Expectation[Log[1 + x], x [Distributed] LogNormalDistribution[[Mu], [Sigma]]]. – Yoseph Getachew Sep 3 '19 at 9:24
• You're very optimistic. Mathematica does not return a solution for Expectation[Log[1 + z], z \[Distributed] LogNormalDistribution[\[Mu], \[Sigma]], Assumptions -> \[Sigma] > 0] so I don't know why you think there would be a closed-form solution for your original random variable when $\kappa$ is not an integer. – JimB Sep 3 '19 at 12:53
• You are right. I think I have to do it numerically. But you give it a good try with your Taylor series expansion. Thanks. – Yoseph Getachew Sep 5 '19 at 6:30