Question: Note. Probability distributions on finite sets can be described by vectors whose entries are nonnegative and sum to 1. For example, consider the distribution of
Note.
Probability distributions on finite sets can be described by vectors whose entries are nonnegative and sum to 1. For example, consider the distribution of the random variable X which is distributed on the sample space {1,2,3} given by Pr(X=1)=514, Pr(X=2)=12 and Pr(X=3)=17.
This distribution can be represented by the vector Px=[514,12,17] in R. Note that the 1st component of this vector is precisely Pr(X=1), the 2nd component is precisely Pr(X=2), etc. We will usually be interested in computing the expectation E(X) (represented by Ex), variance Var(X) (represented by Varx), and other probabilistic quantities for the random variable described by Px. So for this vector
E[X]=Px[1]1+Px[2]2+Px[3]3
while E[X2]=Px[1]12+Px[2]22+Px[3]32=Px[1]+4Px[2]+9Px[3]
and
Var[X]=E[X2]E[X]2
R Code
# define the random variable X
X<-c(1,2,3)
X
#assign the probabilities
Px <- c(5/14, 1/2, 1/7)
Px
Find the expectation using the formula $ _{X=1}^{N} X_i Px(i) $.
Find the variance using the formula Varx=Ex2(Ex)2 or Varx=NX=1(XiEx)2Px(i)
R Code
X<-c(1,2,3)
Px <-c(5/14, 1/2, 1/7)
Ex<- sum(X*Px)
Ex
Varx<- sum( ( (X-Ex)^2* Px) )
Varx
Note that E(X) is the average of the random variable X while Var(X) measures its `spread' around this average - the higher the variance, the higher the probability that X is far from E(X). Also, Var(X) is always nonnegative, i.e., zero or positive.
Question 1
Can you think of a random variable Z with distribution on {1,2,3} which has zero variance, i.e., zero spread? Is this variable really random? What are the other two distributions for Z which have zero variance?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
