Lec09 Estimation

You might also like

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

Estimation

CMPE 343 Introduction to Probability and Statistics for


Computer Engineers

İnci M. Baytaş

Department of Computer Engineering


Bogazici University

Fall 2022

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 1
Statistical Inference

I Making inferences and generalizations about a population


I Classical method of estimating a population parameter is based
strictly on random sample selected from the population.
I Statistical inference can be divided into two
I Estimation: estimating parameters from a random sample

I Hypothesis testing: hypothesize that A is better than B, and after


proper testing, accept or reject this hypothesis.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 2
Point Estimate

I A point estimate of some population parameter θ is a single value θ̂


of a statistic Θ̂.
I The value x̄ of the statistic X̄ , computed from a sample of size n, is a
point estimate of µ.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 3
Point Estimate

I A point estimate of some population parameter θ is a single value θ̂


of a statistic Θ̂.
I The value x̄ of the statistic X̄ , computed from a sample of size n, is a
point estimate of µ.

I An estimator estimates the population parameter with some error.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 3
Point Estimate

I A point estimate of some population parameter θ is a single value θ̂


of a statistic Θ̂.
I The value x̄ of the statistic X̄ , computed from a sample of size n, is a
point estimate of µ.

I An estimator estimates the population parameter with some error.


I We need to define desirable properties of a good decision function
that would help us choose one estimator over another.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 3
Point Estimate

I A point estimate of some population parameter θ is a single value θ̂


of a statistic Θ̂.
I The value x̄ of the statistic X̄ , computed from a sample of size n, is a
point estimate of µ.

I An estimator estimates the population parameter with some error.


I We need to define desirable properties of a good decision function
that would help us choose one estimator over another.
I We want the sampling distribution of an estimator, Θ̂, to have a
mean equal to the parameter estimated, θ.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 3
Unbiased Estimator

A statistic Θ̂ is said to be an unbiased estimator of the parameter θ if


 
µΘ̂ = E Θ̂ = θ

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 4
Unbiased Estimator

A statistic Θ̂ is said to be an unbiased estimator of the parameter θ if


 
µΘ̂ = E Θ̂ = θ

I Unbiased estimator is an accurate statistic to approximate a


population parameter.
I Accurate: neither overestimate nor underestimate

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 4
Unbiased Estimator

A statistic Θ̂ is said to be an unbiased estimator of the parameter θ if


 
µΘ̂ = E Θ̂ = θ

I Unbiased estimator is an accurate statistic to approximate a


population parameter.
I Accurate: neither overestimate nor underestimate

1. Show that X̄ is an unbiased estimator of µ.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 4
Unbiased Estimator

A statistic Θ̂ is said to be an unbiased estimator of the parameter θ if


 
µΘ̂ = E Θ̂ = θ

I Unbiased estimator is an accurate statistic to approximate a


population parameter.
I Accurate: neither overestimate nor underestimate

1. Show that X̄ is an unbiased estimator of µ.

2. Show that S 2 is an unbiased estimator of σ 2 .

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 4
Variance of a Point Estimator

I If Θ̂1 and Θ̂2 are two unbiased estimators of the same population
parameter θ, choose the estimator whose sampling distribution has
the smaller variance.
I If σθ̂2 < σθ̂2 , Θ̂1 is a more efficient estimator of θ than Θ̂2 .
1 2

Definition
If we consider all possible unbiased estimators of some parameter θ, the
one with the smallest variance is called the most efficient estimator of θ.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 5
Sampling Distributions of Different Θ̂

Figure: Sampling distributions of different estimators of θ.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 6
Interval Estimation

I Even the most efficient unbiased estimator is unlikely to estimate the


population parameter exactly.
I There are many situations in which we may need to determine an
interval within which the parameter is expected to lie ⇒ interval
estimate.
I An interval estimate of a population parameter θ is denoted by
θ̂L < θ < θ̂U .
I As sample size increases, the interval gets shorter.
I The length of the interval indicates the accuracy of the point
estimate.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 7
Interval Estimation

I Different samples yield different values of Θ̂, and therefore different


