3.1. The Binomial and Related Distributions 157which is not a simple calculation. Most statistical packages provide procedures to
calculate binomial probabilities. In R, ifYisb(n, p) then the cdf ofYis computed
asP(Y≤y)=pbinom(y,n,p). Hence, for our example, using R we compute the
P(Y≥16) asP(Y≥16) = 1−P(Y≤15) = 1−pbinom(15, 60 , 1 /6) = 0. 0338.The R functiondbinomcomputes the pmf of a binomial distribution. For instance,
to compute the probability thatY= 11, we use the R code:dbinom(11,60,1/6),
which computes to 0.1246.The mgf of a binomial distribution is easily obtained as follows:M(t)=∑xetxp(x)=∑nx=0etx(
n
x)
px(1−p)n−x=∑nx=0(
n
x)
(pet)x(1−p)n−x=[(1−p)+pet]nfor all real values oft.Themeanμand the varianceσ^2 ofXmay be computed
fromM(t). Since
M′(t)=n[(1−p)+pet]n−^1 (pet)and
M′′(t)=n[(1−p)+pet]n−^1 (pet)+n(n−1)[(1−p)+pet]n−^2 (pet)^2 ,if follows that
μ=M′(0) =npand
σ^2 =M′′(0)−μ^2 =np+n(n−1)p^2 −(np)^2 =np(1−p).SupposeYhas theb(60, 1 /6) distribution as discussed in Example 3.1.1. Then
E(Y) = 60(1/6) = 10 and Var(Y) = 60(1/6)(5/6) = 8. 33Example 3.1.2.If the mgf of a random variableXisM(t)=(^23 +^13 et)^5 ,thenXhas a binomial distribution withn=5andp=^13 ;thatis,thepmfofXisp(x)={ ( 5
x)( 1
3)x( 2
3) 5 −x
x=0, 1 , 2 ,..., 5
0elsewhere.Hereμ=np=^53 andσ^2 =np(1−p)=^109.