




















Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!





















Requisites: Main tools for descriptive statistics
With some exercises
Complementary Material: Exercises with Solutions
the probability of observing a certain (set of values in the) sample
information about the population
[deduction]
[induction, or
inference]
Phenomenon = Population = pot
containing all possible values of X
Data = Sample = n observations extracted
from the population like bullets from the
pot
We follow the mathematical setting and learn the rules to compute probabilities
starting from other probabilities
We only refer to a purely intuitive notion of probability: as measure of the
degree of certainty that we feel about the occurrence of an event
terms of the ratio between the number of outcomes in which the event occurs
Frequentist def.
Subjective def.
A
Ω
A
A
Complement set , called
«not A» , «A negated»
= «non getting 2»
p(A) = 1 / 6
p( ) = 5/
A = «the patient responds to therapy»
The complementary event of A is the
event including al cases when A does not
occur (is FALSE)
A = «getting 2»
p(response) = 0.
p(no response) = 0.
Its probability is the complement to 1 of
p(A):
A
C
A, C disjoint sets
Not-compatible
events
C = «getting 3»
A B
A = «getting even»
B = «getting a number <=3»
A&B = «getting 2»
The intersection of A and B is the
event that includes all cases when
both event A and event B occur (are
A C
A&C = Φ
A, B sets that
intersect
Empty set =
complementary of Ω =
impossible event
The probability of an event A conditional on an event B measures the degree of
expectation about the occurrence of A when we have an information that the event
B occurs.
Independence is reciprocal, thus also p(B|A) = p(B)
In this case we also have independence among all
complementary events
“given B”
“if B is true B”
“knowing that B is true”
“restricting to the cases when B is true”
Events A and B are dependent
Events A and D are independent
A = «getting even»
B = «getting a number <=3»
p(A)= 1 / 2
p(A|B)= 1 / 3
D = «getting a number <=2»
p(A|D)= 1 / 2
In the general population the probability of death due to stroke is 5%;
among obese it is 10%. These info correspond to:
p(“death due to stroke”) = 0.
p(“death due to stroke” | “obese”) = 0.10 [«among» = restriction, condition]
The union of A and B includes all cases
when A occurs or B occurs or both
occur (i.e. it includes also the
intersection)
At least one between A and B is TRUE
A B
A = «getting an even number»
B = «getting a number <=3»
A
B
A U B = «getting 1 or 2 or 3 or 4 or 6»
A, B disjoint sets
A, B sets that
intersect
A B
This formula is simplified when the
events are disjoint, since for them
p(A&B)=0:
A
B
A, B disjoint sets
A, B sets that
intersect
Bart goes to work by public transports. He computed that every day the probability of
arriving late is 15%. What is the probability that Bart arrives on time?
Bart knows also that when there is a strike the probability of being late increases to
40%. How do we write this information formally?
Today there’s a strike. What is the probability that Bart arrives on time?
Tomorrow there will be a strike with probability equal to 30%. What is the probability
that there will be a strike and Bart will arrive late?
Finally, what is the probability that there will be a strike or Bart will arrive late?
p(L)=0.15 p(not L)=1-0.15=0.
p(L | S)=0.4 L and S are dependent events
p(not L | S)=1-0.4=0.
p(S & L) = p(S)∙p(L|S)=0.3 ∙ 0.4 = 0.12 (prob of the intersection of dependent events)
p(S or L) (prob of the union, compatible events)
p(S or L) = p(S)+p(L)- p(S & L) =0.3 + 0.15 - 0.12 = 0.
In a certain population:
•30% of deliveries are done by cesarean cut
What is the probability of having a cesarean delivery or complications?
Events:
Information:
Question:
P(A or B) = p(A) + p(B) – p(A & B)
p(A & B) = p(B|A) ·p(A)=0.5 ·0.2=0.1 (prob. cesarean with /and/ complication)
P(A or B) = 0.2 + 0.3 – 0.1 = 0.
p(A)=0.2 p(B) = 0.3 P(B|A) = 0.
P(A or B)
A = complication; B = cesarean
It is important to understand well the setting:
occurrence of a certain event C
p(C1) prior probability
are the only possible causes of an event E, and
with which probability, P(E|C1) P(E|C2).
updating the probability of C1, as:
p(C1|E) posterior probability
It is a kind of «diagnostic problem»: you observe the symptom E, what is
probability of disease C1?
This «theorem» (Bayes, 1763) is actually a very simple formula that can be derived
from the basic calculation rules (see next). However the logical implications involve
the need of a subjective definition of probability.
From the Bayes theorem a full statistical inference setting alternative to the
frequentist one arises (Bayesian statistics)
p(C1|E) = p(C1&E) / p(E)
P(E) = p(E|C1)∙p(C1)+ p(E|C2)∙p(C2)
p(E|C1)p(C1) p(E|C2) p(C2)
p(E|C1) p(C1)
p(C1 | E)
The ratio of the prior prob. of the
causes C1 and C2 is updated
through the likelihood ratio,
returning the ratio of posterior
probabilities
p(C2)
p(C1)
p(E| C2)
p(E| C1)
p(C2| E)
p(C1 | E)
It is also useful to compare and interpret the probabilities of the causes:
A policy team is investigating on whether Zac is responsible of a theft. Zac denies
and claims he never went to the site where it occurred. So far police estimates that
Zac is guilty with probability 60%.
Today police found Zac’s hair in the theft site. The hair could be found there with
probability 100% if Zac is guilty, however if Zac was not there (not guilty) there is
still a 20% probability that the hair was there. Does the finding of the hair change
the assessment of the police about Zac being guilty? Compute also the odds of
guilt before and after the finding (see next)
Events: Guilty, Not Guilty: G, NG. Finding the hair: F
Information: p (R|A) 0.6 1.0 0.2 p(A
Question1: p(G | F)
Notice that the event F is «decomposed» in the two cases, that Zac is Guilty
or that Zac is Not Guilty, and this is the quantity at the denominator of the
Bayes f-la
p(G)= p(F|G)= p(F|NG)=
p(NG) =0.
Information: p(G)=0.6 p(NG)=0.4 P(F|G)=100% P(F|NG)=0.
Question1: p(G | F)
p(F) = 1.0 ∙0.6+0.2 ∙0.4=0.6+0.08=0.
p(G | F) = 0.6 / 0.608 = 0.882 notice: 0.6 is P(F/G)∙P(G) [num]
Question2: compare the odds of guilt a priori and a posteriori
Pr( ) 1
Pr( )
A
A
Def of ODDS of an event A:
p(C2)
p(C1)
p(E| C2)
p(E| C1)
p(C2| E)
p(C1 | E)
Before the Finding the prob. of Guilty was
«only» 50% higher that the prob of Not-Guilty.
After the Finding it is 7.5 times higher that Zac
is Guilty than that Zac is Not-Guilty
posterior Odds prior Odds
(Unknown)
Situation of
the subject
Result of the diagnostic test
Predictive values:
P(Disease)
«Prevalence»
They are computed using the Bayes f.la
We need to know the prior probability of the
disease
𝑝𝑟 𝐷 𝑇 + =
்ା | ȉ
்ା | ȉ ା ்ା |ഥ^ ȉ ഥ^
=
௦௦ȉ
௦௦ȉ௩ ଵି௦ ଵି௩
𝑝𝑟 𝐷
ഥ 𝑇 − =
்ି |ഥ^ ȉ ഥ
்ି |ഥ^ ȉ ഥ^ ା ் ି | ȉ
=
௦ȉ ଵି
௦ȉ ଵି ௩ ା ଵି ௦௦ ȉ௩
It is estimated that a disease affects 1 person out of 50. Detecting this
disease is invasive. A test based on a blood sample can detect diseased
people with sensitivity = 70% and specificity = 90%. We want to compute the
probability that a person with positive Test is diseased.
Events: PT= positive test ; D = disease
Information: p(PT|D)=0.7 p(not PT|not D) = 0.9 P(D) = 1/50=0.
Clinical question: P(D | PT)
We apply the Bayes formula:
1 − 𝑝𝑟 𝑛𝑜𝑡 𝑃𝑇 𝑛𝑜𝑡 𝐷 1 − 𝑝𝑟(𝐷)
To estimate sensitivity and specificity of a new diagnostic technique we
consider a sample of subjects, that we could classify into “diseased” and “not
diseased” using the exact diagnostic technique. The subjects are then given
the new test, results are:
Test + Test –
Diseased tp fn d
Not Diseased fp tn n-d
tp+fp fn+tn n
n subjects among whom d
diseased, the other (n-d) not
diseased.
Among diseased, tp who got a
positive test are the “true
positive” and fn who got a
negative test are “false negative”.
etc
tp fn
tp
d
tp
sensitivity pT D
est
.
( | )
tn fp
tn
n d
tn
specificit y pT nD
est
.
( | )
Apparently the positive predictive value P(Diseased | Test +) can be estimated
from the table in a straightforward way:
Test + Test –
Diseased tp fn d
Not Diseased fp tn n-d
tp+fp fn+tn n
tp fp
tp
pD T
est
???
.
( | )
This is in general NOT CORRECT! In fact to estimate the predictive value we need to
know (an estimate of) the prevalence of the disease. This is normally NOT the one
that we get from the sample, because the number of Diseased and Not Diseased is
fixed by the investigators, so it does not necessarily reproduce the prevalence in the
population (e.g. often we choose 2-3 Not-Diseased (“controls”) for every Diseased)
The formula above is correct only IF the prevalence in the experiment (=d/n) is equal
to the true prevalence in the population. (In this case, using the formula above or the
Bayes formula will return the same result, but this one is faster)
How to make this
«description» depends on the
type of variable: is X discrete
or continuous?
The tools are similar to those seen in
Descriptive Statistics, i.e. respectively
percentages and density; synthetic
indexes: mean, variance
Prob πj
π
π
…
πk
Values
x
x
…
xk
Discrete r.v. with k modalities x1, x2, … xk
The distribution is
identified by k-
parameters = the
probabilities
πj = Pr(X = xj)
Continuous r.v.
13
12
14
10
The distribution is described by
a density curve f(x) and it is
identified by some parameters
Special case: dichotomous
variable (k=2)
X=0,1 e,g,
event A: False/True
The distribution is
identified by one
parameter only π (= p(A) )
b
a
a b
Given a random variable X, we define expected value the mean of all possible
values (weighted according to their probabilities)
j
j j
( )
E(X) is basically a representative value of all possible values of X, and thus the
value of X that we expect «on average» to get
Notice the similarity with the
f.la of the arithmetic mean of
observed data:
k
j
j j
x xf
1
Further we define the variance of the r.v., which measures the spread of the
possible values around the expected value:
ଶ
ଶ − 𝐸(𝑋)
ଶ
Concept and f.la similar to those
seen in Descriptive Statistics.
N=3 tosses of an unbalanced coin: Pr(Head)=0.3 Pr(Tail)=0.
X = number of Heads
p(X=0)
p(X=1)
p(X=2)
p(X=3)
i
j j
p(X=0) =
p(X=1) =
p(X=2) =
p(X=3) =
i
j j Expected value: EX x p
Binomial with parameters
N=3 and π=0.
0 30 0 3 3
P X
Applying the
f-la of
Bi(3,0.3):
2 32 2 1
PX
N=3 tosses of an unbalanced coin: Pr(Head)=0.3 Pr(Tail)=0.
X = number of Heads
Possible values
of X:
Probability of
the possible
values:
30 tosses of the coin with
Pr(Head)=0.3 Pr(Tail)=0.
X = number of Heads
e.g. p(X = 12)
Binomial with
parameters N=
and p=0.
Applying the
f.la of
Bi(30,0.3):
0. 3 1 0. 3 0. 075
12 3012
P X
12
18
Possible values
of X:
Probability of
the possible
values:
ଶ
E( X)
!
( )
x
e
p X x
x
0
«Law of rare events».
Renown
discrete
r.v.
var(X)
A certain disease occurs only in 1 child out of 1000. Which is the probability
that in a sample of 50 children we observe 1 child with the disease? And that
we observe at least 1 child with the disease?
Random Variable: X = number of children with the disease
Information: p(disease)=π=0.001 number of trials: N=
Questions: Pr(X=1)
We use the Poisson with:
Pr(X>0) = 1- 0.95 = 0.05 = 5%
Pr( 0 )
05
05 0
e
e
X
=Pr(not X=0) = 1-Pr(X=0)
λ=N∙π= 50·0.001 = 0.
Pr(X≥1) =Pr(X=1 or X=2 or …)
05
05 1
05
05 2
Notice the
simplfication of
calculations
using previous
results