250 Some Elementary Statistical Inferences
Example 4.3.2(Confidence Interval for a Bernoulli Proportion). LetX have a
Bernoulli distribution withθas the probability of success. Let Ω = (0,1). Suppose
X 1 ,X 2 ,...,Xnis a random sample onX. As our point estimator ofθ,weconsider
X, which is the sample proportion of successes. The cdf ofnXis binomial(n.θ).
Thus
FX(x;θ)=P(nX≤nx)
=
∑nx
j=0
(
n
j
)
θj(1−θ)n−j
=1−
∑n
j=nx+1
(
n
j
)
θj(1−θ)n−j
=1−
∫θ
0
n!
(nx)![n−(nx+1]!
znx(1−z)n−(nx+1)dz, (4.3.2)
where the last equality, involving the incompleteβ-function, follows from Exercise
4.3.6. By the fundamental theorem of calculus and expression (4.3.2),
d
dθ
FX(x;θ)=−
n!
(nx)![n−(nx+1]!
θnx(1−θ)n−(nx+1)<0;
hence,FX(x;θ) is a strictly decreasing function ofθ,foreachx.Next,letα 1 ,α 2 > 0
be specified constants such thatα 1 +α 2 < 1 /2andletθandθsolve the equations
FX(x−;θ)=1−α 2 andFx(X;θ)=α 1. (4.3.3)
Then (θ,θ) is a confidence interval forθwith confidence coefficient at least 1−α,
whereα=α 1 +α 2. These equations can be solved iteratively, as discussed in the
following numerical illustration.
Numerical Illustration. Supposen= 30 and the realization of the sample mean
isx=0.60, i.e., the sample producednx= 18 successes. Takeα 1 =α 2 =0.05.
Because the support of the binomial consists of integers andnx= 18, we can write
equations (4.3.3) as
∑ 17
j=0
(n
j
)
θj(1−θ)n−j=0.95 and
∑ 18
j=0
(n
j
)
θ
j
(1−θ)n−j=0. 05. (4.3.4)
Letbin(n, p) denote a random variable with binomial distribution with parameters
nandp. BecauseP(bin(30, 0 .4)≤17) = pbinom(17,30,.4) = 0.9787 and because
P(bin(30, 0 .45)≤17) = pbinom(17,30,.45) = 0.9286, the values 0.4and0.45 bracket
the solution to the first equation. We use these bracket values as input to the R
function^1 binomci.rwhich iteratively solves the equation. The call and its output
are:
> binomci(17,30,.4,.45,.95); $solution 0.4339417
(^1) Download this function at the site given in the preface.