francisco josé vázquez polo [personales.ulpgc.es/fjvpolo.dmc]
DESCRIPTION
Course on Bayesian Methods. Basics (continued): Models for proportions and means. Francisco José Vázquez Polo [www.personales.ulpgc.es/fjvpolo.dmc] Miguel Ángel Negrín Hernández [www.personales.ulpgc.es/mnegrin.dmc] {fjvpolo or mnegrin}@dmc.ulpgc.es. 1. Binomial and Beta distributions - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/1.jpg)
1
Francisco José Vázquez Polo [www.personales.ulpgc.es/fjvpolo.dmc]
Miguel Ángel Negrín Hernández [www.personales.ulpgc.es/mnegrin.dmc]
{fjvpolo or mnegrin}@dmc.ulpgc.es
Course on Bayesian Methods
Basics (continued):
Models for proportions and means
![Page 2: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/2.jpg)
Binomial and Beta distributions
Problem:
Suppose that θ represents a percentage and we are interested in its estimation:
Examples:
-Probability of a single head occurs when we throw a coin.
-probability of using public transport
-Probability of paying for the entry to a natural park.
10
![Page 3: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/3.jpg)
Binomial and Beta distributions
Binomial distribution:
X has a binomial distribution with parameters θ and n if its density function is:
Moments:
.0integrerand;10
;,...,1,0
1,|,|
n
nxfor
x
nnxBnx xnx
1,|,| nnXVandnXE
![Page 4: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/4.jpg)
Prior: Beta distribution
1. θ has a beta distribution with parameters α and β if its density function is:
2. Moments:
0and;0;10for
1,
,| 11
Beta
12
Var
E
![Page 5: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/5.jpg)
Prior: Beta distribution
Advantages of the Beta distribution:
- Its natural unit range from 0 to 1
- The beta distribution is a conjugate family for the binomial distribution
- It is very flexible
![Page 6: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/6.jpg)
0 0.2 0.4 0.6 0.8 10
1
2
3
4
5
Beta(.25, .25)
Beta(3, 7)
Beta(1, 1)
Prior: Beta distribution
![Page 7: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/7.jpg)
2
1
12
Mode
Var
E
Prior: Beta distribution
- Elicitation
- Non-informative prior: Beta(1,1), Beta(0.5, 0.5)
![Page 8: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/8.jpg)
Beta-Binomial Model
1.Model
Given θ the observations X1,…,Xm are mutually independent with B(x|θ,1) density function:
The joint density of X1,…,Xn given θ is:
xxx 11|
ii xnx
nxx 1|,...,1
![Page 9: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/9.jpg)
The conjugate prior distribution for θ is the beta distribution Beta(α0, β0) with density:
The posterior distribution of θ given X has density:
11
00
00 00 1,
in
in
nnn
xn
x
Betaxx
0
0
1 ,|,...,|
Beta-Binomial Model
![Page 10: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/10.jpg)
Updating parameters
Prior Posterior
in
in
xn
x
00
00
![Page 11: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/11.jpg)
2
1
1
00
0
002
00
00
00
0
n
xModa
nn
xnxVar
n
xE
i
ii
i
Posterior: Beta distribution
Posterior moments:
![Page 12: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/12.jpg)
Binomial and Beta distributions
Example:
We are studying the willingness to pay for a natural park in Gran Canaria (price of 5€).
We have a sample of 20 individuals and 14 of them are willing to pay 5 euros for the entry.
1. Elicit the prior information
2. Obtain the posterior distribution (mean, mode, variance)
![Page 13: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/13.jpg)
Poisson and Gamma distributions
Problem:
Suppose that λ represents a the mean of a discrete variable X. Model used in analyzing count data.
Examples:
-Number of visits to an specialist
-Number of visitors to state parks
-The number of people killed in road accidents
0
![Page 14: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/14.jpg)
Poisson and Gamma distributions
Poisson distribution:
X has a Poisson distribution with parameters λ if its density function is:
Moments:
.0
;,...,1,0!
||
nxforx
exPx
x
|| XVandXE
![Page 15: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/15.jpg)
Prior: Gamma distribution
1. λ has a gamma distribution with parameters α and β if its density function is:
2. Moments:
0and;0;0for
,| 1
eGamma
1
; 2
Mode
VarE
![Page 16: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/16.jpg)
Prior: Gamma distribution
Advantages of the Gamma distribution:
- The gamma distribution is a conjugate family for the Poisson distribution
- It is very flexible
![Page 17: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/17.jpg)
Prior: Gamma distribution
- Elicitation
- Non-informative prior: Gamma(1,0), Gamma(0.5,0)
1
; 2
Mode
VarE
![Page 18: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/18.jpg)
The conjugate prior distribution for λ is the gamma distribution Gamma(α0, β0) with density:
The posterior distribution of θ given X has density:
n
x
Gammaxx
n
in
nnn
0
0
1 ,|,...,|
Poisson-Gamma Model
00 1
0
0
e
![Page 19: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/19.jpg)
Updating parameters
Prior Posterior
n
x
n
inn
00
0
![Page 20: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/20.jpg)
n
xModa
n
xVar
n
xE
i
i
i
0
0
20
0
0
0
1
Posterior moments:
Posterior: Gamma Distribution
![Page 21: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/21.jpg)
Example:
We are studying the number of visits to a natural park during the last two months. We have data of the weekly visits:
{10, 8, 35, 15, 12, 6, 9, 17}
1. Elicit the prior information
2. Obtain the posterior distribution (mean, mode, variance)
Posterior: Gamma Distribution
![Page 22: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/22.jpg)
Other conjugated analysis
![Page 23: Francisco José Vázquez Polo [personales.ulpgc.es/fjvpolo.dmc]](https://reader036.vdocuments.pub/reader036/viewer/2022070404/56813ac9550346895da2e389/html5/thumbnails/23.jpg)
Good & Bad News
Only simple models result in equations
More complex models require numerical methods to compute posterior mean, posterior standard deviations, prediction, and so on.
MCMC