algebraic statistics seminar, november 14th 2018 stéphanie...

50
Statistics Primer Algebraic Statistics Seminar, November 14th 2018 Stéphanie van der Pas

Upload: others

Post on 14-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Statistics PrimerAlgebraic Statistics Seminar, November 14th 2018Stéphanie van der Pas

Page 2: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Overview

Statistical models Estimation Hypothesis testing Bayesian

statistics

Page 3: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Overview

Statistical models Estimation Hypothesis testing Bayesian

statistics

Page 4: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Statistical inferenceGoal: infer properties of a population, based on a sample.

Page 5: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Statistical modelsDef: A statistical model is a collection of probability distributions or density functions on a given outcome space.

Def: A parametric statistical model is a collection of probability distributions or density functions that can be described with a finite number of parameters. Notation:

{pθ : θ ∈ Θ}parameter space

Page 6: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Example of a parametric model duration in minutes of telephone call between employee m and customer i.

Assumption: for every m,

Model:

Outcome space:

Parameter space:

Xmi =

Xm1 , Xm

2 , …, Xmnm i.i.d. Exp(λm)

{pλ : pλ(x) = λe−λx, x ≥ 0, λ > 0}

minutes

count

employee 1

minutes

count

employee 2

!6

77¥777*00

[ o, a )

( o , a )

Page 7: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

An i.i.d. sampleDef: If each have the same probability distribution, say with distribution or density , and are mutually independent, then is and independent and identically distributed sample, often abbreviated as

Then the joint distribution of the is determined by the marginal distribution.

X1, X2, …, Xnpθ

D = X1, X2, …, Xn

X1, X2, …, Xn i.i.d

X1, X2, …, Xn

Xi N the i. i. d.

-

←.

Polk , , . . - , xn ) = IT pocxi )

Page 8: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Nonparametric and semi-parametric statistical models

Def: A statistical model is nonparametric if it cannot be parametrized by a finite number of parameters.

Ex: The collection of all distributions with mean equal to zero.

Def: A statistical model is semi-parametric if it has both a parametric and a nonparametric component.

Ex: The Cox-model, which contains all densities with hazard functions of the form

λ(t ∣ X = x) = λ(t)eβT x = λ(t)e ∑pj= 1 βjxj .②Para me En ,

non parametric

Page 9: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Overview

Statistical models Estimation Hypothesis testing Bayesian

statistics

Page 10: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Estimation

Page 11: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Parameter estimation

0 2 4 6 8

0.0

0.1

0.2

0.3

0.4

0.5

0.6

0 1 2 3 4 5

0.0

0.1

0.2

0.3

0.4

0.5

−2 0 2 4

0.0

0.1

0.2

0.3

0.4

!11

Ncm ,i ) Expo )

Gamma Ca, p )

Page 12: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Estimator / statisticModel , data X.

Def: An estimator / statistic is a stochastic vector that only depends on the data and known quantities. The corresponding estimate after observing x is

{pθ : θ ∈ Θ}

θ (X)

θ (x) .e. g . Xi ,

- - -

, Xn i. i. d. Expat )

Ifk, - ,Xn ) = I is an estimator

ICH , - →Xn ) =

znot an estimator

Page 13: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Estimation - method of momentsIf are i.i.d. with finite mean , then:

X1, X2, … μ

ℙ ( limn→∞

1n

n

∑i= 1

Xi = μ) = 1.

Page 14: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

MomentsDef: The jth moment of a random variable X, with distribution dependent on , is if it exists.

Ex:

θ *θ[Xj]

first moment

second moment

third moment

*θ[X]

*θ[X2]

*θ[X3]

!14

density X

tJoc . Po Cx ) dx

5×2 . pack doc

5×3 - po Gc ) doc

Page 15: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Empirical momentsDef: The jth empirical moment of i.i.d. random variables is

Vb:

X1, X2, …, XnXj = 1

n

n

∑i= 1

(Xi) j

first empirical moment

second empirical moment

third empirical moment

X = 1n

n

∑i= 1

Xi

X2 = 1n

n

∑i= 1