values for θ̂L and θ̂U .
I If we find Θ̂L and Θ̂U such that
 
P Θ̂L < θ < Θ̂U = 1 − α

for 0 < α < 1.


I The probability of 1 − α selecting a random sample that will produce
an interval containing θ.
I θ̂L < θ < θ̂U , computed from the selected sample, is called a
100 (1 − α) % confidence interval, 1 − α is called confidence
coefficient or the degree of confidence, and θ̂L and θ̂U are called
the lower and upper confidence limits.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 8
Estimating the Mean
I x̄ is likely to be a very accurate estimate of µ when n is large.
I If the sample is from normal population or, if n is sufficiently large, a
confidence interval for µ can be established by considering the
sampling distribution of X̄
I Recall the Central Limit Theorem, sampling distribution of X̄ is

approximately normal with µX̄ = µ and σX̄ = σ/ n.

Confidence Interval on µ, σ 2 known


If x̄ is the mean of a random sample of size n from a population with
known variance σ 2 , a 100 (1 − α) % confidence interval for µ is given by
σ σ
x̄ − zα/2 √ < µ < x̄ + zα/2 √ ,
n n

where zα/2 is the z−value leaving an area of α/2 to the right.


İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 9
Exercise

The average zinc concentration recovered from a sample of measurements


taken in 36 different locations in a river is found to be 2.6 grams per
milliliter. Find the 95% and 99% confidence intervals for the mean zinc
concentration in the river. Assume that the population standard deviation
is 0.3 gram per milliliter.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 10
Confidence Interval

I 100 (1 − α) % confidence interval provides an estimate of the


accuracy of our point estimate.

I Most of the time, x̄ will not be exactly equal to µ and the point
estimate will be in error.

Theorem
If x̄ is used as an estimate of µ, we can be 100 (1 − α) % confident that
the error, |µ − x̄ |, will not exceed zα/2 √σn .

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 11
Confidence Interval

I We wish to know how large a sample is necessary to ensure that the


error in estimating µ will be less than a specified amount e.
I We must choose n such that zα/2 √σn = e.

Theorem
If x̄ is used as an estimate of µ, we can be 100 (1 − α) % confident that
the error will not exceed a specified amount e when the sample size is
2
zα/2 σ

n=
e

I Round all fractional values up to the next whole number.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 12
One-Sided Confidence Bounds

I An upper bound could be more informative in some cases.


I Developed in the same way as two-sided intervals.
!
X̄ − µ  √ 
P √ < zα = 1 − α ⇒ P µ < X̄ + zα σ/ n = 1 − α
σ/ n

One-Sided Confidence Bounds on µ, σ 2 Known


If X̄ is the mean of a random sample of size n from a population with
variance σ 2 , the one-sided 100 (1 − α) % confidence bounds for µ are
given by

upper one-sided bound: x̄ + zα σ/ n;

lower one-sided bound: x̄ − zα σ/ n.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 13
Exercise

In a psychological testing experiment, 25 subjects are selected randomly


and their reaction time, in seconds, to a particular stimulus is measured.
Past experience suggests that the variance in reaction times to these types
of stimuli is 4 sec2 and that the distribution of reaction times is
approximately normal. The average time for the subjects is 6.2 seconds.
Give an upper 95% bound for the mean reaction time.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 14
The Case of Unknown σ

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 15
The Case of Unknown σ

I Recall that if we have a random sample from a normal distribution,

X̄ − µ
T = √
S/ n

has a Student t−distribution with n − 1 degrees of freedom.


I When σ is unknown, T can be used to construct a confidence
interval on µ.
 
P −tα/2 < T < tα/2 = 1 − α,

where tα/2 is the t−value with n − 1 degrees of freedom.

S S
 
P X̄ − tα/2 √ < µ < X̄ + tα/2 √ = 1 − α.
n n

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 15
The Case of Unknown σ


Figure: P −tα/2 < T < tα/2 = 1 − α

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 16
The Case of Unknown σ

Confidence Interval on µ, σ 2 Unknown


