Let be the length of lifetime of a light bulb and assume . There are random sample of with . What is the confidence interval?
Estimation Error
Estimation error
Note
If it is normal distribution and is known, then
One Sided CI
Example 1: Lower bound
The confidence interval is
Example 2: Upper bound
Hence, confidence interval is
Case 2: Non-Normal Distribution ( Known)
are i.i.d. with mean and variance , which is known. By Central Limit Theorem, for large ,
Thus,
The asymptotic / approximate two-sided CI is
Example
Let be amount of orange juice consumed by an American per day Given What is the approximate 90% confidence interval for
Tip
Case 1 和 Case 2 做法几乎一样 —— Substitute given variables and find the interval
Case 3: Normal Distribution ( Unknown)
and is unknown In #Case 1 Normal Distribution ($ sigma 2$ known), depends on . As is unknown, we cannot use to find the interval. Hence, we need to use sample variance and Student's theorem
Hence, we need to use as upper and lower bound.
The CI of is
Note
和 的区别跟 和 的区别一样 —— 即 是 random variable,而 是 observed value
Example
Let , and both and are unknown Given . What is 90% CI for ?
Case 4: Non-Normal Distribution ( Unknown)
are i.i.d. with mean and variance , which is unknown. If is large enough / each is approximately normal, then
Approximate two-sided CI of is
Important
If is large enough, then
Hence, the approximate two-sided CI for is
Distribution of
Distribution
Two-sided CI
, known
Any distribution with large , known
, unknown
Any distribution with large , unknown
CI for the Difference of 2 Means
For
To construct confidence intervals for , we need to consider 3 cases
Pooled -interval
are independent
is unknown
Welch's -interval
are independent
are both unknown
Paired -interval
are dependent for each
Pairs are independent
are unknown
Case 1: Pooled -interval
Let and be independent random variables. Then, CI for is
is pooled estimator of , which is unbiased estimator of
Example
Let be the score on a standardized test in a large high school. Let be the score on a standardized test in a small high school. Given: What is 95% confidence interval for
Case 2: Welch's -interval
Let be independent Approximate CI for is
where
Note
is floor function (round down) i.e.
Note
Welch 公式算出来的自由度 通常不是整数(比如 19.8),但 t 分布表只有整数自由度,必须取一个整数去查表
An experiment was conducted to compare people's reaction times to a red light versus green light. When signaled with either red or green light, the subject was asked to hit a switch to turn off the light When the switch was hit, a clock was turned off and the reaction time was recorded
Given What is the 95% CI for ?
Subject
Red ()
Green ()
1
0.30
0.43
−0.13
2
0.23
0.32
−0.09
3
0.41
0.58
−0.17
4
0.53
0.46
0.07
5
0.24
0.27
−0.03
6
0.36
0.41
−0.05
7
0.38
0.38
0.00
8
0.51
0.61
−0.10
Using pooled and Welch's -interval to calculate CI, Given that . Pooled -interval
Welch's -interval
With same center , CI widths are different In general, CI width: Pair -interval < Pool -interval < Welch's -interval
Note
When is closed to , widths of pooled -interval and Welch's -interval are similar.
CI for Proportions
Example
In a political campaign survey, we collect a sample of voters. out of them favor candidate A and remaining favour candidate B. Let be the supporting rate in the population. How to build a CI for the supporting rate?
By Law of Large Number, . Hence, we can use to approximate when is large. Then, the approximate CI is
Therefore,
To measure the difference in proportions between 2 independent populations,
: Proportion in population with a characteristic () : No. of successes in sample from population : Sample size in population
Hence,
When and is large, by CLT,
By Law of Large Number, we can approximate by . Hence, the approximate CI for is
Example
Let be the proportion of male students into gaming, and be the proportion of female students into gaming. Suppose . When , please construct approximate 95% CI for .
is called half-width, as well as margin of error or max. error of the estimate
Note
The smaller the half-width , the more accurate the estimate.
We requires the half-width must be less than a given tolerance in precision
Example
A psychology study uses standardized memory tests with known standard deviation . Find the minimum sample size needed for a 95% confidence interval with a margin of error at most 2.
Hence, the minimum sample size is 139 students.
Normal Distribution ( Unknown)
When is unknown, the CI is
is the half-width. Hence,
However, there are 2 issues
depends on . Hence, we use to approximate
depends on . Hence, we have to estimate from prior knowledge / pilot study Finally,
Proportion
The approximate CI for proportion is
Let the required precision be .
However, depends on Since is unknown, we have 2 approach to approximate
Use prior estimate :
来自历史数据、以前的调查或者预试研究(pilot study)
Use the max. variance
As ,
attains its maximum when
Hence, assume
Proof
Prove by completing square.
Example
A particular area contains 8000 apartment units. In a preliminary survey, 12% of the respondents said they planned to sell their apartments within the next year. We want to estimate the interval for the total number of owners planning to sell. Suppose that a 95% confidence interval with the half-width less than 200 is desired. How many owners do we need to survey.
From now, we have
: 12% (it is prior estimate)
: 200
: 5% As there are 8000 apartments in total, the approximate CI of the number of owners planning to sell has to multiply by 8000.
Approximate by
Hence, we need to survey at least 650 apartment owners