Slides 1
Slides 1
LABORATORY
Lesson 1: Jan 24 2002 Software:
it as a fully planned and coherent system, rather than an incremental accretion of very specific and inflexible tools.
run, copy, distribute, study, change and improve the software. It is not a matter of price!
run, copy, distribute, study, change and improve the software. It is not a matter of price!
book, pag. 39, sec. 2.5 R code placenta.r is in the Lab notes at the course web page
Our interest focus on the proportion of female births in
book, pag. 39, sec. 2.5 R code placenta.r is in the Lab notes at the course web page
Our interest focus on the proportion of female births in
book, pag. 39, sec. 2.5 R code placenta.r is in the Lab notes at the course web page
Our interest focus on the proportion of female births in
proportion of placenta previa female births is < 0.485, the proportion of the general population female births?
Analysis using a
UNIFORM PRIOR
Let the 1-parameter denote the proportion of placenta previa female births
Analysis using a
UNIFORM PRIOR
Let the 1-parameter denote the proportion of placenta previa female births We assume a Bin(, 980) 437 (1 )980437 to be the model generating the data
Analysis using a
UNIFORM PRIOR
Let the 1-parameter denote the proportion of placenta previa female births We assume a Bin(, 980) 437 (1 )980437 to be the model generating the data We specify the prior for to be a U [0, 1]
Analysis using a
UNIFORM PRIOR
Let the 1-parameter denote the proportion of placenta previa female births We assume a Bin(, 980) 437 (1 )980437 to be the model generating the data We specify the prior for to be a U [0, 1] The posterior for is, then, 437 (1 )980437 , i.e., is a Beta(437 + 1, 980 437 + 1)
(Beta-)UniformBinomial
25
likelihood
0 0.35
10
15
20
0.40
0.45
0.50
0.55
(Beta-)UniformBinomial
25
likelihood
10
15
20
prior
0 0.35
0.40
0.45
0.50
0.55
(Beta-)UniformBinomial
25
likelihood
15
20
posterior
10
prior
0 0.35
0.40
0.45
0.50
0.55
BETA PRIORS
As the likelihood p(y|) L(; y) is y (1 )ny if the prior is of the same form, e.g., p() is 1 (1 )1 then the posterior will also be of this form. In fact, p(|y) is y+1 (1 )ny+1 = Beta( + y, + n y)
20
15
10
0.35 25
0.40
0.45
0.50
0.55
10
15
20
a+b2= 0
a+b2= 0
0.35
0.40
0.45
0.50
0.55
10 15 20 25
10
15
20
a+b2= 10
a+b2= 100
0.35 35
0.40
0.45
0.50
0.55
0 0.35
0.40
0.45
0.50
0.55
a+b2= 1000
a+b2= 10000
25
15
0 5
20
40
60
80
0.35
0.40
0.45
0.50
0.55
0.35
0.40
0.45
0.50
0.55
20
15
10
0.35 25
0.40
0.45
0.50
0.55
10
15
20
a+b2= 0
a+b2= 0
0.35
0.40
0.45
0.50
0.55
10 15 20 25
10
15
20
a+b2= 10
a+b2= 100
0.35 35
0.40
0.45
0.50
0.55
0 0.35
0.40
0.45
0.50
0.55
a+b2= 1000
a+b2= 10000
25
15
0 5
20
40
60
80
0.35
0.40
0.45
0.50
0.55
0.35
0.40
0.45
0.50
0.55
20
15
10
0.35 25
0.40
0.45
0.50
0.55
10
15
20
a+b2= 0
a+b2= 0
0.35
0.40
0.45
0.50
0.55
10 15 20 25
10
15
20
a+b2= 10
a+b2= 100
0.35 35
0.40
0.45
0.50
0.55
0 0.35
0.40
0.45
0.50
0.55
a+b2= 1000
a+b2= 10000
25
15
0 5
20
40
60
80
0.35
0.40
0.45
0.50
0.55
0.35
0.40
0.45
0.50
0.55
The compromise depends on how much weight prior has (or how much informative it is) w.r.t. the data at hand
The compromise depends on how much weight prior has (or how much informative it is) w.r.t. the data at hand i.e., in the binomial case, depends on the relative weight of +2 number of prior observations ( prior precision)
(1) Note: precision=1/variance, var= ++1
The modern approach to Bayesian estimation has become closely linked to simulation-based estimation methods.
The modern approach to Bayesian estimation has become closely linked to simulation-based estimation methods. In fact, Bayesian estimation focuses on estimating the entire density of a parameter.
The modern approach to Bayesian estimation has become closely linked to simulation-based estimation methods. In fact, Bayesian estimation focuses on estimating the entire density of a parameter. This density estimation is based on generating samples from the posterior density of the parameters themselves or of functions of parameters.
In the B ETA -B INOMIAL model, the coniugacy allows us knowing the posterior density in closed form.
In the B ETA -B INOMIAL model, the coniugacy allows us knowing the posterior density in closed form. Then, direct calculations are feasible or direct simulation from it can be performed.
In the B ETA -B INOMIAL model, the coniugacy allows us knowing the posterior density in closed form. Then, direct calculations are feasible or direct simulation from it can be performed. However, even if posterior density cannot be explicitly integrated, iterative simulation methods (or MCMC) are alternatively used. We will see them in future labs.
opinion poll about the morality of President Bushs not helping Iraqi rebel groups after the formal end of the gulf war. Of the 751 adults responding, 150 thought the presidents actions were not moral.
opinion poll about the morality of President Bushs not helping Iraqi rebel groups after the formal end of the gulf war. Of the 751 adults responding, 150 thought the presidents actions were not moral.
We are interested in assessing the probability that a
opinion poll about the morality of President Bushs not helping Iraqi rebel groups after the formal end of the gulf war. Of the 751 adults responding, 150 thought the presidents actions were not moral.
We are interested in assessing the probability that a
polls on the proportion of the population generally likely to consider a Presidents actions immoral.
an adult responding immoral assuming different Beta priors: 1. = = 1 prior information 0 E = 1/2 2. = = 0.001 3. = 1 = 0.11 4. = 1.8 = 0.2
prior information < 0 prior information < 0 prior information 0
1., 2. are both non informative, but 2. is a reasonable choice for one-off events (or for correlated data) 3., 4. may be assumed on the basis of previous polls. Although E=0.9 they still are diffuse.
density(x = rbeta(50000, 45, 5))
5., 6 are
increasingly informative.
10 a=45 b=5 8 Density 6 a=.001 b=.001 4
a=1 b=1
0 0.0
0.2
0.4
0.6
0.8
1.0
Beta(150+,601+); likelihood Bin(150,751). intervals: Unif-Bin 95% posterior interval; 95% (Beta(150+,601+)) posterior interval; Normal approximation of the 95% posterior interval; Inverted 95% posterior interval on the logit scale.
Beta(150+,601+); likelihood Bin(150,751). intervals: Unif-Bin 95% posterior interval; 95% (Beta(150+,601+)) posterior interval; Normal approximation of the 95% posterior interval; Inverted 95% posterior interval on the logit scale.
Though is close to 0, because of the large sample
size (751), the normal approximation is good as well as posterior inferences are insensitive to prior choice (even if discordant to data), at least for prior information 0.
30
20
5 10
a+b2= 0 a= 1
0.16 0.18 0.20 0.22 0.24 0.26
5 10
20
30
Histogram of post
30 30
Histogram of post
20
5 10
a+b2= 0.89 a= 1
0.16 0.18 0.20 0.22 0.24 0.26 0.16
5 10
20
a+b2= 0 a= 1.8
0.18 0.20 0.22 0.24 0.26 0.28
Histogram of post
30 30
Histogram of post
20
5 10
a+b2= 3 a= 4.5
0.16 0.18 0.20 0.22 0.24 0.26 0.20
5 10
20
a+b2= 48 a= 45
0.22 0.24 0.26 0.28 0.30
NOTE :
Histogram of post
2.0 3
Histogram of post
1.0
0.0
a+b2= 0 a= 1
0.0 0.2 0.4 0.6 0.8 0.0
Histogram of post
2.0 2.0
Histogram of post
1.0
0.0
a+b2= 0.89 a= 1
0.0 0.2 0.4 0.6 0.8
0.0
1.0
a+b2= 0 a= 1.8
0.0 0.2 0.4 0.6 0.8
Histogram of post
2.0 8
Histogram of post
1.0
0.0
a+b2= 3 a= 4.5
0.2 0.4 0.6 0.8 0.65 0.70
a+b2= 48 a= 45
0.75 0.80 0.85 0.90 0.95