Truncated mean for truncated gaussian distribution

5 visualizaciones (últimos 30 días)
Ita Atz
Ita Atz el 26 de Abr. de 2012
Hello,
Is there any way to write the function
G(x) = int_{-inf}^{x} z * pdf(z) dz
where pdf(z) is a normal distribution with mean mu and std sigma (perhaps some way involving erf or erfc)? Note that G(inf) = mu.
Thanks in advance.
Ita

Respuestas (1)

Tom Lane
Tom Lane el 27 de Abr. de 2012
Consider using the Symbolic Toolbox, if you have it:
>> syms x z
>> pi = sym('pi');
>> zmean = int(x*exp(-x^2/2)/sqrt(2*pi),-Inf,z)/int(exp(-x^2/2)/sqrt(2*pi),-Inf,z)
zmean =
-2^(1/2)/(2*pi^(1/2)*exp(z^2/2)*(erf((2^(1/2)*z)/2)/2 + 1/2))
>> subs(zmean,1.5)
ans =
-0.1388
>> t = randn(1e6,1); mean(t(t<1.5))
ans =
-0.1376
>> t = randn(1e6,1); mean(t(t<1.5))
ans =
-0.1383
>> t = randn(1e6,1); mean(t(t<1.5))
ans =
-0.1399

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by