Distribuzioni continue

Introduzione alla statistica in Python

Maggie Matsui

Content Developer, DataCamp

In attesa dell'autobus

timeline dalle 13:00 alle 14:00 con 6 arrivi di bus, uno ogni 12 min

Introduzione alla statistica in Python

Distribuzione uniforme continua

Assi con tempo di attesa sull'asse x

Introduzione alla statistica in Python

Distribuzione uniforme continua

L'asse Y diventa P(outcome = wait time) con una linea orizzontale a 1/12 su tutto il grafico

Introduzione alla statistica in Python

Probabilità = area (ancora)

$$P(4 \le \text{wait time} \le 7) = ~~ ?$$

Area tra 4 e 7 evidenziata sotto la linea orizzontale

Introduzione alla statistica in Python

Probabilità = area (ancora)

$$P(4 \le \text{wait time} \le 7) = ~~ ?$$

Larghezza area evidenziata 7-4=3, altezza 1/12

Introduzione alla statistica in Python

Probabilità = area (ancora)

$$P(4 \le \text{wait time} \le 7) = 3 \times 1/12 = 3/12$$

Larghezza area evidenziata 7-4=3, altezza 1/12

Introduzione alla statistica in Python

Distribuzione uniforme in Python

$$ P(\text{wait time} \le 7)$$

Area evidenziata da 0 a 7 sotto la linea orizzontale

from scipy.stats import uniform

uniform.cdf(7, 0, 12)
0.5833333
Introduzione alla statistica in Python

Probabilità "maggiore di"

$$ P(\text{wait time} \ge 7) = 1 - P(\text{wait time} \le 7)$$

Area evidenziata da 7 a 12

from scipy.stats import uniform
1 - uniform.cdf(7, 0, 12)
0.4166667
Introduzione alla statistica in Python

$$ P(4 \le \text{wait time} \le 7)$$

Area evidenziata da 4 a 7

Introduzione alla statistica in Python

$$ P(4 \le \text{wait time} \le 7)$$

Area evidenziata da 0 a 7

Introduzione alla statistica in Python

$$ P(4 \le \text{wait time} \le 7)$$

Area 0-4 leggermente evidenziata, 4-7 evidenziata più scura

from scipy.stats import uniform
uniform.cdf(7, 0, 12) - uniform.cdf(4, 0, 12)
0.25
Introduzione alla statistica in Python

Area totale = 1

$$P(0 \le \text{wait time} \le 12) = ~~ ?$$

Larghezza distribuzione = 1, altezza = 1/12

Introduzione alla statistica in Python

Area totale = 1

$$P(0 \le \text{outcome} \le 12) = 12 \times 1/12 = 1$$

Larghezza distribuzione = 1, altezza = 1/12

Introduzione alla statistica in Python

Generare numeri casuali da una uniforme

from scipy.stats import uniform
uniform.rvs(0, 5, size=10)
array([1.89740094, 4.70673196, 0.33224683, 1.0137103 , 2.31641255,
       3.49969897, 0.29688598, 0.92057234, 4.71086658, 1.56815855])
Introduzione alla statistica in Python

Altre distribuzioni continue

 

Distribuzione con 2 picchi

 

Distribuzione a campana

Introduzione alla statistica in Python

Altre distribuzioni continue

 

Area sotto la curva evidenziata con testo: area = 1

 

Area sotto la curva a campana evidenziata con testo: area = 1

Introduzione alla statistica in Python

Altri tipi di distribuzioni speciali

Distribuzione normale

Grafico della distribuzione normale

Distribuzione esponenziale

Grafico della distribuzione esponenziale

Introduzione alla statistica in Python

Ayo berlatih!

Introduzione alla statistica in Python

Preparing Video For Download...