STAT 400

Fri. February 14th, 2020


Cumulative Distribution Functions (cont.)

For any two numbers a,ba,b, [a,b](,a)=(,b)[a,b]\cup (-\infin,a)=(-\infin,b). Thus, P(aXb)+P(X<a)=P(Xb)P(aXb)=P(Xb)P(X<a).\begin{aligned} P(a\le X\le b)+P(X\lt a)&=P(X\le b)\\ P(a\le X\le b)&=P(X\le b)-P(X\lt a). \end{aligned}

We denote aa- as the largest possible value of XX that is strictly less than aa. (For example, if XX takes only integer values and a=2a=2, then a=1a-=1.) Now, we can write P(X<a)=P(Xa)P(aXb)=P(Xb)P(Xa)=F(b)F(a)\begin{aligned} P(X\lt a)&=P(X\le a-)\\ P(a\le X\le b)&=P(X\le b)-P(X\le a-)=F(b)-F(a-) \end{aligned} where FF is the cumulative distribution function for XX.

In particular, if XX takes only integer values and a,ba,b are integers, then a=a1a-=a-1 and P(aXb)=F(b)F(a1).P(a\le X\le b)=F(b)-F(a-1).


Ex. Suppose XX follows Geo(p)\text{Geo}(p) and 1nm1\le n\le m are integers. P(nXm)=F(m)F(n1)=(1(1p)m)(1(1p)n1)=(1p)n1(1p)m.\begin{aligned} P(n\le X\le m)&=F(m)-F(n-1)\\ &=(1-(1-p)^m)-(1-(1-p)^{n-1})\\ &=(1-p)^{n-1}-(1-p)^m. \end{aligned}


Expected Values & Variance

Definition. Let XX be a discrete random variable with a set of possible values DD, and a probability mass function p(x)p(x). The expected value (also called mean value or expectation) of XX, denoted by E(X)E(X) (or μX\mu_X or just μ\mu) is defined as E(X)=μX=yDyp(y).E(X)=\mu_X=\sum_{y\in D}y\cdot p(y).


Calculating Expected Value

Ex1. Suppose XX follows Bernoulli(α)\text{Bernoulli}(\alpha). E(X)=0p(0)+1p(1)=0(1α)+1(α)=α.E(X)=0\cdot p(0)+1\cdot p(1)=0(1-\alpha) + 1(\alpha)=\alpha.


Ex2. Returning to the blood sample example from previous lectures: p(1)=0.4p(2)=0.3p(3)=0.2p(4)=0.1E(X)=1(0.4)+2(0.3)+3(0.2)+4(0.1)=2.\begin{aligned} p(1)&=0.4\\p(2)&=0.3\\p(3)&=0.2\\p(4)&=0.1\\\\E(X)&=1(0.4)+2(0.3)+3(0.2)+4(0.1)\\&=2. \end{aligned}


Ex3. Suppose XX follows Geo(p)\text{Geo}(p). p(k;p)=(1p)k1pE(X)=k=1k(1p)k1p=pk=1k(1p)k1=pk=1ddp((1p)k)=p[ddpk=1((1p)k)]=p[ddp(1+k=0((1p)k))].\begin{aligned} p(k;p)&=(1-p)^{k-1}p\\ E(X)&=\sum_{k=1}^\infin k\cdot (1-p)^{k-1}p\\ &=p\cdot \sum_{k=1}^\infin k\cdot (1-p)^{k-1}\\ &=p\cdot \sum_{k=1}^\infin \frac{d}{dp}(-(1-p)^k)\\ &=p\cdot [\frac{d}{dp}\sum_{k=1}^\infin (-(1-p)^k)]\\ &=p\cdot [\frac{d}{dp}(1+\sum_{k=0}^\infin (-(1-p)^k))].\\ \end{aligned} The infinite sum is now in the form of a geometric series, so we can apply that formula: E(X)=p[ddp(11p)]=p1p2=1p.\begin{aligned} E(X)&=p\cdot [\frac{d}{dp}(1-\frac{1}{p})]\\ &=p\cdot \frac{1}{p^2}\\ &=\frac{1}{p}. \end{aligned}


Expectation of a Function

We want to find E(h(X))E(h(X)), where h(x)h(x) could be any function of our random variable XX. We can do this by looking at h(X)h(X) as a new random variable generated by hh.

Generally, E(h(X))=yDh(y)p(y).E(h(X))=\sum_{y\in D}h(y)\cdot p(y).

In the special case where h(x)=ax+bh(x)=ax+b with a,ba,b constant (that is, hh is linear), E(h(X))=aE(X)+b.E(h(X))=a\cdot E(X)+b.


Ex. For the blood sample example: the cost of the experiment C(x)C(x) is a function of how many tests you had to perform. (This is not necessarily linear.) C(1)=100, C(2)=140, C(3)=170, C(4)=190.C(1)=100,\ C(2)=140,\ C(3)=170,\ C(4)=190. Given this function, E(X)=C(1)p(1)+C(2)p(2)+C(3)p(3)+C(4)p(4)=100(0.4)+140(0.3)+170(0.2)+190(0.1)=135.\begin{aligned} E(X)&=C(1)\cdot p(1)+C(2)\cdot p(2)+C(3)\cdot p(3)+C(4)\cdot p(4)\\ &=100(0.4)+140(0.3)+170(0.2)+190(0.1)\\ &=135. \end{aligned}