CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased...

15
CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro [email protected] 1

Transcript of CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased...

Page 1: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

CSE 312

Foundations of Computing IILecture 25: Biased Estimation, Confidence Interval

Stefano Tessaro

[email protected]

1

Page 2: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

A Warning

• Statistics literature full of (somewhat redundant) jargon• Don’t get confused when looking up extra materials– Do refer to the slides for what you actually need to know

2

Page 3: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

Parameter Estimation – Workflow

3

Distributionℙ(#|%)

Independent samples #', … , #*from ℙ(#|%)

Algorithm +%

Parameter estimate

% = unknown parameter

Maximum Likelihood Estimation (MLE). Given data #', … . , #*, find +% = +%(#', … , #*) (“the MLE”) such that . #', … . , #* +% is maximized!

Page 4: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

Likelihood – Continuous Case

4

Definition. The likelihood of independent observations #', … . , #* is

. #', … . , #* % =/01'

*

2(#0|%)

Normal outcomes #', … , #*

+%34 =16701'

*

#0 − +%9:

+%9 =∑0* #06

MLE estimator for expectation

MLE estimator for variance

Page 5: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

Consistent Estimators & MLE

5

Definition. An estimator is unbiased if < =Θ* = % for all 6 ≥ 1.

Distributionℙ(#|%)

samples @',… , @*from ℙ(#|%) Algorithm =Θ*

Parameter estimate

% = unknown parameter

Definition. An estimator is consistent if lim*→E

< =Θ* = %.

Theorem. MLE estimators are consistent. (But not necessarily unbiased)

Page 6: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

Example – Consistency

6

Normal outcomes @',… , @* iid according to F(G, H:)

=ΘIJ

=16701'

*

@0 − =Θ9:

Assume: H: > 0

M*: =1

6 − 1701'

*

@0 − =Θ9:

Sample variance – Unbiased!

=ΘIJ converges to same value as M*:, i.e., H:, as 6 → ∞.

Population variance – Biased!

=ΘIJ is “consistent”

Page 7: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

Why is the estimator consistent, but biased?

7

<(=ΘIJ) =16701'

*

< @0 − =Θ':

linearity

=16701'

*

< @0 −167O1'

*

@O

:

=16701'

*

< @0: −

26@07

O1'

*

@O +16:7O1'

*

@O 7R1'

*

@R

Page 8: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

Why is the estimator consistent, but biased?

8

<(=ΘIJ) =16701'

*

< @0 − =Θ':

linearity

=16701'

*

< @0 −167O1'

*

@O

:

= 1 −16H:

=6 − 16

H:

Therefore: <(M*:) ='

*S'∑01'* < @0 − =Θ'

:=

*

*S'< =ΘIJ = H:

→ H: for 6 → ∞

Bessel’s correction

Page 9: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

Estimation – Confidence Intervals

Unbiasedness/consistency are not sufficient by themseleves.• We want ℙ(=Θ* = %) = 1– At least as 6 → ∞

– Note that =Θ* is continuous for Gaussian, so ℙ(=Θ* = %) = 0

• Relaxation: Find smallest Δ such that ℙ =Θ* − % ≤ Δ ≥ Vfor a given V– We say that Δ gives us the V-confidence interval

– e.g., 95%-confidence interval means V = 0.95

9

Page 10: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

Mean Estimator for Normal – Known Variance

10

Normal outcomes: @',… , @* iid according to F(G, H:), known H:.

=Θ9,* =∑01'* @06

Q: which distribution?

A: Normal! • Expectation '

Y6 ⋅ G = G

• variance 'YJ6H: =

IJ

*

Therefore: =[\,]S9

I/ *∼ F(0,1)

Page 11: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

Mean Estimator for Normal – Known Variance

11

Normal outcomes: @',… , @* iid according to F(G, H:), known H:.

=Θ9,* =∑01'* @06

=Θ9,* − G

H/ 6∼ F(0,1)

ℙ −` <=Θ9,* − G

H/ 6< ` = Φ ` − Φ −` = 1 − 2Φ(−`)

Equivalently: ℙ =Θ9,* − G < `H/ 6 = 1 − 2Φ(−`)

E.g., Φ −1.96 ≈ 5%→ Estimate is within Δ = 1.96H/ 6 of G with probability ≈95% (i.e., “Δ is the 95%-confidence interval”)

Page 12: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

Mean Estimator for Normal – Unknown Variance

12

Normal outcomes: @',… , @* iid according to F(G, H:), unknown H:.

ℙ =Θ9,* − G <fI

*= 1 − 2Φ(−`)

• Still true, but not that useful, as we cannot evaluate H• What about using M* = M*

: instead?

ℙ =Θ9,* − G <fg]*

= 1 − 2Φ(−`) ? • Not true!

=Θ9,* − G

H/ 6~F(0,1)

=[\,]S9

g]/ *~ t-distribution with 6 – 1 degrees of freedom

Page 13: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

Student’s t-Distribution

13

Parametrized by j = degrees of freedom

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

-4 -3 -2 -1 0 1 2 3 4

F(0,1)j = 9

j = 5

j = 1

Notation: kl(`) cdf of t-distribution with j dof’s.

Student,"The probable error of a mean". Biometrika 1908.

Page 14: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

Student?

”Student” was a pseudonym for William

Gosset

• Worked for A. Guinness & Son• Investigated e.g. brewing and barley yields• Wasn’t allowed to publish with real name

14

Source: Wikipedia

Page 15: CSE 312 Foundations of Computing II...CSE 312 Foundations of Computing II Lecture 25: Biased Estimation, Confidence Interval Stefano Tessaro tessaro@cs.washington.edu 1 A Warning •Statistics

Mean Estimator for Normal – Unknown Variance

15

Therefore: ℙ =Θ9,* − G < `M*/ 6 = 1 − 2Ψ*S'(−`)

E.g., ΨnS' 0.05 ≈ 2.26→ Estimate is within 2.26M*/ 6 of G with probability ≈ 95%