If x̄ and s are the mean and standard deviation of a random sample from
a normal population with unknown variance σ 2 , a 100 (1 − α) %
confidence interval for µ is
s s
x̄ − tα/2 √ < µ < x̄ + tα/2 √ ,
n n

where tα/2 is the t−value with ν = n − 1 degrees of freedom, leaving an


area of α/2 to the right.

I One-sided confidence bounds for µ with σ unknown are


s s
x̄ + tα √ and x̄ − tα √
n n
where tα is the t−value having an area of α to the right.
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 17
Standard Error of a Point Estimate

I Recall that the measure of the quality of an unbiased estimator is its


variance.
I The standard error of an estimator is its standard deviation. For X̄ ,
computed confidence limit
σ
x̄ ± zα/2 √ is written as x̄ ± zα/2 s.e. (x̄ ) ,
n

where “s.e.” is the “standard error”.


Confidence Limits on µ, σ 2 Unknown

s
x̄ ± tα/2 √ = x̄ ± tα/2 s.e. (x̄ )
n

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 18
Prediction Intervals
I Assume the random sample from a normal population with unknown
µ and known σ 2 .
I To predict a new observation, we need to take into account
I variation due to estimating the mean
I variation of a future observation.

I The variance of the random error in a new observation is σ 2 .


I The new observation, x0 , and x̄ are independent,
x0 − x̄ x0 − x̄
z=q = q √
σ 2 + σ 2 /n σ 1 + 1/ n
is n (z; 0, 1). As a result,
 
P −zα/2 < Z < zα/2 = 1 − α

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 19
Prediction Interval

Prediction Interval of a Future Observation, σ 2 Known


For a normal distribution of measurements with unknown mean µ and
known variance σ 2 , a 100 (1 − α) % prediction interval of a future
observation x0 is
q q
x̄ − zα/2 σ 1 + 1/n < x0 < x̄ + zα/2 σ 1 + 1/n

where zα/2 is the z−value leaving an area of α/2 to the right.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 20
Prediction Interval

Prediction Interval of Future Observation, σ 2 Unknown


For a normal distribution of measurements with unknown µ and unknown
σ 2 , a 100 (1 − α) % prediction interval of a future observation x0 is
q q
x̄ − tα/2 s 1 + 1/n < x0 < x̄ + tα/2 s 1 + 1/n

where tα/2 is the t−value with ν = n − 1 degrees of freedom, leaving an


area of α/2 to the right.

I One-sided prediction intervals can also be constructed.


q
Upper bound: x̄ + tα s 1 + 1/n
q
Lower bound: x̄ − tα s 1 + 1/n

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 21
Prediction Limits for Outlier Detection

I Majority of the time, we deal with outlier observations, faulty or bad


data.
I Outlier can be considered as an observation that comes from a
population with a mean that is different from the mean that governs
the rest of the sample of size n being studied.
I Outlier detection methodology: an observation is an outlier if it falls
outside the prediction interval computed without including the
questionable observation in the sample.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 22
Exercise

A machine produces metal pieces that are cylindrical in shape. A sample


of these pieces is taken and the diameters are found to be 1.01, 0.97, 1.03,
1.04, 0.99, 0.98, 0.99, 1.01, and 1.03 cms. Use these data to calculate to
calculate the intervals below. Assume an approximately normal
distribution. The sample mean and standard deviation for the given data
are x̄ = 1.0056 and s = 0.0246.
(a) Find a 99% confidence interval on the mean diameter.

(b) Compute a 99% prediction interval on a measured diameter of a single


metal piece taken from the machine.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 23
Estimating the Difference between Two Means

I If we have two populations with means µ1 and µ2 and variances σ12


and σ22 , a point estimator of the difference between the means is
given by the statistic X̄1 − X̄2 .
I The probability of 1 − α that
 
X̄1 − X̄2 − (µ1 − µ2 )
Z= q
σ12 /n1 + σ22 /n2

will fall between −zα/2 and zα/2


   
X̄1 − X̄2 − (µ1 − µ2 )
P −zα/2 < q < zα/2  .
σ12 /n1 + σ22 /n2

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 24
Estimating the Difference between Two Means