(Xi)2

X3 = 1n

n

∑i= 1

(Xi)3

!15

Page 16: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Method of moments

1. Compute the moments, starting from the first, until you have k moments depending on .

2. Replace the moments by their empirical counterparts and replace the parameters by their estimators, and solve the system.

Let θ ∈ ℝk, θ = (θ1, θ2, …, θk)

θ

!16

Page 17: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Example 1: exponential distributionX1, X2, …, Xn i.i.d. Exp(λ), pλ(x) = λe−λx, *[Xi] = 1

λ0 2 4 6 8

0.0

0.1

0.2

0.3

0.4

0.5

0.6

!17

D KICK ] -

- IT

27 I = IT , so I = ¥

I Ga, . . . pal -

¥

Page 18: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Example 2: uniform distributionX1, X2, …, Xn i.i.d. Unif[0, θ], pθ(x) = 1

θ1{0 ≤ x ≤ θ}

!18

Page 19: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Estimation - maximum likelihoodDef: Let X be a stochastic vector with probability mass function or density which depends on a parameter

The likelihood function is the function given by

Def: The log-likelihood function is the logarithm of the likelihood function, denoted by

Def: The score function is the gradient of the log-likelihood function.

pθ, θ ∈ Θ .

L : Θ → ℝ

L(θ ∣ x) = pθ(x) .

ℓ(θ ∣ x) = log L(θ ∣ x) .

Page 20: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Example: binomial probability mass function

As a pmf, we view as a function of for givenE.g. with n = 5:

X ∼ Bin(n, p)pp(x) = ℙp(X = x) = (n

x) px(1 − p)n−x

pp(x) x, p .

x

ℙ0.5(X = x)

x

ℙ0.7(X = x)p -

- o. 7

Page 21: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Binomial likelihood

We view as a function of , for given

X ∼ Bin(n, p)pp(x) = ℙp(X = x) = (n

x) px(1 − p)n−x

pp(x) x .p

p

L(p; x = 1)

p

L(p; x = 3)pH =3 ) it

÷"÷¥"

a

!

o i o Ia I

Page 22: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

The MLEDef: The maximum likelihood estimator (MLE) for is the maximizer of the likelihood function.

θ

p

L(p; x = 1)

p

L(p; x = 3)

Aia.

Page 23: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Example MLEX1, X2, …, Xn i.i.d Exp(λ)X -

LAH IIPxcxi ) -

- II te-txi.hn e-III. ai

la )= n log X- t II Xi

(G) = I - II. xi . e''

Al -- Fi

e' ( I ) .

- o yields I = ¥

:-,¥

Page 24: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Overview

Statistical models Estimation Hypothesis testing Bayesian

statistics

Page 25: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Hypothesis testing

Page 26: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Van‘tVeeretal.(2002),GeneExpressionProfilingPredictsClinicalOutcomeofBreastCancer,Nature415,530-536.

Page 27: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Model and hypothesesModel:

Common hypotheses if

Typically, the aim is to reject H0.

{pθ : θ ∈ Θ},H0 : θ ∈ Θ0H1 : θ ∈ Θ1

Θ0 ⊂ Θ, Θ1 = Θ\Θ0

θ ∈ ℝ :

H0 : θ = θ0H1 : θ ≠ θ0

H0 : θ ≤ θ0H1 : θ > θ0

H0 : θ ≥ θ0H1 : θ < θ0

Page 28: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Conclusions and errorsPossible conclusions:- reject H0- do not reject H0

Errors:

reject H0 do not reject H0

H0 correct

H0 not correct

type I Cal ✓

✓ type I (B)

Page 29: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Ho : pt is net pregnant

Page 30: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Hypothesis testing - conceptIf a patient has Klinefelter syndrome,then the patient has XXY chromosomes.

If a genetical test indicates that a tall man with weak muscles does not have an extra X chromosome,

then the patient does not have Klinefelter syndrome.

go

observation

we reject Ho

Page 31: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Hypothesis testing - conceptIf a patient has Klinefelter syndrome,then it is very unlikely that the patient is fertile.

