Docsity

Inferential Statistics ( INTECO), Appunti di Statistica Inferenziale

Toggle sidebar
bg1
INFERENTIAL STATISTICS – WEEK 1
LESSON 1 – 2 - 3
Statistics is the art of learning from data. It is concerned with the collection of data, their
subsequent description and their analysis which often leads to drawing conclusion.
1. The part of statistics concerned with the description and summarization of data is
called DESCRIPTIVE STATISTICS
2. The part of statistics concerned with the drawing of conclusion from data is called
INFERENTIAL STATISTICS
EXAMPLE
We toss a coin 10 times and we get the sequence T T T H T H T T T T
- Descriptive approach: we can summarise the outcome of the experiment by
computing the proportion of TAILS we obtained, that is 80%
- Inferential approach: 80% of TAILS: can we say that the coin is not fair? or the coin is
fair and 80% of TAILS can be explained by chance?
The possibility of chance must be considered for an inferential approach: we can’t just
use the data found with the descriptive approach.
It is usually necessary to make some assumptions about the chances of obtaining the
different data values, the totality of these assumption is referred to as a probability
model for the data
PROBABILITY THEORY FOR STATISTICAL INFERENCE
Statistical inference starts with the assumption that important aspects of the phenomenon
under study can be described in terms of probabilities and then it draws conclusions by using
data to make inference about these possibilities
Probability theory provides a key tool for statistical inference
POPULATIONS AND SAMPLE
A typical inferential problem consists in drawing conclusion on a population by analysing only a
subgroup of the total
- Total collection of all the element that we are interested in POPULATION
- A subgroup of the population SAMPLE
In order for the sample to be informative about the total population, it must be representative
of that population:
The statistical units composing a sample can be described by random variables.
RANDOM VARIABLES
There are 2 types of random variables:
A sample of k members o
f population is said to be a random sample if the members are
chosen in such a way that all possible choices of the k members are equally likely.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34

Anteprima parziale del testo

Scarica Inferential Statistics ( INTECO) e più Appunti in PDF di Statistica Inferenziale solo su Docsity!

INFERENTIAL STATISTICS – WEEK 1

LESSON 1 – 2 - 3

Statistics is the art of learning from data. It is concerned with the collection of data, their

subsequent description and their analysis which often leads to drawing conclusion.

  1. The part of statistics concerned with the description and summarization of data is

called DESCRIPTIVE STATISTICS

  1. The part of statistics concerned with the drawing of conclusion from data is called 

INFERENTIAL STATISTICS

EXAMPLE

We toss a coin 10 times and we get the sequence T T T H T H T T T T

  • Descriptive approach: we can summarise the outcome of the experiment by

computing the proportion of TAILS we obtained, that is 80%

  • Inferential approach: 80% of TAILS: can we say that the coin is not fair? or the coin is

fair and 80% of TAILS can be explained by chance?

 The possibility of chance must be considered for an inferential approach: we can’t just

use the data found with the descriptive approach.

It is usually necessary to make some assumptions about the chances of obtaining the

different data values, the totality of these assumption is referred to as a probability

model for the data

PROBABILITY THEORY FOR STATISTICAL INFERENCE

Statistical inference starts with the assumption that important aspects of the phenomenon

under study can be described in terms of probabilities and then it draws conclusions by using

data to make inference about these possibilities

Probability theory provides a key tool for statistical inference

POPULATIONS AND SAMPLE

A typical inferential problem consists in drawing conclusion on a population by analysing only a

subgroup of the total

  • Total collection of all the element that we are interested in  POPULATION
  • A subgroup of the population SAMPLE

In order for the sample to be informative about the total population, it must be representative

of that population:

 The statistical units composing a sample can be described by random variables.

RANDOM VARIABLES

There are 2 types of random variables:

A sample of k members of population is said to be a random sample if the members are

chosen in such a way that all possible choices of the k members are equally likely.

1. DISCRETE RANDOM VARIABLE

EXAMPLE: DISCRETE RANDOM VARIABLES

Random experiment: roll of 2 dice

S:sample space = {(1,1)(1,2)(1,3)…}

X: #of 6= number of six out of the two dice

Range of X : {0,1,2}: X can takes these values.

