












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!













EVENT: A logical entity with can assume one between two values: T or F. Moreover, after the
experiment it's possible to verify whether the event has been T or F. It's something physical, stated by
formula or words, observable. A probability can be assigned to any events.
OBJECTIVE PROBABILITY: Objective probability could be frequentist or logical and it's connected to
the concept of repeatable events. The drawback is that repeatable events does not exist because only
past experiences under identical conditions do exist, so we can have similar but not identical events.
The probability is a physical property of the event. The frequentist probability is related to perform
experiments and the logical one does not require experiments.
SUBJECTIVE PROBABILITY : The subjective probability it's the measure of the degree of plausibility
that's an individual gives to an uncertain events, also to something non observable. And this degree of
plausibility, which has a numeric definition, can be different from an individual to another. In this case
probability is not a physical property of the event but it's a numeric formalization of the beliefs that an
individual has about the event. The probability is seen as a bet, connected to rationality. The subjective
probability of an event E for a certain person, in a certain period, is the price P(E)=p that he considers
right to pay to participate at a bet where you will win 0 if E does not occur and 1 if E occurs. An
important concept is the coherence: a probability assessment about n events is said to be coherent if
no combination of bets of these events is a sure win, independently on the events that will occur. The
subjective prob. P(E) is coherent if and only if 0 ≤P(E)≤ 1 , P(E)=0 impossible event, P(E)=1 certain event.
In addition, the probability of the union of many events is equal to the sum of their probabilities.
KOLMOGOROV FRAMEWORK: It allows computations regarding probabilities with an analogy
between probability and measure and analogy between mathematical expectations and integration
according to Lebesgue. An algebra is defined. A class 𝒜 of subsets of Ω (sample space) is an algebra if
it satisfies three properties:
𝑖
∈ 𝒜 then E
𝑖
𝐶
1
2
⋯ ∈ 𝒜 then ⋃
𝑖
𝑛
𝑖= 1
∈ 𝒜 (finite additivity, for events that are pairwise incompatible)
It’s also important to define the sigma-algebra, which is an algebra with complete additivity (instead of
finite), in fact If 𝐸 1
2
⋯ ∈ 𝒜 then ⋃ 𝐸
𝑖
∞
𝑖= 1
Classical statistics Bayesian statistics
Interpretation
of probability
Probability is viewed as a relative
frequency, based on frequentist
probabilities (repeatable experiments).
Applied to events that can be repeated
under same conditions many times
(consequence: decisions are based on
something that will never be observed).
Probability is a degree of belief or
credibility. The main assumption is that
prior probabilities can be assigned to
events. It can be applied to unique
events and represents the uncertainty
that an observer has about the
phenomenon.
Parameters Considered fixed, but unknown constants Considered random variables with
their own distribution.
Data Considered random. Inference is based
on what could happen in repeated trials.
Considered fixed, once observed.
Inference is based on this specific
sample.
Focus Probability distributions Likelihood/posterior
Inference Relies on the sampling distribution, it
assumes that the experiment could be
Relies on the likelihood principle and
the posterior distribution. It uses a
prior (initial belief),and the experiment
repeated infinitely. The hypothetical
infinite repetitions are a point of criticism.
is performed. The prior is updated with
the likelihood (evidence from the
sample) and a posterior probability
(final belief) is computed. Prior and
posterior may be different, because of
the results of the experiments. All the
evidence is in the likelihood function.
Personal
evaluations
Aims for objectivity, persona evaluations
remain external to the formal model.
Formally incorporates subjective
knowledge through the prior
distribution.
The COMPOUND PROBABILITY THEOREM states that for two events A and B, with 𝑃(𝐵) > 0 , the
conditional probability of A given B is:
This theorem is crucial because it allows probabilities of combined events to be decomposed into
marginal and conditional components and it provides the basis for defining independence since
if A and B are independent then 𝑃(𝐴 ∣ 𝐵) = 𝑃(𝐴).
The BAYES THEOREM follows directly the compound probability theorem.
Let {𝐻 𝑖
𝑖= 1
𝐼
be a partition of the sample space Ω, which means that the elements are pairwise disjoint
and the union of the elements is Ω. Suppose that each 𝐻 𝑖
has a probability 𝑃(𝐻
𝑖
) and consider an
event B with 𝑃(𝐵) > 0. By the LAW OF TOTAL PROBABILITY we have
𝐼
𝑗= 1
𝑗
𝑗
Then, the Bayes theorem:
𝑖
𝑖
𝑖
𝐼
𝑗= 1
𝑗
𝑗
This formula shows how prior probabilities 𝑃(𝐻
𝑖
) are updated by the likelihood 𝑃(𝐵 ∣ 𝐻
𝑖
) to obtain
posterior probabilities 𝑃(𝐻 𝑖
∣ 𝐵). In this case B is the information you have observed and the partition
is the collection of all the possible hypothesis of B, this because we want to go back from the effect B
to its causes 𝐻 𝑖
Example: the event A is suffering from a rare disease with 𝑃
= 0. 001 and the complement is no
disease with 𝑃(𝐴
𝑐
) = 0. 999. These two probabilities, the priors, very informative, they cannot be
changed (different from prior ignorance). The event B is instead being positive to a medical test for that
disease. We want to define P(A|B), the posterior, knowing that the test is positive, the what is the
probability that A is true? There exists also false positives and false negatives.
Prior odds ratio in favor =
𝑃(𝐴)
1 −𝑃(𝐴)
𝑃(𝐴)
𝑃(𝐴
𝑐
)
Prior odds ratios against =
𝑃(𝐴
𝑐
)
1 − 𝑃(𝐴
𝑐
)
𝑃(𝐴
𝑐
)
𝑃(𝐴)
Posterior odds ratio in favor =
𝑃(𝐴∣𝐵)
𝑃(𝐴
𝑐
|𝐵)
𝑃(𝐵∣𝐴)𝑃(𝐴)
𝑃(𝐵∣𝐴
𝑐
)𝑃(𝐴
𝑐
)
𝑃(𝐴)
𝑃(𝐴
𝑐
)
Bayes factor 𝑟 =
𝑃(𝐵∣𝐴)
𝑃(𝐵∣𝐴
𝑐
)
The posterior distribution is proportional to the likelihood times the prior, and the denominator is a
normalizing constant depending on data. Prior and posterior distributions may be different.
BAYES THEOREM FOR DISCRETE DATA AND PARAMETER: in this case the parameter has p possible
values, each associated to a discrete probability, so that the posterior probabilities sum to the unit.
For a sample size n, we have:
𝑖
1
𝑛
𝑖
1
𝑛
𝑖
𝑖
1
𝑛
𝑖
𝑝
𝑖= 1
𝑖
1
𝑖
𝑛
𝑖
so that
𝑖
1
𝑛
𝑝
𝑖= 1
The likelihood is written as a product since we assume independence
BAYES THEOREM FOR DISCRETE DATA AND CONTINOUS PARAMETER : in this case the parameter
follows a probability distribution that integrates to 1. For sample of size n:
1
𝑛
1
𝑛
1
𝑛
1
𝑛
The likelihood is written as a product since we assume independence
POSTERIOR DISTRIBUTION FOR DISCRETE DATA AND PARAMETERS: Example: we have a discrete
parameter, with uniform discrete prior 𝜃=(0.2,0.4,0.6,0.8) and p(𝜃)=1/4=0. 25.
First case: one replication of the experiment, so the prob distribution for this observation and the
likelihood for the parameter are following a Bernoulli. In particular, we study the posterior in case of
observing X=1 and X=
Second case: n replications for the experiment. Now the probability distribution of n observations is a
binomial, instead of a Bernoulli. We have n=20 and we observed 15 successes in n trials so r=15.
POSTERIOR DISTRIBUTION FOR DISCRETE DATA AND CONTINOUS PARAMETERS: recall the Beta
distribution with parameters 𝑎 and 𝑏: 𝑝(𝑋|𝑎, 𝑏) =
1
𝐵(𝑎,𝑏)
𝑎− 1
𝑏− 1
( 0 , 1
)
(𝑥) with 𝑎, 𝑏 > 0
It contains the Beta function which is: 𝐵
𝑎− 1
1
0
𝑏− 1
The first two moments of the Beta distribution are:
𝑎
𝑎+𝑏
and 𝑉
𝑎𝑏
(𝑎+𝑏+ 1 )(𝑎+𝑏)
2
𝐸(𝑋|𝑎,𝑏)( 1 −𝐸(𝑋|𝑎,𝑏))
(𝑎+𝑏+ 1 )
Additionally, when 𝑎 and 𝑏 are equal to 1, then 𝐵
= 1 and 𝐵
distribution is a 𝑈
Example: we consider a uniform prior (0,1) and we maintain discrete data with a binomial likelihood,
with n= 20 trials and r=15 successes. There is a continuous domain from 0 to 1 (uniform).
1
0
In this interval (0,1) we have that the uniform prior 𝑝(𝜃| 0 , 1 ) = 1 and we substitute the likelihood with
the binomial. One obtains:
15
20 − 5
15
20 − 5
1
0
16 − 1
6 − 1
16
6 − 1
1
0
The first two moments are: 𝐸(𝑋| 16 , 6 ) =
16
22
and 𝑉(𝑋| 16 , 6 ) =
16 ∗ 6
( 23 )( 22 )
2
The result of the posterior is a kernel of a Beta(16, 6 ). The binomial coefficient might be ignored in the
likelihood because it doesn’t contain the parameter. In conclusion, it passes from a prior uniform (0,1)
to a Beta posterior (16,6).
FROM A BETA PRIOR TO A BETA POSTERIOR IF THE LIKELIHOOD IS BINOMIAL: general formulas
The prior 𝐵𝑒𝑡𝑎
is 𝑝(𝜃|𝑎, 𝑏) =
1
𝐵(𝑎,𝑏)
𝑎− 1
𝑏− 1
( 0 , 1 )
𝑎− 1
𝑏− 1
with 𝑎, 𝑏 > 0
The Binomial likelihood is 𝑝(𝑟 ∣ 𝑛, 𝜃) = (
𝑛
𝑟
𝑟
𝑛−𝑟
𝑟
𝑛−𝑟
The posterior is proportional to 𝑝(𝜃|𝑟, 𝑛, 𝑎, 𝑏) ∝ 𝑝(𝑟 ∣ 𝑛, 𝜃) 𝑝(𝜃|𝑎, 𝑏) ∝ 𝜃
𝑟
𝑛−𝑟
𝑎− 1
𝑏− 1
which is the kernel of a 𝐵𝑒𝑡𝑎(𝑟 + 𝑎, 𝑛 − 𝑟 + 𝑏) = 𝐵𝑒𝑡𝑎(𝑎
′
′
) with 𝑎
′
= (𝑟 + 𝑎) and 𝑏
′
Passing from a 𝐵𝑒𝑡𝑎
to a 𝐵𝑒𝑡𝑎
′
′
the posterior mean can be seen as the weighted average of
the prior mean and the mean of the likelihood.
VIRTUAL SAMPLE, IMPORTANCE OF THE SIZE: The virtual sample size represents the strength of your
prior belief expressed in terms of equivalent experimental trials. The parameter of a Beta distribution
can be seen as 𝑎=successes and 𝑏=failures. Now, a virtual sample can be created and the size is the
sum of 𝑎 + 𝑏. The prior information corresponds to 𝑎 + 𝑏 virtual cases. The virtual sample size is
important because it quantifies the strength of your prior beliefs against your experiment cases. If you
choose a low virtual sample size compared to the data(likelihood), the prior is weak and the knowing
data dominates (non-informative prior, weak). Conversely, if you have a very informative prior with a
high virtual sample size compared to the likelihood, the opposite happens, the likelihood does not
move the posterior. The more informative the prior is, the less the data matters. The best case is to
seek a balance between the two, i.e., similar real cases and virtual samples (compromise data-prior).
POSTERIOR DISTRIBUTION FOR CONTINOUS DATA AND PARAMETERS (Normal-Normal) : the case
of a normal distribution with known variance, so a normal prior for the mean (unknown) is assumed as
well as a normal likelihood for the observations. The likelihood (data generation process) is
exp (−
2
Let consider n observations,
1
2
𝑛
with 𝜙 known
The likelihood with n observations becomes:
1
𝑛
𝑖
∝ exp (−
𝑖
𝑛
𝑖= 1
2
𝑛
𝑖= 1
Remember that ∑ (𝑥 𝑖
𝑛
𝑖= 1
2
𝑖
𝑛
𝑖= 1
2
2
Prior: 𝜃 ∼ 𝒩(𝜃 0
0
) where 𝜃
0
and 𝜙
0
are the prior mean and variance
𝑝(𝜃) ∝ exp { −
1
2 𝜙 0
0
2
Posterior distribution: 𝑝
1
𝑛
1
𝑛
∝ exp {−
1
2 𝜙
0
0
2
exp (−
1
2 𝜙
𝑖
𝑛
𝑖= 1
2
∝ exp {−
1
2
2
1
𝜙
0
𝑛
𝜙
𝜃
0
𝜙
0
𝑛𝑥ˉ
𝜙
∝ exp (−
1
2 𝜙
1
1
2
Therefore it is a kernel of a normal: 𝜃 ∣ 𝑥 1
𝑛
1
1
The posterior moments can be seen as a function of “weights”, in fact is a compromise between the
prior expectation and the sample mean. The size of the this prior sample is 𝑚 = 𝜙/𝜙 0
. If the prior
variance is large, then the prior is weak. While if the number of data points n is large, then the data are
strong, and vice versa. So if prior variance and n converge to plus infinitive, then the posterior will no
longer depend on the prior, which disappears from the posterior.
where g(x) is not considered since it is not a function of the parameter.
In this case the family of conjugate densities has the form:
𝑝(𝜃, 𝜙) ∝ ℎ(𝜃, 𝜙)exp [𝜏Ψ
Normal with known variance Normal with known mean
Binomial Poisson
Exponential
Normal with known mean
in probability any densities of the form: 𝑝(𝜃) ∝ exp(𝑎𝜃
2
belongs to the family of normal densities, and this is the case. Considering the kernel of the prior
it’s possible to propose 𝐸(𝜃) = 𝜏 and 𝑉(𝜃) = 𝜙
Poisson
Posing 𝜏 = 1 we obtain a prior which is a kernel of a Gamma(2,1)
The Gamma distribution is central in Bayesian inference because it is defined on positive values and is
conjugate for Poisson and exponential rates. There are two equivalent parameterizations:
by rate 𝜆 then ~ 𝐺 (𝛼, 𝜆) or by scale 𝛽 = 1 /𝜆 then ~ 𝐺 (𝛼, 𝛽)
Rate form: 𝑝(𝑥 ∣ 𝛼, 𝜆) =
𝜆
𝛼
Γ(𝛼)
𝛼− 1
−𝜆𝑥
Scale form: 𝑝(𝑥 ∣ 𝛼, 𝛽) =
1
𝛽
𝛼
Γ(𝛼)
𝛼− 1
−𝑥/𝛽
With 𝐸
𝛼
𝜆
and 𝑉
𝛼
𝜆
2
or equivalently 𝐸
= 𝛼𝛽 and 𝑉
2
Following the parametrization with 𝜆, the Inverse-Gamma distribution ~ 𝐼𝐺 (𝛼, 𝜆) can be defined as
𝜆
𝛼
Γ(𝛼)
−𝛼− 1
−
𝜆
𝑥 with 𝑥 > 0
it's a continuous probability distribution for positive variables whose reciprocal follows a Gamma
distribution. Formally, a positive random variable X follow an Inverse-Gamma distribution 𝐼𝐺 (𝛼, 𝜆)
with shape 𝛼 and rate 𝜆 if 1/X follows a 𝐺 (𝛼, 𝜆). The distributions has a heavy right tail, meaning it
allows for the possibility of very large values, while still assigning mass near small positive values.
Chi-square 𝑋 ∼ 𝜒
𝜈
2
is a special case of Gamma. The notes show it by transforming a scaled chi-square
variable into a Gamma density using the Jacobian method.
𝑋
1
2
𝜈 ⁄ 2
Γ(
𝜈
2
)
𝜈
2
− 1
−
𝑥
2 with X> 0
Where 𝐸
= 𝜈 and 𝑉
Define the scaling transformation: 𝑌 =
𝑋
𝑆
𝑑𝑋
𝑑𝑌
With: Where 𝐸
− 1
𝜈 and 𝑉
− 2
Then: 𝑝 𝑌
𝑋
Compute: 𝑝
𝑌
1
2
𝜈 2
⁄
Γ(𝜈/ 2 )
𝜈/ 2 − 1
−(𝑆𝑦)/ 2
𝑆
𝜈 ⁄ 2
2
𝜈 ⁄ 2
Γ(𝜈/ 2 )
𝜈/ 2 − 1
−𝑆𝑦/ 2
In order to recognize in it a Gamma, set 𝛼 =
𝜈
2
, 𝑆 = 2 𝜆 , then:
𝑌
𝜆
𝛼
Γ(𝛼)
𝛼− 1
−𝜆𝑦
with Y> 0 hence, 𝑌 ∼ Gamma(𝛼, 𝜆)
In addition if we have the parametrization Gamma(𝛼, 𝛽), which allows to Gamma
𝛽
2
2 𝛼
2
If the mean is known and the variance is unknown in a Normal model, the conjugate prior for the
variance is Inverse-Gamma (or scaled Inverse chi-square). Multiplying the prior kernel and likelihood
kernel yields an Inverse-Gamma posterior with updated parameters.
The conjugate posterior distribution for 𝜙 is:
𝜈
0
2
𝑆
0
2
𝑆
0
2
𝜈 0
− 2
−
𝜈 0
2
− 1
exp (−
𝑆
0
2 𝜙
Posterior distributions: 𝑝(𝜙 ∣ 𝑥) ∝ 𝑝(𝜙)𝑝(𝑥 ∣ 𝜙)
−
𝜈 0
2
− 1
−
𝑛
2 exp (−
0
) exp (−
−(𝜈 0
+𝑛)/ 2 − 1
exp (−
0
Recognize: 𝜙 ∣ 𝑥 ∼ 𝐼𝐺 (
𝜈 0
+𝑛
2
𝑆 0
+𝑆
2
0
𝜈
0
+𝑛
− 2
REFERENCE PRIORS : Reference priors are designed to formalize the idea of prior neutrality. They are
vague priors used when the prior has to be dominated by the likelihood, the information provided by
the experiment. This situation typically occurs when the sample size is large or the variance of the
prior tends to infinity. The underlying principle of reference priors is to maximize the contribution of the
data to the posterior distribution while minimizing the information introduced a priori.
For example, the binomial case. For a proportion 𝜋 according to the aim, various Beta(a,b) can be
proposed according to the target, and they induce different posteriors Beta(a+r,n-r+b). The ML
estimator is 𝜋 = 𝑟/𝑛. If we choose Beta(1,1) the ML estimator corresponds to the posterior mode. If we
choose Beta(0,0), Haldane prior, the ML estimator corresponds to the posterior mean. Other priors are
proposed by Jeffreys and Zellner. They do not show differences if the reasoning is minimally supported
by data and they highlight that the formalization of “not knowing anything” is not elementary.
JEFFREYS’ PRIOR AND CONSTRUCTING IT: Jeffreys’ priors are priors constructed from the likelihood
and based on the Fisher Information. For a parameter 𝜃 it is defined as 𝑝(𝜃) ∝ √𝐼(𝜃; 𝑥). The advantage
of such prior is that is invariant to transformations, so it’s scale invariant. It assigns to 𝜃 and a
transformation 𝜓(𝜃) the same ignorance. In fact, consider the transformation from 𝜃 to 𝜓 = 𝜓(𝜃).
Then, the Jeffreys prior is 𝑝(𝜓) ∝ √𝐼(𝜓; 𝑥) = √𝐼(𝜃; 𝑥) ∣
𝜕𝜃
𝜕𝜓
They are proportional because the absolute value is a constant which doesn’t depend on x.
This property makes Jeffreys prior particularly appealing as an “objective” prior.
When the model depends on a vector of parameters 𝜃 = (𝜃 1
𝑘
) the Fisher Information becomes a
matrix 𝑘 𝑥 𝑘 with the generic element: 𝐼(𝜃; 𝑥) 𝑖𝑗
𝜕
2
𝑙(𝜃;𝑥)
𝜕𝜃 𝑖
𝜕𝜃 𝑗
In this case, the Jeffreys prior is defined as 𝑝(𝜃) ∝ √det 𝐼(𝜃; 𝑥) and invariant to transformation as well.
The Jeffreys prior depends on the number of parameters
LIKELIHOOD THEORY: The probability distribution 𝑝(𝑥|𝜃) for any variable may be seen as the
likelihood and its logarithmic transformation is: log 𝐿 (𝜃; 𝑥) = log 𝑝(𝑥; 𝜃) = 𝑙(𝜃; 𝑥)
Its Fisher information instead is the information provided by an experiment:
𝜕
2
log 𝑝( 𝑥 ∣
∣ 𝜃 )
𝜕𝜃
2
𝜕𝑙(𝜃;𝑥)
𝜕𝜃
2
It refers to the experiment before it's performed, it measures how much information the experiment
give about 𝜃, before observing the data. Then for any probability law the score is:
𝜕𝑙(𝜃;𝑥)
𝜕𝜃
as and its
expected value and variance are: 𝔼 [
𝜕𝑙(𝜃;𝑥)
𝜕𝜃
] = 0 and 𝑉 [
𝜕𝑙(𝜃;𝑥)
𝜕𝜃
𝜕𝑙(𝜃;𝑥)
𝜕𝜃
2
The score variance is equal to the Fisher Information: expectation of the square of the score.
1
𝑛
The Fisher Information is 𝐼(𝜃) =
1
𝜙
, and therefore the Jeffreys prior is 𝑝(𝜃) ∝ √
1
𝜙
= constant,
The Fisher Information turns out to be 𝐼(𝜙) =
1
2 𝜙
2
, leading to the Jeffreys prior: 𝑝(𝜙) ∝ √
1
2 𝜙
2
1
𝜙
The FI is 𝐼
𝑛
𝜋( 1 −𝜋)
− 1
− 1
, and the Jeffreys prior is 𝑝(𝜋) ∝ √
1
𝜋( 1 −𝜋)
−
1
2
( 1 − 𝜋)
−
1
2
which corresponds to a 𝐵𝑒𝑡𝑎 (
1
2
1
2
) (one of the reference priors)
The FI is 𝐼(𝜆) =
1
𝜆
, and the Jeffreys prior is 𝑝(𝜆) ∝ 𝜆
− 1 / 2
In this case we evaluate 𝑙(𝜃, 𝜙; 𝑥), the first derivatives (for both parameters), the second derivatives
(for both parameters) and the mixed partial derivatives (from the second derivatives). Then we arrange
the second and the mixed partial derivatives in a matrix 2 x 2 and we calculate −𝔼 [ 𝑚𝑎𝑡𝑟𝑖𝑥]. Finally
det 𝐼
1
2 𝜙
3
and the Jeffreys prior 𝑝
−
3
2 which is different from the improper prior. In
conclusion the Jeffreys prior depends on the number of parameters.
The FI for the success probability 𝜋 leads to 𝑝(𝜋) ∝ 𝜋
− 1
−
1
2
,
which corresponds to a 𝐵𝑒𝑡𝑎 ( 0 ,
1
2
). This result highlights a major drawback of Jeffreys prior: it depends
on the sampling scheme. Even though the parameter 𝜋 has the same interpretation, the Jeffreys prior
differs between binomial and negative binomial models, violating the likelihood principle.
The principle drawback of Jeffreys prior is that it does not respect the likelihood principle, it depends
on how the experiment is organized. As a consequence, the same parameter can
receive different Jeffreys priors depending on how the experiment is described, even if the inferential
goal is the same. The perfect example is binomial-negative binomial, in fact the Jeffreys prior differs
between them, even though the parameter 𝜋 has the same interpretation (proportion). In the negative
binomial I fix m successes and observe the number of failures in y experiments and in the binomial I
count the number of successes in n trials. The binomial has 𝐵𝑒𝑡𝑎 (
1
2
1
2
) prior and the negative binomial
has 𝐵𝑒𝑡𝑎 ( 0 ,
1
2
). The prior changes if the way the experiment is perceived changes, they are
experiment-depending. The Jeffreys priors arise with the idea of be scale invariant and “objective”, but
it does not respect the likelihood principle (which contains the data information).
INFERENCE ON THE VARIANCE OF A NORMAL WITH KNOWN MEAN (differences between
conjugate and noninformative prior)
Consider independent observations 𝑋
1
𝑛
∼ 𝑁(𝜃, 𝜙) with 𝜃 known.
The likelihood for 𝜙 is: 𝑝( 𝑥
1
𝑛
−
𝑛
2 exp (−
1
2 𝜙
𝑛
𝑖= 1
𝑖
2
where 𝑆 =
𝑛
𝑖= 1
𝑖
2
If a conjugate prior is adopted, 𝜙 ∼ Inverse-Gamma (
𝜈
0
2
𝑆
0
2
0
𝜈 0
− 2
with density 𝑝(𝜙) ∝ 𝜙
−
𝜈 0
2
− 1
exp (−
𝑆
0
2 𝜙
the posterior distribution is obtained by multiplying prior and likelihood:
1
𝑛
−
𝜈 0
+𝑛
2
− 1
exp (−
0
Thus, 𝜙 ∣ 𝑥 1
𝑛
∼ Inverse-Gamma (
𝜈 0
+𝑛
2
𝑆 0
+𝑆
2
0
𝜈
0
+𝑛
− 2
In this case, the posterior combines prior information and data.
If instead a non-informative prior is used: 𝑝
1
𝜙
, which corresponds to an improper inverse-gamma
with 𝜈 0
= 0 and 𝑆
0
the posterior becomes: 𝑝(𝜙 ∣ 𝑥) ∝ 𝜙
−𝑛/ 2 − 1
exp (−
𝑆
0
2 𝜙
that is 𝜙 ∣ 𝑥 ∼ Inverse-Gamma (
𝑛
2
𝑆
2
𝑛
− 2
In this case, the posterior depends only on the data and closely matches classical chi-square-based
inference. Different interpretations: with a conjugate prior, the posterior reflects both prior beliefs and
observed data, while with a non-informative prior the posterior is entirely driven by the likelihood and
represents an objective, data-based inference.
SECOND LEVEL OF HBM: Intermediate level parameters (typically unobservable). These parameters
represents unit-level or group-level effects and are modelled as RV. At this level a prior distribution is
assigned to them, and conditional independencies assumptions are formulated. This level is crucial,
because it acts as a bridge between individual data and global parameters, allowing the model to
formalize the exchangeability of subgroups and allows information to be shared. Moreover, instead of
treating groups as isolated (using dummy variables), this level introduces a common prior that enables
information borrowing across units. This leads to shrinkage, which stabilizes estimates for small
subgroups by pulling them toward the global mean, reducing individual noise while simultaneously
estimating the variation among groups. So principal aim is doing inference on level 2.
THIRD LEVEL OF HBM: this level is essential because it estimates the hyperparameters (such as
global mean and population variance) that decide the distribution of the intermediate parameters
(level 2). So it provides the global perspective of the model, quantifying the overall population
characteristics and degree of similarity between groups. This level is responsible for the level of
shrinkage applied by estimating the population variance.
DAGS : Directed Acyclic Graphic (DAG) models help visually in hierarchical models structure. In a
DAG, nodes correspond to random variables and directed edges represent conditional dependencies.
DAGs help clarify the flow of information from hyperparameters to group-level parameters and finally
to the observed data, making independence assumptions explicit. In fact, in HBM parameters are
organized into layers with higher-level influencing lower-level parameters. Therefore DAGs can be used
to help clarify how priors, hyperpriors, and observed data interact in the hierarchical model.
SHRINKAGE: Shrinkage is a fundamental property that occurs when individual estimates
(intermediate level) are pulled toward a common average. Each posterior mean 𝜃 𝑖
is closer to common
sample mean than the observation 𝑦
𝑖
(shrinkage). The contribution of hyperparameters (level 3)
conduces to a posterior that, due to shrinkage, may not be very flexible. Instead of estimating each
group independently, the model borrows information from the entire sample to compute estimates for
each unit. This results in an estimate that is a weighted average between the individual observation
and the global mean. Shrinkage depends on the ratio between measurement errors and process errors
(variation among groups). When the measurement error is smaller than the error of the process,
greater value is given to the 𝑦 𝑖
. Conversely, when 𝜏
2
is small relative to 𝜎
2
, shrinkage toward 𝜇 is
strong, then greater weight is given to the general mean 𝑦̅. Shrinkage also helps in prediction for future
observations.
BORROWING INFORMATION : Is the mechanism in HBM where the estimate for a specific unit or
group is improved by using data from the entire sample. Instead of estimating each group separately,
there is a connection with other groups. The posterior mean becomes a weighted average between the
individual observation and the information borrowed one from the global mean.
FULL CONDITIONALS : a full conditional is the posterior distribution of a single parameter calculates
by conditioning on the observed data and all the parameters in the model. This is essential for
computer codes and algorithms, it fastens the calculations. In conclusion, HBM use full conditionals
to break down complex joint distributions into simpler steps for calculation, while the structure itseld
allows the model to borrow information across units to stabilize individual estimates through
shrinkage.
Level 1: data distribution, a normal model is assumed. There is no nesting and the data variability is
due to the measurement error
𝑖
𝑖
𝑖
2
) note that they are 𝑖𝑖𝑑 due to the conditioning
Here, 𝜃 𝑖
represents the true but unobserved value associated with observation 𝑖, while 𝜎
2
is the
variance of the measurement errors (common to all observations).
Level 2: distribution of local parameters. 𝜃 𝑖
are modelled as RV drawn from a common distribution:
𝑖
2
2
This level formalizes the assumption of exchangeability among the 𝜃 𝑖
. The parameters are not treated
as fixed and unrelated, but as realizations of the same underlying process.
The variance 𝜏
2
measures the variation around a common mean and this induces shrinkage.
Level 3: distribution of the hyperparameters
However, to complete the Bayesian formulation, a third level is introduced.
2
2
2
2
Often, improper priors are used for 𝜇, while 𝜎
2
and 𝜏
2
may are known.
The third level is added because hyperparameters describe characteristics of the entire population
and should therefore be treated as unknown quantities. Inferentially, including the third level allows
uncertainty about 𝜇 and the variances to be propagated through the model, rather than being ignored.
This motivation becomes clear in limiting cases: if 𝜏
2
→ ∞ , the population distribution becomes flat
and no shrinkage occurs: the posterior estimate of 𝜃 𝑖
𝑐ollapses to the observation 𝑦
𝑖
. So we would
lose the advantage of the hierarchical model returning to a classical analysis. So it will be introduce
joint prior distribution for 𝜃 and 𝜇. The solution is a compromise (weighted mean) between the
individual point and the global mean. Estimates the vector of local parameters with their posterior:
𝑖
𝑖
, ν
𝑖
) where 𝜃
𝑖
𝜏
2
𝜏
2
+𝜎
2
𝑖
𝜎
2
𝜏
2
+𝜎
2
𝑦̅ and ν
𝑖
𝜎
2
𝑛
𝜎
2
+𝑛𝜏
2
𝜎
2
+𝜏
2
The estimation on 𝜃 𝑖
is 𝜃
𝑖
. In this case we used borrowing of information and shrinkage. Each posterior
mean 𝜃 𝑖
is closer to common sample mean than the observation 𝑦
𝑖
(shrinkage). When the
measurement error is smaller than the error of the process, greater value is given to the individual
value. Conversely, when 𝜏
2
is small relative to 𝜎
2
, shrinkage toward 𝜇 is strong, then greater weight is
given to the general mean. Finally, it is also possible to make inference on future observations, and
predictions are obtained through posterior predictive distribution.
MARGINALIZATION: A hierarchical model expresses a marginal model via conditional models. In
particular, by integrating out the parameters of the set of conditional models. This allows researchers
to focus on hyperparameters by integrating out the intermediate ones. In general, a HBM can be
written through the joint distribution: 𝑝(𝑦, 𝜃, 𝜙) = 𝑝(𝑦 ∣ 𝜃) 𝑝(𝜃 ∣ 𝜙) 𝑝(𝜙) where 𝑦 are the observed
data, 𝜃 are intermediate-level parameters, and 𝜙 are hyperparameters. Marginalization consists of
integrating out 𝜃 (delating the intermediate level): 𝑝(𝑦 ∣ 𝜙) = ∫ 𝑝(𝑦 ∣ 𝜃) 𝑝(𝜃 ∣ 𝜙) 𝑑𝜃. This process
transforms a complex hierarchy into a single marginal model, facilitating inference on hyper. HBM can
be see either as layered conditional structures and as marginal models with structured covariance.
Example of normal hierarchical models: consider the conditional and prior; by marginalizing over 𝜃 𝑖
the joint marginal distribution of (𝑦 𝑖
𝑖
) can be written as a multivariate normal distribution:
𝑖
𝑖
′
′
A particularly important special case of the normal model is obtained by setting: 𝐴 = 𝐼, 𝑎 = 0 , 𝑉 = 1 ,
2
. After marginalization, the distribution of the observed data becomes: 𝑦
𝑖
2
2
This marginal model can be used directly for inference on 𝜇 and 𝜏
2
, without explicitly conditioning on
the latent parameters 𝜃 𝑖
MODEL OF PARTIAL EXCHANGEABILITY, NO COVARIATES : model with nested structure, without
covariates. There is a nested exchangeability only within groups, not between different groups.
Level 1: data generating process, observations nested within groups and replications may occur into
each group.
𝑖𝑗
𝑖
𝑖
2
𝑖
(𝑗 indexes replications within group 𝑖).
THE REGRESSION MODEL WITH COVARIATES (case 2): it is possible to extend hierarchical models
by adding explanatory variables. Covariates may enter the model at different levels, in this case don’t
have an intercept but two covariates for level 1 and 2. So the regression itself becomes group-specific.
Level 1: data generating process, no intercept and the regression coefficient varies by group:
𝑖𝑗
𝑖
𝑖𝑗
𝑖
2
Level 2 : group-specific intercepts regression coefficients depend on group-level covariates:
𝑖
𝑖
2
𝑖
2
Level 3 : prior assigned to population parameters
𝜆
2
𝜎
2
𝜏
. Normally, they are indifference priors.
The same model can be written in GLM as a random coefficient model (one covariate at unit level and
one at group level:
𝑖𝑗
𝑖𝑗
𝑖
𝑖
𝑖𝑗
with: 𝛽 𝑖
2
𝑖𝑗
2
LONGITUDINAL DATA: same individual in different times
Level 1 describes the observations over time for each individual. The model may include time as a
covariate and possibly other covariates, and it captures within-individual variability.
Level 2 introduces individual-specific parameters, such as random intercepts or random slopes,
which account for heterogeneity between individuals.
Level 3 specifies priors for population-level parameters and variance components.
There can also be growth curves with AR model or random walk.
In some non-normal settings, conjugacy can still be exploited. A three-level hierarchical model can be
constructed where:
Level 1: uses a distribution from the exponential family,
𝑖𝑗
∼ Poisson(𝜆
𝑖
Level 2: uses a distribution from the corresponding conjugate family.
𝑖
∼ Gamma(𝑎, 𝑏
𝑖
) where 𝑏
𝑖
= 𝑎 exp(𝑥
𝑖
⊤
Level 3 : diffuse priors are assigned to 𝑎 and 𝛽.
In this case, the posterior distribution of 𝜆 𝑖
, conditional on data and hyperparameters, is still a Gamma
distribution. Moreover, the sufficient statistic at Level 1, the total count within each group, follows
a negative binomial distribution after marginalization.
CREDIBILITY INTERVALS (Bayesian confidence intervals):
In the Bayesian framework, interval estimation is based on the posterior distribution of the unknown
parameter 𝜃. Here the parameter is treated as a RV. Let 𝜃 be an unknown parameter and 𝑥 1
𝑛
the
observed data. After combining the prior distribution 𝑝(𝜃) with the likelihood 𝑝(𝑥
1
𝑛
∣ 𝜃) inference
is entirely based on the posterior distribution: 𝑝(𝜃 ∣ 𝑥 1
𝑛
). The idea is to summarize the
uncertainty on the estimate through posterior credibility intervals.
A credibility interval (Bayesian confidence interval) is an interval (a, b) such that the posterior
probability that the parameter lies within the interval is equal to a fixed credibility level ( 1 − 𝛼)
1
𝑛
The term credibility emphasizes that this probability statement refers directly to the parameter,
conditional on the observed data. This is a key difference with respect to frequentist confidence
intervals, where probability statements concern hypothetical repetitions of the sampling process.
There are 2 different approaches to choose the extremes:
distribution such that the posterior probabilities in both tails are 𝛼/ 2. This method is widely
used when the posterior distribution is symmetric. There is a central credibility interval.
posterior probability equal to 1 − 𝛼. It also contains the 100 ( 1 − 𝛼)% in a different way. This
method is particularly useful when the posterior distribution is asymmetric or multimodal,
since it concentrates on the regions of highest mass, rather than enforcing symmetry.
DIFFERENCES BETWEEN CREDIBILITY (Bayesian) AND CONFIDENCE (Frequentist) INTERVALS
The frequentist confidence intervals arrives at similar conclusions as Bayesian confidence interval,
but builds random intervals with probability 1 − 𝛼 of containing the fixed but unknown value of the
parameter. In the Bayesian framework, interval estimation is based on the posterior distribution of the
unknown parameter 𝜃, treated as a RV. A credibility interval (Bayesian confidence interval) is an
interval (a, b) such that the posterior probability that the parameter lies within the interval is equal to a
fixed credibility level ( 1 − 𝛼). It’s a probability made directly about the parameter, conditional on the
observed data. Therefore, a 95% credibility interval means that, given the data, there is a 95%
posterior probability that the true value of 𝜃 lies within the interval.
For example, if 𝑥 1
𝑛
∣ 𝜃 ∼ 𝑁(𝜃, 1 ) and a non-informative prior is assumed for 𝜃, the posterior
distribution is 𝜃 ∣ 𝑥ˉ ∼ 𝑁 (𝑥ˉ ,
1
𝑛
). A symmetric 95% credibility interval is then
2
√
n
2
√
n
| 𝑥ˉ} , given 𝑥ˉ
In the Frequentist framework instead, the parameter is considered fixed but unknown, while
randomness is attributed only to the data. It refers to indirect considerations on the true value of the
parameter, it is based on data that are not observed and produced by a large number of repetitions.
A confidence interval is constructed as a random interval that, under repeated sampling, contains the
true value of the parameter with probability ( 1 − 𝛼). A 95% credibility interval is then
2
√
n
2
√
n
| 𝜃} , given 𝜃
HIGHEST POSTERIOR DENSITY REGION (HPDR): is a Bayesian credibility interval or region that
summarizes uncertainty by selecting the most plausible values of a parameter according to the
posterior distribution. is defined as the smallest interval that contains a posterior probability equal to
1 − 𝛼. It is particularly useful when the posterior distribution is asymmetric or multimodal, since it
concentrates on regions of highest mass. The HPDR is defined as the smallest interval for which two
properties hold:
1
𝑛
) is the posterior density, for a region 𝑎 ≤ 𝜃 ≤ 𝑏, it has the highest value with
respect to any another interval for which property 1 holds.
In the multidimensional case, where 𝜃 is a vector, the HPDR generalizes to a credibility region 𝑅.
The defining properties become:
1
𝑛
1
∈ 𝑅 and ∀𝜃
2
1
1
𝑛
2
1
𝑛
The HPDR always exists and is unique for all the intervals and regions of level 1 − 𝛼 in which the
posterior density is not uniform in in any interval/regional of the space of 𝜃.
The simplest case for identifying HPDR is the univariate and unimodal case (guarantees existence of a
single maximum of the posterior density within the interval). The object is to minimize the length of the
interval (a, b), with the constraint that the interval contains a posterior probability equal 1 − 𝛼. This
problem can be solved using the method of Lagrange multipliers. The Lagrangian function is:
𝑏
𝑎
1
𝑛
where ℎ(𝜃 ∣ 𝑥 1
𝑛
) is the posterior density and 𝜆 is the Lagrange multiplier associated with the
probability constraint. So the quantities within the brackets is to be minimized. So we calculate the
partial derivative (for a and b) of ℒ. Setting these derivatives equal to 0 , we have ℎ(𝑏) = ℎ(𝑎). Then, to
Where 𝜋 0
1
are the prior odds in favor of 𝐻
0
and 𝑃(𝑇 ∣ 𝐻
0
1
) is the Bayes factor and
depends only on the sample data. It indicates how much data are in favor of a model or an another. In
this case the Bayes factor is equal to the likelihood ratio.
0
0
1
1
(ex. 𝜃 > 0 )
A simple null hypothesis specifies a single value of 𝜃, while a composite alternative hypothesis allows
𝜃 to vary over a subset of the parameter space and requires the specification of a prior distribution.
Let prior probabilities be 𝑃(𝐻 0
0
1
1
and let 𝑇 be a sufficient statistic. The posterior odds
in favor of 𝐻 0
are given by:
𝑃(𝐻 0
∣𝑇)
𝑃(𝐻 1
∣𝑇)
𝑃(𝑇∣𝐻 0
)𝑃(𝐻 0
)
𝑃(𝑇∣𝐻 1
)𝑃(𝐻 1
)
𝑃(𝑇∣𝐻 0
,𝜃)
∫ 𝑃(𝑇∣𝐻 1
,𝜃)𝑔 1
(𝜃) 𝑑𝜃
𝜋 0
𝜋 1
The likelihood under 𝐻 0
has a single value: 𝑃( 𝑇 ∣∣ 𝐻
0
0
), but under the composite
alternative hypothesis, the likelihood must be averaged with respect to the prior distribution 𝑔 1
on Θ 1
. Therefore, the posterior odds become:
𝑃(𝐻
0
∣𝑇)
𝑃(𝐻
1
∣𝑇)
𝜋
0
𝜋
1
𝑃(𝑇∣𝜃
0
)
∫
𝑃(𝑇∣𝜃)𝑔
1
(𝜃) 𝑑𝜃
In this case, unlike the comparison between two simple hypotheses, the Bayes factor is no longer
equal to the likelihood ratio, because the likelihood under the alternative hypothesis is averaged over
the parameter space using the prior distribution.
0
0
1
1
Both the null and the alternative hypotheses are composite, so they specify sets of values for the
parameter rather than single points. In this case, prior probabilities must be assigned not only to the
hypotheses but also to the parameter values within each hypothesis.
Let the parameter space be partitioned as: Θ 0
1
0
1
And prior probabilities 𝑃
0
0
0
and 𝑃(𝐻
1
1
1
Let 𝑝(𝜃) be a prior distribution on Θ. The renormalized priors under each hypothesis are defined as:
0
0
0
1
1
1
The posterior probability of the null hypothesis is: 𝑃(𝐻 0
Θ 0
0
Θ 0
𝑝(𝜃)
𝜋 0
and similarly for the alternative hypothesis: 𝑃(𝐻 1
Θ
1
1
Θ
1
𝑝(𝜃)
𝜋
1
The posterior odds in favor of 𝐻
0
are therefore:
𝑃(𝐻
0
∣𝑥)
𝑃(𝐻
1
∣𝑥)
𝜋
0
𝜋
1
∫
𝑝(𝑥∣𝜃) 𝑝(𝜃) 𝑑𝜃
Θ 0
∫
𝑝(𝑥∣𝜃) 𝑝(𝜃) 𝑑𝜃
Θ 1
The corresponding Bayes factor is: 𝐵 =
𝑃(𝐻
0
∣𝑥)
𝑃(𝐻
1
∣𝑥)
𝜋
1
𝜋
0
∫ 𝑝(𝑥∣𝜃) 𝑝(𝜃) 𝑑𝜃
Θ
0
∫ 𝑝(𝑥∣𝜃) 𝑝(𝜃) 𝑑𝜃
Θ
1
The Bayes factor is the ratio of likelihoods weighted by the prior over the two parameter regions, so
now it is influenced by the choice of the prior distribution and cannot be interpreted as evidence
provided only by the data.
LINEAR REGRESSION MODEL: The classical linear regression model can be formulated within the
Bayesian framework by treating the model parameters as random variables and assigning prior
distributions to them. Consider a sample of 𝑛 observations 𝑦 = (𝑦 1
𝑛
′
and a matrix of
covariates 𝑋 of dimension 𝑛 × 𝑘.
The model is defined as 𝑦 𝑖
′
𝑖
𝑖
where 𝛽 is a 𝑘-dimensional vector of regression coefficients and the errors are assumed to be
independent and identically distributed: 𝜀 𝑖
∼ iid 𝑁( 0 , 𝜙).
In vector form, the model can be written as 𝑦 ∣ 𝑋, 𝛽, 𝜙 ∼ 𝑁 𝑛
𝑛
Inference in the Bayesian framework concerns both the regression coefficients 𝛽 and the error
variance 𝜙. Starting from the normality assumption, the likelihood function is:
−
𝑛
2 exp [−
1
2 𝜙
′
A first approach consists in using a non-informative (or diffuse) prior, which reflects a lack of prior
information about the parameters. This is specified as: 𝑝
1
𝜙
, which assumes independence
between 𝛽 and 𝜙 and introduces minimal prior influence.
Combining this prior with the likelihood yields a posterior distribution whose main marginals are:
the conditional posterior of the coefficients: 𝛽 ∣ 𝜙, 𝑦, 𝑋 ∼ 𝑁
𝑘
′
− 1
the marginal posterior of the variance: 𝜙 ∣ 𝑦, 𝑋 ∼ Inverse-Gamma (
𝑛−𝑘
2
(𝑛−𝑘)𝑠
2
2
the marginal posterior of the coefficients: 𝛽 ∣ 𝑦, 𝑋 ∼ 𝑡
𝑘
2
′
− 1
These results closely mirror those obtained under the classical maximum likelihood approach.
Therefore, with a non-informative prior, Bayesian inference essentially reproduces classical regression
results, while still allowing a probabilistic interpretation of the parameters.
An alternative approach consists in specifying a conjugate prior, which incorporates prior information
and leads to posterior distributions belonging to the same family as the prior. In the Bayesian linear
regression model, the conjugate prior is given by: 𝛽 ∣ 𝜙 ∼ 𝑁 𝑘
0
0
), 𝜙 ∼ Inverse-Gamma (
𝜈 0
2
𝑆 0
2
Under this specification, the posterior distribution remains in the Normal–Inverse-Gamma family:
∗
∗
∗
∗
/ 2 ), where the updated parameters combine prior information
and sample information: 𝑉
∗
′
0
− 1
− 1
∗
∗
′
0
− 1
0
∗
0
In this case, the posterior mean of the coefficients is a weighted average of the prior mean and the OLS
estimator, reflecting a compromise between prior beliefs and observed data.