Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

LECTURE 5.

CONFIDENCE INTERVAL

5.1 Concepts [1] p.332


5.2 CI for Normal Mean - Known [1] p.383
5.3 CI for Normal Mean - Unknown [1] p.401
5.4 CI for Normal Variance [1] p.409
5.5 CI for Proportion [1] p.395

Reference
Book [1] Chapter 8, pp.382 - 424.
Book [2] Chapter 11
Book [4] Chapter 8

September 5, 2023 1 / 21
5.1. Concepts

Interval estimate , Confidence interval


Population parameter ✓, needed to be estimated
Sample (X1 , X2 , ..., Xn )
Confidence level (1 ↵) >critical value .

Confidence Interval: (Lower limit, Upper limit), or (LL, UL)

P(LL < ✓ < UL) = 1 ↵

Confidence width
w = UL LL

September 5, 2023 2 / 21
5.2. C.I. for mean of normal populations - known

Assume X ⇠ N(µ, 2 ); is known. Find a C.I. for µ with confidence


level (1 ↵)
✓ 2

X µ
Recall X ⇠ N µ, , which implies Z = p ⇠ N(0, 1) 2
n / n
-

1-

Then one has =


✓ ◆
21 42
-

·
e
ums ! -

P µ z↵/2 p < X < µ + z↵/2 p


n n
=1 ↵, i L

or ✓ ◆
P X z↵/2 p
n
< µ < X + z↵/2 p
n
=1 ↵ I
✓ ◆
Remark that (LL, UL), which is X z↵/2 p , X + z↵/2 p , is a
n n
random interval

September 5, 2023 3 / 21
C.I.

Observing X1 = x1 , X2 = x2 , . . . , Xn = xn

Two-sided C.I.
The (1 ↵)% two-sided confidence interval for µ is
✓ ◆
x z↵/2 p , x + z↵/2 p ,
n n
✓ ◆
or we can write x z↵/2 p < µ < x + z↵/2 p with N
95% confidence
n n

One-sided C.I.
The (1 ✓↵)%Might
fight tail (lower
◆ bounded)
✓ and left tail
◆ (upper bounded)
C.I.s are x z↵ p , 1 and 1, x + z↵ p , respectively
n n

September 5, 2023 4 / 21
Interpretation of a Confidence Level

phair.

It is incorrect to write P x ·e
z↵/2 p < µ < x + z↵/2 p
n n

=1 ↵

- A correct interpretation of “(1 ↵)% confidence” relies on the


long-run relative frequency interpretation of probability
ht
Let A be the event that X z↵/2 p < µ < X + z↵/2 p , then
Die n n

!
P(A) = 1 ↵
In the long run, (1 ↵)% of our computed C.I.s will contain µ
*
Armutat x4=
&4 z4
C
e -

-
w =
4L -L = 2 .
2 x
/ I
&

