How to integrate a shifted lognormal distributed random variable
Ältere Kommentare anzeigen
Dear all,
I'm quite new to Matlab and struggeling to integrate a continuous random variable by two parts. In the beginning I assume W=1+w is lognormally distributed with mean = 1 and standard deviation of 0.05. The mean is specifically chosen such that w has a zero mean and has a support of [-1, Inf). I tried to integrate a hard coded version of a lognormal density. This doesn't give me a useful result since log is not defined for -1 yet I tried the same procedure with W the result still doesn't make sense.
% Generating random variable W
W = lognrnd(0, 0.05, 1, 2000);
% Shifting W to have lognormal random variable w with zero mean and
% has a support of [-1, Inf)
w = W - 1;
% Transforming omega to s_w = a*w with a = 9.0083
s_w = 9.0083*w;
% My aim is now to integrate s_w from -1 to 0 and from 0 to Inf
% Since I can only integrate a continous random variable numerically I
% tried to hard code the density and use the integral function
%mu = mean(s_w);
%sigmasq = var(s_w);
%s_w = @(x) exp(-(log(x) - mu).^2./(2.*sigmasq)./(x.*sqrt(2.*pi.*sigmasq)));
%S_neg = integral(@(x)s_w(x), -1, 0);
%S_pos = integral(@(x)s_w(x), 0, Inf);
%d = -S_neg/S_pos;
% This does obviously not work because of the support of log yet I actually
% need to integrate
% Even my approach of tranforming W to s(W) doesn't work since both values
% are close to zero which they shouldn't be according to a density plot
s_W = 9.0083*W;
mu = mean(s_W);
sigmasq = var(s_W);
s_W = @(x) exp(-(log(x) - mu).^2./(2.*sigmasq)./(x.*sqrt(2.*pi.*sigmasq)));
S_neg = integral(@(x)s_W(x), (-1+mu), mu);
S_pos = integral(@(x)s_W(x), mu, Inf);
d = -S_neg/S_pos;
I hope I gave all the necessary information.
Akzeptierte Antwort
Weitere Antworten (1)
Matt J
am 26 Jul. 2018
0 Stimmen
Maybe you can explain the ulterior motive of this. The s_om that you've defined has the form of a non-shifted lognormal pdf, but w_s is a shifted/scaled lognormal. Are you sure you shouldn't be integrating the corresponding shifted/scaled pdf?
Incidentally also, the shifting w = W - 1 does not make w zero-mean. The mean of W as you've constructed it is exp(0+.05^2/2), so the mean of w will be exp(0+.05^2/2)-1.
3 Kommentare
Lukas Huppertz
am 26 Jul. 2018
Bearbeitet: Lukas Huppertz
am 26 Jul. 2018
Well, either you or the paper you're following has to have made a mathematical mistake in the problem formulation. As you've posed the problem now, the result is trivial:
S_neg = 0;
S_pos = 1;
This is because s_W is the pdf of a (non-shifted) lognormal distribution, so it's integral from 0 to Inf has to be 1 (lognormal variables are positive with probability 1). Likewise, any integral outside of this range has to be 0.
Lukas Huppertz
am 26 Jul. 2018
Kategorien
Mehr zu Lognormal Distribution finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