If a tall man with weak muscles is fertile,then…?

Page 32: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Hypothesis testing - conceptIf a patient has Klinefelter syndrome,then it is very unlikely that the patient is fertile.

If a tall man with weak muscles is fertile,then the patient probably does not have Klinefelter syndrome.

Page 33: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Statistical test and rejection regionA statistical test is given by a rejection region K.

H0 is rejected if and only if the observation is in K.

Page 34: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Example

Test:

How to choose c?

X1, X2, …, Xn i.i.d. 0(μ, σ2)H0 : μ ≤ μ0H1 : μ > μ0

jenown

reject Ho if Iza for some C EIR

Lk = { ( x , , - - - ,xn7 E IR"

i I Z C }

Page 35: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Size and powerA test is of size α if

The power of a test is the probability of rejecting H0 as a function of θ:

supθ∈Θ0

ℙθ(X ∈ K) = α

θ ↦ ℙθ(X ∈ K)

" We got the i - P"

-

Ho is rejected-

type I error

-

Ho is rejectedFor O e ④i :

Po CX Ek ) = I - 1Pa CX # k ) = I - Bt type I enron

prob

Page 36: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Power

ℙθ(X ∈ K)

θ

ideal

i -- - -

--

#

a

.----=¥#⇒ ④

,

Page 37: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

“p-Value Wars”

Page 38: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

p-value

Page 39: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

p-valueIntuition: the p-value is the probability of the observations, or even more unexpected ones, if H0 is true.

General definition, relative to a collection of tests indexed by their size α: smallest value of α for which H0 would be rejected.

K

x

Page 40: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

p-value: special cases

Page 41: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Overview

Statistical models Estimation Hypothesis testing Bayesian

statistics

Page 42: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Bayesian statistics

Page 43: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

McGrayne (2012). The Theory That Would Not Die: How Bayes' Rule Cracked the Enigma Code, Hunted Down Russian Submarines, and Emerged Triumphant from Two Centuries of Controversy.

Page 44: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Bayesian statistics

prior distribution of .θ

likelihood .

Bayes’ rule . posterior distribution of .θ

Page 45: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Bayes’ rule - discrete versionFor events A and B, such that

Example: A = persoon has HIV B = HIV-test of a person is positive

ℙ(B) ≠ 0 :

ℙ(A ∣ B) = ℙ(B ∣ A)ℙ(A)ℙ(B)

= ℙ(B ∣ A)ℙ(A)ℙ(B ∣ A)ℙ(A) + ℙ(B ∣ Ac)ℙ(Ac)

"

priona

O

Page 46: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Bayes rule, continuous versionFor a parametric model {pθ : θ ∈ Θ}

π(θ ∣ X = x) = pθ(x)π(θ)∫Θ pθ(x)π(θ)dθ

livelihood prionI d

p ← marginalposterior distribution

Page 47: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

ExampleCoin with probability of heads equal to . We observe x heads in n coin tosses.

Prior on : Unif[0, 1]

θ

θ Ii !¥i .

17 Col = I . A Eo EO E i }

Po Cx ) -

- (2) a" a - o )

n - x ( binomial )

(2) a" a - a)

n - K I fo so ee }real X = x ) = -

§ (2) ok - a)n - K Aloe Oei ] die

O" a - a) n - x

- A lo EOE I }= ! C , - cash

- ' 'do

Page 48: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Examplexx - l G - se ,

At

Beta C a, p ) - density pa

,

C x ) =

-

E- ' a - a) Aid , ,

A losses , }

IX

a - 6) h - x

nColX=xI=-

Joke, - asn - sandy

# IOEOEI )

So the posterior is a

Beta Cacti,

n - xtc ) distribution

Page 49: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

What do we do with the posterior distribution?

'

I-

Page 50: Algebraic Statistics Seminar, November 14th 2018 Stéphanie ...pub.math.leidenuniv.nl/~winterrl/181107_Algebraic_Statistics_with... · Algebraic Statistics Seminar, November 14th

Overview

Statistical models Estimation Hypothesis testing Bayesian

statistics