Integration of the expected value

조회 수: 10(최근 30일)
Yuriy
Yuriy 2022년 8월 2일
편집: Yuriy 2022년 8월 8일
Dear community!
I have an interval and an expected price which is laying on this interval. b is a constant.
I want to find all possible values of expected profit function which is expressed as and plot it.
is a c.d.f. of uniformly distrtubited density function .
Integrating by parts the expected price can be re-written as: . So, I am trying to write the following code, which doesn't work:, please see below. Any help will be highly apprerciated!
b = 1;
p = (0:0.01:b);
p_e = (p:0.01:b);
pd1 = makedist('Uniform','lower',p,'upper',b);
G = @(p) p + p * cdf - int((cdf), p, p, b);
y=G(p);
plot(p,y)
xlim([0 1])
ylim([0 +inf])
leg = legend('Expected profit','AutoUpdate','off');
title(leg,'Expected profit')
xlabel('Price')
ylabel('Expected Profit')
% put the grid on top of the colored area
set(gca, 'Layer', 'top')
grid on

채택된 답변

Torsten
Torsten 2022년 8월 2일
편집: Torsten 2022년 8월 3일
b = 1;
N = 2000000;
for i = 1:N
p(i) = b*rand;
pe(i) = p(i) + (b-p(i))*rand;
p2(i) = p(i) + pe(i);
end
ecdf(pe)
mean(p)
ans = 0.5000
mean(pe)
ans = 0.7499
mean(p2)
ans = 1.2499
  댓글 수: 6
Yuriy
Yuriy 2022년 8월 8일
편집: Yuriy 2022년 8월 8일
Great, thanks! Not sure if this answers my question, but I mark it because looks like it is the closest. Thank you! I think I need to reformulate my question. I need to draw 2 random variables p1 and p2 such that p1 is not equal to p2. And then my expecteds profit will be (p1 + p2) or (p1 + b) depends on which is greater (dominating). I will try to plot it too right now, but any help will be much appreciated becasue I am new to this and my learning curve is not the greatest, unfortunately.

댓글을 달려면 로그인하십시오.

추가 답변(1개)

William Rose
William Rose 2022년 8월 2일
I'm not sure I understand. Is a uniformly distributed random variable, or is the expected value of p, which is a uniformly distributed random variable? You wrote inside the integral in the first equation, but after that, the subscript e disappeared. If is the random variable inside the integral, then it should be the vrable of integration, so the integral should have been . If that is the case, then you have
where b and p are constants. Which is just what you expect for the mean value of a uniformly distributed random variable.
Perhaps you meant to write for the first equation. If so, there is a different problem, which is that p cannot be the lower limit of integration and the variable of integration at the same time.
  댓글 수: 1
Yuriy
Yuriy 2022년 8월 2일
편집: Yuriy 2022년 8월 2일
I apologize for my messy explanation. A variable in the first period denoted , and in the second is . Therefore, .
So, in the first period I randomly draw p from the distribution with the support , and then in the second period I anticapate price raise, which will be from the same distribution but with the support . Therefore, I am trying to plot expected profits curve.
I see what you mean, and it is what MatLab saying about this piece of code:
p_e = (p:0.01:b);
But the expected price will depend on how price p changes the interval over which I am trying to intergate.

댓글을 달려면 로그인하십시오.

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by