Confidence Interval for µ1 − µ2 , σ12 and σ22 Known


If x̄1 and x̄2 are means of independent random samples of sizes n1 and n2
from populations with known variances σ12 and σ22 , respectively, a
100 (l − α) % confidence interval for µ1 − µ2 is given by
s s
σ12 σ22 σ12 σ22
(x̄1 − x̄2 ) − zα/2 + < µ1 − µ2 < (x̄1 − x̄2 ) + zα/2 +
n1 n2 n1 n2

where zα/2 is the z−value leaving an area of α/2 to the right.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 25
Variances Unknown but Equal

σ12 and σ22 are unknown, but σ12 = σ22 = σ 2 .


 
X̄1 − X̄2 − (µ1 − µ2 )
Z= q
σ 2 [(1/n1 ) + (1/n2 )]

is standard normal variable.


(n1 − 1) S12 (n2 − 1) S22
V = +
σ2 σ2
has chi-squared distribution with ν = n1 + n2 − 2 degrees of freedom.
  s
X̄1 − X̄2 − (µ1 − µ2 ) (n1 − 1) S12 + (n2 − 1) S22
T = q /
σ 2 [(1/n1 ) + (1/n2 )] σ 2 (n1 + n2 − 2)

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 26
Variances Unknown but Equal

Pooled Estimate of Variance

(n1 − 1) S12 + (n2 − 1) S22


Sp2 =
n1 + n2 − 2
Using the T statistic,
 
P −tα/2 < T < tα/2 = 1 − α,

where tα/2 is the t−value with n1 + n2 − 2 degrees of freedom, above


which we find an area of α/2, and T is given below
 
X¯1 − X¯2 − (µ1 − µ2 )
T = p
Sp (1/n1 ) + (1/n2 )

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 27
Variances Unknown but Equal

Confidence Interval for µ1 − µ2 , σ12 = σ22 but Both Unknown


If x̄1 and x̄2 are the means of independent random samples of sizes n1 and
n2 , respectively, from approximately normal populations with unknown but
equal variances, a 100 (1 − α) % confidence interval for µ1 − µ2 is given by
s s
1 1 1 1
(x̄1 − x̄2 ) − tα/2 sp + < µ1 − µ2 < (x̄1 − x̄2 ) + tα/2 sp + ,
n1 n2 n1 n2

where sp is the pooled estimate of the population standard deviation and


tα/2 is the t−value with ν = n1 + n2 − 2 degrees of freedom, leaving an
area of α/2 to the right.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 28
Variances Unknown and Not Equal

Confidence Interval for µ1 − µ2 , σ12 6= σ22 and Both Unknown


If x̄1 and s12 and x̄2 and s22 are the means and variances of independent
random samples of sizes n1 and n2 , respectively, from approximately
normal populations with unknown and unequal variances, an approximate
100 (1 − α) % confidence interval for µ1 − µ2 is given by
s s
s12 s2 s12 s2
(x̄1 − x̄2 ) − tα/2 + 2 < µ1 − µ2 < (x̄1 − x̄2 ) + tα/2 + 2
n1 n2 n1 n2

where tα/2 is the t−value with


2
s12 /n1 + s22 /n2
ν=h 2 i h 2 i
s12 /n1 / (n1 − 1) + s22 /n1 / (n2 − 1)

degrees of freedom, leaving an area of α/2 to the right.


İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 29
Paired Observations

I Now, we consider the difference of two means when the samples are
not independent and the variances of the two populations are not
necessarily equal.
I This situation is named as paired observations.
I A pair of observation is received.
I Using paired may reduce experimental error variance.
I i−th pair difference

Di = X1i − X2i

Var (Di ) = Var (X1i − X2i ) = σ12 + σ22 − 2Cov (X1i , X2i )

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 30
Paired Observations

I Pairing reduces variance and hence reduces the standard error of the
point estimate.
I Degrees of freedom are also reduced since it’s a one-sample problem
now.

Confidence Interval for µD = µ1 − µ2 for Paired Observations


