- changed status to open
compute expectation of a variable
Issue #75
resolved
Hi,
Lea is a great pedagogic tool and I am trying to use it for my class on information theory and probability. I may have missed that but I couldn’t find it from the tutorial. How can we find the expectation of a random variable?
for example, say for
X = lea.pmf({1:0.5, 2:0.5})
do we have something like
X.expectation
to get 1*0.5 + 2*0.5?
Thanks!
Sam
Comments (5)
-
repo owner -
repo owner Hi Sam,
Very pleased to hear that Lea may be used for your class!
Lea is using the wording "mean" for what you're looking for. This is briefly mentioned here, in the first page of the tutorial. So, you simply have to type:
X.mean
which shall return here
1.5
. -
repo owner -
assigned issue to
-
assigned issue to
-
repo owner - changed status to resolved
-
reporter Thanks for the quick reply! I was silly missing that! Thanks again!
- Log in to comment