a
=>
WT- Dwe want to vicreare
the confidence in terval
21 -
2) +feen the accuration (measured by us must
September 5, 2023 5 / 21
Confidence Level, Precision, and Sample Size

There is a trade-o↵ between Confidence Level and Precision


(measured by confidence width): the higher confidence level is, the
wider interval is
The sample size n necessary to ensure an interval width w
✓ ◆2
2z↵/2
n=
w

September 5, 2023 6 / 21
Example

Example 5.1
Weight of product (g) is normally distributed with variance of 25g2 .
Random survey 16 products then total weight is 800g.
(a) Find the 95% two-sided C.I. for the mean -> 1 x
-
= 0 98
.
+

2 =
0 . 85
(b) Find the 90% lower bounded C.I. for the mean
(c) To reduce C.I. width to 3g, confidence level 95%, how many product
-

should be survey?
(d) Total weight of 24 other products is 1248g. Find 95% C.I. for the
mean

September 5, 2023 7 / 21
C.I: Random or Non-random

Which is correct?
✓ ◆
s
P X z↵/2 p < µ < X + z↵/2 p =1 ↵
n n
✓ ◆
P X 1.96 p < µ < X + 1.96 p = 0.95 W
n n
✓ ◆ W
5 5
P X 1.96 · < µ < X + 1.96 · = 0.95
4 4
✓ ◆
5 5
P 50 1.96 · < µ < 50 + 1.96 · = 0.95 ↓
4 4
P(50 2.45 < µ < 50 + 2.45) = 0.95 I

September 5, 2023 8 / 21
Confidence Interval: random or non-random

95%
X
| |

September 5, 2023 9 / 21
5.3. C.I. for mean of normal population - unknown

Replacing by S, one has T =


X µ
p ⇠ T (n
S/ n
1)

C.I. for mean
Two-sided C.I. S S
X t(n 1)↵/2 p < µ < X + t(n 1)↵/2 p
n n

Right-sided and Left-sided


S S
X t(n 1)↵ p < µ and µ < X + t(n 1)↵ p
n n

September 5, 2023 10 / 21
A Prediction Interval for a Single Future Value
Assume we wishes to predict a single value of a variable to be
observed at some future time
A random sample X1 , X2 , . . . , Xn from a normal population
distribution, then we wish to predict the value of Xn+1 , a single future
observation
A unbiased point estimator is X . One has V (X Xn+1 ) = 2 (1 + n1 ),
(X Xn+1 ) 0
and Z = q has a standard normal distribution
2 (1+ 1 )
n

Replacing s by the sample standard deviation S, then


T = XqXn+11 ⇠ T (n 1)
S 1+ n
Thus, a prediction interval (P.I.) interval for a single random
observation is, with prediction level (1 ↵),
r
1
X ± t(n 1)↵/2 s 1 +
n
September 5, 2023 11 / 21
Example
Zit
Sxx- Z ,
m
?
-

I V
Example 5.2 -

Assumed that wage per hour ($) of financial expert is normal distributed.
Data of 16 randomly surveyed experts is below
Wage (x) 20 22 24 26
5
Freq. 1 6 5 4
=
13 .
.

Zini
-

P P 2
And xi = 376; i xi = 8888
I
16 888 3564
--
i M
-

(a) Calculate sample mean and standard deviation S =

7 15
(b) Find the 95% confidence interval of mean (population mean) Il
(c) Find the 90% prediction interval 1 861
.

(d) Find the 80% upper confidence interval of mean

September 5, 2023 12 / 21
n
-
1

b I -

th Y M(x+ *
2
15

W Don-< m 23 5+ It value TiNV10 155


->
23 5
.
< :

55,
.

,
-

in excel

(s/in)
*

x= +


5.4. C.I. for the variance of normal populations
X1 , . . . , Xn is a random sample from a normal distribution with
parameters µ and 2
(n 1)S 2 2 (n
Recall 2 ⇠ 1)
!
(n 1)s 2 (n 1)s 2
The two-sided C.I. 2
, 2
. The right-sided and
(n 1)↵/2 (n
! 1)1 ↵/2 !
(n 1)s 2 (n 1)s 2
left-sided C.I.s are 2
,1 and 1, 2
(n 1)↵ (n 1)1 ↵

Example 5.3
Wage survey of 16 experts shows the mean of $23.5 and the variance of
$3.467. Assume that the wage is normally distributed.
(a) Find the 95% confidence interval of variance
(b) Find the 90% upper confidence of standard deviation
September 5, 2023 13 / 21
5.5. C.I. FOR PROPORTION

✓ ◆
p(1 p)
n large enough, p̂ ⇠ N p,
n
r r !
p(1 p) p(1 p)
P p z↵/2 < p̂ < p + z↵/2 =1 ↵
n n

Two-sided C.I.
q
2 /2n p̂(1 2 /(4n2 )
p̂)/n + z↵/2
p̂ + z↵/2
2 /n
± z↵/2 2 /n
1 + z↵/2 1 + z↵/2
One-sided C.I.

September 5, 2023 14 / 21
C.I. for Proportion - Large Sample

Large sample (n 100)


Two-sided C.I r r
p̂(1 p̂) p̂(1 p̂)
p̂ z↵/2 < p < p̂ + z↵/2
n n
r
p̂(1 p̂)
Shorten: p̂ ± ME , in which ME = z↵/2
n
2 p̂(1
z↵/2 p̂) 2 p̂(1
4z↵/2 p̂)
Sample size: n = =
ME 2 w2
One-sided C.I.

September 5, 2023 15 / 21
Example

Example 5.4
In 200 insurance customers, there were 48 claims.
(a) Find the 90% C.I. for claim proportion in customers
(b) Keep ME = 3%, C.I 90%, how many customers should be surveyed?
(c) Keep ME = 3%, with 200 customers, what is confidence level?
(d) Find the 95% C.I of number of claims in 1000 customers.

Example 5.5
To estimate proportion on sample n = 400, with confidence level 90%,
what is the maximum value that the ME of C.I. would be?
Example 5.6
Catch 500 fishes in the lake, mark on them then release. Then catch 1000
fishes, and there are 50 marked ones. Find the right-sided (lower bounded)
C.I 90% of total number of fishes in the lake.
September 5, 2023 16 / 21
Exercise - Lecture 05

Book Page Compusory Optional


[1] 390 1, 2, 3, 4 5, 6, 7, 8, 9
399 12, 13 15, 19, 23, 25, 28
407 35, 37 42
411 47 48
420 59 61, 62, 64, 65
[2] 325
329
331
333
Using R to build CI for mean, variance of Normality variable
> sample <-...
> mean <-...
> ssq <-...
> conflevel <-...
September 5, 2023 17 / 21
R code: C.I. for Mean: Known sigma

> ci mean <- function(sample,sigma,alpha){


> n <- length(sample)
> ME <- qnorm(1-alpha/2)*sigma/sqrt(n)
> ll <- mean(sample) - ME
> ul <- mean(sample) + ME
> c(ll, ul)
> }
> sample <- c(...)
> sigma <-...
> alpha <- 0.05
> ci mean(sample,sigma,alpha)

September 5, 2023 18 / 21
R code: C.I. for Mean: Unknown sigma

> ci mean <- function(sample,alpha){


> n <- length(sample)
> ME <- qt(1-alpha/2,n-1)*sd(sample)/sqrt(n)
> ll <- mean(sample) - ME
> ul <- mean(sample) + ME
> c(ll, ul)
> }
> sample <- c(...)
> alpha <- 0.05
> ci mean(sample, alpha)

September 5, 2023 19 / 21
R code: C.I. for Variance

> ci var <- function(sample,alpha) {


> n <- length(sample)
> ll <- (n-1)*var(sample)/qchisq(1-alpha/2,n-1)
> ul <- (n-1)*var(sample)/qchisq(alpha/2,n-1)
> c(ll, ul)
> }
> sample <- c(...)
> alpha <- 0.05
> ci var(sample,alpha)

September 5, 2023 20 / 21
R code: C.I. for Proportion

> ci p <- function(n,freq,alpha) {


> ph <- freq/n
> za <- qnorm(1-alpha/2)
> ph2 <- (ph + za^2/(2*n))/(1+za^2/n)
> me <- sqrt(ph*(1-ph)/n + za^2/(4*n^2))/(1+za^2/n)
> ll <- ph2 - za*me
> ul <- ph2 + za*me
> c(ll, ul)
> }
> n <- ...
> freq <- ...
> alpha <- 0.05
> ci p(sample,alpha)
September 5, 2023 21 / 21

You might also like