X: R.V

x:number, realization of X

DISTRIBUTION OF X

P(X=0)=

௣௔௜௥௦ ௪௜௧ ௭௘௥௢ ଺

௘௟௘௠௘௡௧௦ ௜௡ ௌ

P(X=1)=

௣௔௜௥௦ ௪௜௧௛ ௢௡௘ ଺

௘௟௘௠௘௡௧௦ ௜௡ ௌ

P(X=2)=

௣௔௜௥௦ ௪௜௧௛ ௧௪௢ ଺

௘௟௘௠௘௡௧௦ ௜௡ ௌ

X P(X=x)

2. CONTINUOUS RANDOM VARIABLES

DEFINITION

Or

A random variable X is discrete if

௫ఢோ

భ

The distribution of the discrete random variables ( of X) is given by the list of probabilities

P(X=x) for all the values in the range of X.

A random variable X is continuous if P(X=x)=0 for all x€ R

A random variable X is continuous if there is a density function f such that:

௕

௔

Whenever a<= b

SAMPLING DISTRIBUTION

We consider a known function h of the sample which defines a new random variable Y that is

Y=h(X 1

X

2

…X

n

  • Y is a random variable( also called statistic, that is function of the observation)
  • The distribution of the observations X 1

X

2

…X

n

induces a distribution on Y

  • The distribution of Y is something called sampling distribution.

WHAT IS THE DISTRIBUTION OF Y?

There are 3 main approaches:

  1. Computing the distribution of Y explicitly from the distribution of the observations X 1

X

2

…X

n

Or we can approximate the distribution of Y in 2 ways:

2. ASYMPTOTIC APPROXIMATION

Generally, it’s easier to study the distribution of Y n

when n  ∞. Then when n is large

we can approximate the distribution of Yn with the one holding when n—> ∞.

3. MONTE CARLO METHOD

We can use Monte Carlo simulation to approximate the distribution of Y

That is we simulate -via computer- a realisation of the sample X1,X2,…,Xn, and based

on the simulated value, we compute one realisation of Y. We repeat the same process

many times and obtain many realisations of Y.

  • By computer we simulate realization of X 1

X

2

…X

n

 we obtain x 1

, x 2

, x n

  • We compute Y = h ( X 1

X

2

…X

n

  • Repeating it many times, for examples n-times, we have n realizations of Y : Y 1

, Y

2

…Y

n

 starting from these we can approximate the distribution of Y ( e.g via histogram)

EXAMPLE n 1

Suppose we have X 1

X

2

i.i.d  they are a random sample of size n = 2 with distribution given by

P(X=1)= ½

P(X=2)= ¼

P(X=3)= ¼

Range of X 1 ,

X

2

And consider the random variable Y defined as :

Y

2

=(X

1,

X

2

1/

S= sample space = {(1,1)(1,2)(1,3)…}

We call random sample a collection of random variables X 1

X

2

…X

n

that are independent and

identically distributed (i.id) from a common distribution(?)

Note that Y is the geometrical mean

of X1,X2: more in general Y n

=(X

1,

X

2

X

n

1/n

Range of Y 2

Now we can compute the exact distribution of Y

But what is the distribution of Y n

if the sample size n is larger? For example, n=20?

S=sample size = 3^20 so the explicit approach is not an option.

We can use the asymptotical approximation.

It’s convenient to work with :

Log ( Yn)= log ((X 1,

X

2

X

n

1/n

ଵ

௡

log

௜

௡

௜ୀଵ

Thanks to the central limit theorem

Log ( Y20) ~N(0,4479;0,1052^2)

Approximation via Monte Carlo simulation.

Replicate nr 1

  1. Simulate realizations of X1…X20 = x1…x
  2. We compute the value taken by Y
  3. We compute ( log( Y20)

Now we repeat the procedure n times so , in this way, we have n values for n repliactes

we approximate the distribution of Y

EXAMPLE N 2

TWO fair dice are rolled

X

1

: out come of die 1

X

2

: out come of die 2

We define a random variable W as : W = X 1

X

2

S= {(1,1)(1,2) (1,3)…}

Range W = {1,2,3,4,5,6,8,9…}

We could compute the exact distribution, proceeding as before

CONVERGES IN PROBABLITY

EXAMPLE

Let Y = 0 and define the sequence of random variables {Xn} as Xn ~Exponential ( n).

Show that {Xn} converges in probability to Y

Firstly, we recall the exponential distribution

We say X n

~Exp( λ), λ > 0 if its PDF is given by

ି ఒ௫

௫

I.E X is a RV taking values in [0; ∞+] and E[X]= 1/λ

Let X 1

X

2

… be an infinite sequence of random variables also denoted by {X n

} and another variable Y.

we say that the sequence {X N

} converges in probability to Y if, for any ε>

௡→ஶା

𝑃(|𝑋𝑛 − 𝑌| > ε) = 0

We want to show that:

௡→ஶା

ε

Given that

- Y=

  • Xn is non negarive

This could be rewritten as ( f(x) is the PDF of Xn)

P(X

n

ε) = ∫ 𝑓

ାஶ

ఌ

ି ௡௫

ାஶ

ఌ

Solving the integer

= nቂ−

ଵ

௡

ି ௡௫

ఌ

ାஶ

ଵ

௡

ି ௡ஶ

ଵ

௡

ି ௡ఌ

ቃ ൨ = 0 + e

-nε

Then

௡→ஶା

ε

௡→ஶା

ି ௡ఌ

SO Xn  Y

LESSON 3

Say X 1

, X

n

… is an infinite sequence of independent and identically distributed random variable,

coming from a distribution with mean μ and variance Ϭ

2

Consider the average of the first n random variable of the sequence that

Mn=

ଵ

௡

(X1, +…+Xn)=

ଵ

௡

௜

௡

௜ୀଵ

M

n

is called sample mean ( is also denoted as 𝑥̅ )

What can we say about the distribution of M n

Example

Experiment: sequence of tosses of a fair coin

X

1

,X

2

where X i

The mean of X 1

( or equivalently of X i

, since they are I.ID) is

μ = E[X 1

]=0 * P(X=0) + 1P(X=1) = 0.50 + 0.5*1= 0,5  mean of distribution of each

observation

What’s about M n

Example with continuous random variable

If X is a continuous RV by definition we have a PDF f associated to X

F(X

0

) = P(X≤x 0

௫ ೚

ିஶ

CONVERGES IN DISTRIBUTION

OBSERVATIONS

  • the convergence in probability studies the difference between random variables, the

convergence in distributions studies the difference between distributions ( or CDF)

  • why is this useful? Sometimes studying the distribution of Xn is tricky while studying

that one of Y is easier. If we know that the sequence {Xn} converges in distribution to

Y, then we can use the distribution of Y to approximate that one of Xn (if n is large

enough)

  • How are the two notions of convergences related o each other?

The convergence in P is stronger than the convergence in D

Xn y then Xn y

But if Xn y then it’s not always true that Xn y

EXAMPLE

show that a {Xn} converges in distribution to Y, where:

and 𝑌 ቄ

We want to show that {Xn} Y, that is if lim n→∞ P(Xn ≤ x) = P(Y ≤ x) for any x such that

P(Y=x)=0 (that is, in this case, for every x different from 1)

let X1,X2,… be an infinite sequence of random variables, also denoted by {Xn}, and another random

variable Y. We say that the sequence {Xn} converges in distribution to Y if lim n→∞ P(Xn ≤ x) = P(Y ≤ x)

for any x such that P(Y=x)=

CDF OF Xn

  • If X € (-∞,0) = P(X≤x) = 0
  • If X € [0,1) = P(X≤x) = P( X=0) = 1/n
  • If X € [1,+∞) = P(X≤x) = P( X=0)+ P(X=1) = 1

CDF OF Y

  • if Y € (-∞,1) = P(Y≤x) = 0
  • If Y € [1,+∞) = P(Y≤x) = P( Y=1) = 1

IS THE LIMIT OF P(Xn ≤x) EQUAL TO P(Y≤x)?

We need to check that this is the case for every x different from 1

  • If X € (-∞,0) => lim

௡→ஶ

P(X≤x) = lim

௡→ஶ

0 = 0 = P(Y≤x)

  • If X € [0,1) => lim

௡→ஶ

P(X ≤ x) = lim

௡→ஶ

1/𝑛 = 0 = P(Y≤x)

  • If X € [1,+∞) => lim

௡→ஶ

P(X ≤ x) = lim

௡→ஶ

1 =1 == P(Y≤x)

So {Xn} Y

informal statement of central limit theorem

the sum of n i.i.d. random variables is approximately normal when n is large

or (equivalent statement)

the mean of n i.i.d. random variables is approximately normal when n is large

RECALL: normal distribution

A normal RV takes values on the real line, it is a continuous RV with PDF given by :

,f(x)=

ଵ

√ଶగ⋅ఙ

ି

భ

మ

( ௫ି௨

)

మ

ఙ

మ

  • For μ = 0 and Ϭ

2

= 1 we have the special case of standard normal Z ~𝑁(0,1)

  • It’s a symmetric distribution P(X<μ)= P(X>μ) the median of the distribution is the

mean of the distribution

What can we say about the distribution of Z n

? is it close to normal?

first we observe that, being standardised, Zn has 0 mean and unit variance (like the standard

normal)

THEOREM: CENTRAL LIMIT THEOREM

If X1,X2,… are i.i.d. R.V. with finite mean μ and finite variance σ2, and Z is a standard normal

R.V., then{ Zn} → Z where

Zn =

௑ଵା⋯௑௡ି௡ ∗௨

ఙ∗ √

௡

ௌ௡ି௡ ∗௨

ఙ∗ √

௡

and Z ∼ N(0,1)

WEE K 2 – INFERENTIAL STATISTICS

INTERPRETATION OF THE CENTRAL LIMIT THEOREM

Z

n

 Z

Which means that ( by definition of convergence in distribution)

  •  if we call Z n

is ~N(0,1) we can say 𝑍

~𝑍 ( it’ s informal to say that Zn has

approximately the distribution of Z

  • From CLT we know that

Zn=

ௌ௡ିா [ௌ௡]

ௌ஽(ௌ௡)

ௌ௡ି௡ ∗௨

ఙ∗ √

௡

( standardization of Sn)

RECALL

If X~N(μ,Ϭ

2

) and Y= aX + b

Y~(aμ + b ; a

2

2

- S

n

= Z

n √

௡

ଶ

- S

N

~𝑁(𝑛𝑢; 𝑛𝜎^2)

MOREOVER

௡

ଵ

௡

௡

M

n

is a linear transformation of S

n

 since S

n

is approximately normal, also M

n

will be

approx. normal :

௡

1

𝑛

1

𝑛

ଶ

ଶ

n

3 EQUIVALENT FACTS IMPLIED BY THE CLT

If n is large

n

- S

N

𝑛𝑢; 𝑛𝜎^

PROBLEM:Ϭ the SD of the population distribution ( of X 1

, …X

n

) it is likely to be unknown

beside μ

If we can estimate σ2 with an estimator -say Sn2-, then we have a way to assess the error in

estimating μ

௡

ଶ

௜

௡

ଶ

௡

௜ୀଵ

It has good properties as an estimator of σ

2

-E [𝑆

௡

ଶ

]= σ

2

 The estimator, “ on average” takes the value σ

2

thanks to WLLN, we could show that 𝑆

௡

ଶ

—converges in P  σ

2

REMARK: If we estimate σ2 with Sn2 the (already approximate) distribution of Mn is not

anymore normal but is a student-t. Nonetheless, when n is large, the student-t is

approximated by a normal distribution

S

n

is called sample standard deviation  the 0,95% confidence interval for μ becomes

M

n

± 1.96 ⋅ Sn √

  • This comes from normal distribution
  • When Ϭ is estimated by S n ,

we should look for the equivalent number for the student

  • t distribution
  • If n is large the number of the student-t distribution is anyway ~ 1.

large n confidence intervals with level of confidence 1-α:

Confidence interval M n

± 𝑍𝑎/2 ⋅ Sn √

Level of confidence α α/2 z α/

APPLICATION OF CLT: Normal approximation for the binomial distribution

Recall: Bernoulli and Binomial distributions

BERNOULLI

X~Bernoulli (p), p€[0,1]

If X can take only 2 values, say 0 and 1, (failure and success )with distribution given by

P(X=1)=p and P(X=0)=1-p

E[X] = 1* P(X=1)+0 *P(X=0)= p

VAR[X] = p(1-p)

BINOMIAL DISTRIBUTION

Say X 1,

X

2

X

n

are independent Bernoulli experiments in each experiment p is the probability of

success

Y= X

1,

+X

2

+ X

n

= # success out of n experiments

The distribution of Y is binomial with parameters n, p

Y~Binomial(n,p)

What is the distribution of Binomial ( n,p)?

P(Y= k) for a fixed of k

111…1000..0  examples of outcomes that leads to k success and n-k failure

Probability of this specific sequence

Ppp..p*(1-p)(1-p)… = p

k

( 1-p)

n-k

 each specific sequence with k success and n-k failures will

have P p

k

( 1-p)

n-k

: the order doesn’t matter

P(Y= k)= #sequences with exactly k success  ways we can choose k elements out of n

௡!

௞!

( ௡ି௞

) !

P(Y= k)= = ቀ

ቁ p

k

( 1-p)

n-k

 distribution of binomial ( n,k)

E[Y]= np

VAR[Y]= np(1-p)

APPROXIMATION OF BINOMIAL WITH NORMAL

Y ∼ Binomial(n, p) Y = X1 + X2 + … + Xn = S n

with Xi i.i.d. Bernoulli(p)

We can apply the CLT

Y= S

n

~ N(np,np(1-p)

LESSON 5

EXAMPLE 4.4.

we toss a coin n times and assume the coin is biased towards head. Specifically, n=1000 and

p=0.6. Compute the probability that the number of heads is least 550 and does not exceed

X= n of heads  We want to compute P(550≤X≤ 625)

X=Binomial(n=1000, p=0.6)

It would be possible to compute P(550≤X≤ 625) considering X as a binomial and computing

P(X= 550) +P(X=551)… but the calculation are cumbersome.

But we know that X~apx N(np, np(1-p)

E[X]= np= 600

VAR[X]= np(1-p)= 240

So that X~apx N(600, 240)

P(550≤X≤ 625) = P(X≤ 625)- P(X≤ 549)

଺ଶହା .ହି଺଴଴

√ଶସ଴

ହସଽା଴.ହି଺଴

√ଶସ଴

EXAMPLE CONFIDENCE INTERVAL FOR A POPULATION PORTION

N= 100 students ( sample)

82 = non smokers

We want to estimate the proportion π of non smokers in the population of students

X

1

X

2

X

n

where X 1=

Xi = bernoulli ( π)

E[X]= π

VAR[X]= π(1- π)

Y= X

1

+X

2

+ X

n

= # non smokers in the sample

We know Y~ Binomial (100, π)

Y/n=

ଡ଼ଵ ଡ଼ଶ ଡ଼୬

௡

=Mn= sample mean

By CLT  Mn~ N(π,

஠(ଵି ஠)

௡

Confidence interval of confidence 1-a

Mn±Za/

గ

( ଵିగ

)

௡

A= 0.

଴,଼ ଶ (ଵି଴ ,଼ ଶ )

ଵ଴଴

 [0.721; 0,9191]

MONTECARLO APPROXIMATION

The law of large numbers tells us that the sample mean Mn converges in probabiity to the

population mean μ.

Say μ is unknown. LLN suggests that, conditionally on the observation of a sample X1,X2,…,Xn,

we can use the average of the observations to estimate μ.

Monte Carlo approach: we can “create” observations by using a computer.

Say we want to study some property of a distribution (e.g. the mean μ of the population

distribution): if we know how to simulate realizations from that distribution, we can generate a

sample (as large as we want) and use that to estimate the property of the distribution.

REMARK: number generated with a computer are the result of a sequence of deterministic

operations and therefore they’re not random pseudo random

( in this course we will skip this distinction)

EXAMPLE

let Z~N(0,1) and Y=Z^2 +1. Compute P(2<Y<3)

assume we know how to simulate realizations from a standard normal via computer

say we generate n realization of Z ( with n large)

for zi we can compute the corresponding value taken by y = z^2+

Let’s define the random variables W1,W2,Wn as