Conditional expectation in matlab

I have to calculate conditional expected value of a and b. a and b are random variables that are normally distributed with mean 1/2 and variance 1/2. The support for a and b, ie. Values of a and b, falls in the interval [0,1]. I have to calculate E(a|a>b) and E(b|a>b). How can I do this in Matlab?
Help @Torsten

6 Comments

Hi Sabrina,
If a and b are normal, they each have support over the entire real line, so the statement about the interval of [0,1] is unclear.
I suspect some important information is missing from the question.
In any case, do you already have an approach that is supposed to be implemented in Matlab?
@Paul Thanks for your reply. I don't want a and b to be on entire line. Can't I define it to be in the range [0,1]. I can't find code in Matlab which will help me define interval for normal distribution. All takes support to be from minus infinity to plus infinity. The variables a and b represent the gain percentage of two agent. Gain (profit) percentage cannot be negative. And the percentage value lies between 0 and 1.
"I can't find code in Matlab which will help me define interval for normal distribution."
As @Paul correctly noted, you cannot find that because if the interval is not -If to +Inf, it would not be a normal distribution.
If you have an experimental situaiton where there is a ratio, and the ratio mut be between 0 and 1, then the ratio is not normally distributed. The classic example is the fraction of heads in N coin flips, which has a scaled binomial distribution.
William Rose
William Rose on 14 Oct 2023
Edited: William Rose on 14 Oct 2023
[edit : fix typos]
another aspect of your original post which is impossible is
"... mean 1/2 and variance 1. The support for a and b, ie. Values of a and b, falls in the interval [0,1]."
Let's forget about whether the variables are normal or not. If the interval is [0,1], then it is impossible for the variance to be 1. Because var=1 means the average squared distance of each point from the mean is 1. For a variable with range [0,1], the mean will be between 0 and 1 (and you said mean=1/2, so that's fine). But the maximum distance from mean=1/2 to a point in this range is 1/2 (if the point is at 0 or 1). So the variance must be <1.
Sorry! I mean variance of 1/2. Corrected it. Thanks for pointing it out @William Rose
William Rose
William Rose on 14 Oct 2023
Edited: William Rose on 14 Oct 2023
@Sabrina Garland, you're welcome.
[edit: correct typo. I wrote var(1)=0.5 and I meant to write var(a)=0.5]
I think you meant that the standard deviation (not variance) is 1/2. Because if var(a)=0.5 then SD=1/sqrt(2)=0.707, which is still too much, if and range is [0,1].
If I am right that mean(a)=0.5 and s.d.(a)=0.5, and if range(a)=[0,1], then you must be talking about the Bernoulli distribution, i.e. the distribution of results from a single coin flip, for an evenly-weighted coin. The result of one flip is either 0 or 1, with mean 0.5 and variance=0.25, s.d.=0.5. Any other distribution with mean=0.5 will have an s.d. that is less than 0.5.
But you also said the random variable is a gain, so I don't know what to think.
Can you give a more detailed description of what you mean by the variable being the ratio of gains? How is each gain calculated? Whay can't the gain be more than 1 or less than 0. You also called it a profit. If you have an opportunity where the profit cannot be negative, there will be a lot of intereted people... :)

Answers (0)

This question is closed.

Products

Release

R2023b

Tags

Asked:

on 14 Oct 2023

Closed:

on 14 Oct 2023

Community Treasure Hunt

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

Start Hunting!