If d̄ and sd are the mean and standard deviation, respectively, of the
normally distributed difference of n random pairs of measurements, a
100 (1 − α) % confidence interval for µD = µ1 − µ2 is
sd sd
d̄ − tα/2 √ < µD < d̄ + tα/2 √
n n

where tα/2 is the t−value with ν = n − 1 degrees of freedom, leaving an


area of α/2 to the right.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 31
Single Sample: Estimating a Proportion
I A point estimator of the proportion p in a binomial experiment is
given by the statistic P̂ = X /n, where X represents the number of
successes in n trials.
I If p is not too close to 0 or 1, a confidence interval can be established
considering the sampling distribution of P̂.
I Failure is represented by 0 and success is 1. Then, the number of
successes x is the sum of n values.
I For sufficiently large n, the Central Limit Theorem suggests that P̂ is
approximately normal with mean
X np
   
µP̂ = E P̂ = E = =p
n n
and variance
σ2 npq pq
σP̂2 = σX2 /n = X2 = 2 = .
n n n
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 32
Confidence Interval for p

Large-Sample Confidence Intervals for p


If p̂ is the proportion of successes in a random sample of size n and
q̂ = 1 − p̂, an approximate 100 (1 − α) % confidence interval, for the
binomial parameter p is given by (method 1)
s s
p̂q̂ p̂q̂
p̂ − zα/2 < p < p̂ + zα/2
n n

where zα/2 is the z-value leaving an area of α/2 to the right.

I When n is small and p is believed to be close to 0 or to 1, this


confidence interval procedure should not be used.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 33
Single Sample: Estimating the Variance

I If a sample of size n is drawn from a normal population with variance


σ 2 , computed sample variance s 2 is a point estimate of σ 2 .
I The statistic S 2 is called an estimator of σ 2 .
I An interval estimate of σ 2 can be found using

(n − 1) S 2
X2 = .
σ2

 
P χ21−α/2 < X 2 < χ2α/2 = 1 − α

where χ21−α/2 and χ2α/2 have chi-squared distribution with n − 1


degrees of freedom.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 34
Single Sample: Estimating the Variance

 
Figure: P χ21−α/2 < X 2 < χ2α/2 = 1 − α

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 35
Single Sample: Estimating the Variance

Confidence Interval for σ 2


If s 2 is the variance of a random sample of size n from a normal
population, a 100 (1 − α) % confidence interval for σ 2 is

(n − 1) s 2 2 (n − 1) s 2
< σ <
χ2α/2 χ21−α/2

where χ2α/2 and χ21−α/2 are χ2 −values with ν = n − 1 degrees of freedom,


leaving areas of α/2 and 1 − α/2, respectively, to the right.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 36
Estimating the Ratio of Two Variances

I A point estimate of the ratio of two population variances σ12 /σ22 is


given by the ratio s12 /s22 .
I If σ12 and σ22 are the variance of normal populations, an interval
estimate of σ12 /σ22 can be found using the statistic

σ22 S12
F =
σ12 S22

has F-distribution with ν1 = n1 − 1 and ν2 = n2 − 1 degrees of


freedom.

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 37
Estimating the Ratio of Two Variances

 
Figure: P f1−α/2 (v1 , v2 ) < F < fα/2 (v1 , v2 ) = 1 − α
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 38
Estimating the Ratio of Two Variances

Confidence Interval for σ12 /σ22


If s12 and s22 are the variances of independent samples of sizes n1 and n2 ,
respectively, from normal populations, then 100 (1 − α) % confidence
interval for σ12 /σ22 is

s12 1 σ12 s12


< < f (ν2 , ν1 ) ,
s22 fα/2 (ν1 , ν2 ) σ22 s22 α/2

where fα/2 (ν1 , ν2 ) is an f-value with ν1 = n1 − 1 and ν2 = n2 − 1 degrees


of freedom, leaving an area of α/2 to the right, and fα/2 (ν2 , ν1 ) is a
similar f-value with ν2 = ν2 − 1 and ν1 = n1 − 1 degrees of freedom.

Note:
1
f1−α (ν1 , ν2 ) =
fα (ν2 , ν1 )

İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 39

You might also like