You are on page 1of 7

Bayesian Statistics

3470: 589-001
HW - 04 Mir Shahnewaz Arefin
Fall 2016 Student ID No: 2824475

Problem 1.1

(a)

> y <- seq(-7,10,.02)


> dens <- 0.5*dnorm(y,1,2) + 0.5*dnorm(y,2,2)
> plot (y, dens, ylim=c(0,1.1*max(dens)),
+ type="l", xlab="y", ylab="", xaxs="i",
+ yaxs="i", yaxt="n", bty="n", cex=2)
>

Page 1 of 7
Bayesian Statistics
3470: 589-001
HW - 04 Mir Shahnewaz Arefin
Fall 2016 Student ID No: 2824475

(b)

(c)

Problem 1.3

Pr(child is Xx | child has brown eyes & parents have brown eyes)

Page 2 of 7
Bayesian Statistics
3470: 589-001
HW - 04 Mir Shahnewaz Arefin
Fall 2016 Student ID No: 2824475

To figure out the probability that Judy is a heterozygote, use the above posterior probability as
a prior probability for a new calculation that includes the additional information that her n
children are brown-eyed (with the father Xx):

Pr(Judy is Xx | n children all have brown eyes & all previous information)

Given that Judy’s children are all brown-eyed, her grandchild has blue eyes only if Judy’s child
is Xx. We compute this probability, recalling that we know the child is brown-eyed and we know
Judy’s spouse is a heterozygote:

Pr(Judy’s child is Xx | all the given information)


= Pr((Judy is Xx&Judy’s child is Xx) or (Judy is XX&Judy’s child is Xx) | all the given
information)
 

Given that Judy’s child is Xx, the probability of the grandchild having blue eyes is 0, 1/4, or 1/2,
if Judy’s child’s spouse is XX, Xx, or xx, respectively. Given random mating, these events have
probability (1 − p)2, 2p(1 − p), and p2, respectively, and so

Pr(Grandchild is xx | all the given information)

Page 3 of 7
Bayesian Statistics
3470: 589-001
HW - 04 Mir Shahnewaz Arefin
Fall 2016 Student ID No: 2824475

Problem 1.4

(a)

No . of cases of A∧B
Use relative frequencies : Pr(A|B) =
No . of cases of B
8
Pr (favorite wins | points spread = 8) = = 0.67
12
5
Pr (favorite wins by at least 8 | points spread = 8) = = 0.42
12
5
Pr (favorite wins by atleast 8 | ponts spread = 8 & favorite wins) = = 0.63
8

(b)

Use normal approximation for d = (score differential – points spread): d~N(0,13.862)


8.5
Pr (favorite wins | points spread = 8) = Ф ( 13.86 )
= 0.73
0 .5
Pr (favorite wins by at least 8 | points spread = 8) = Ф (
13.86 )
= 0.514
0.5 14
Pr (favorite wins by at least 8 | points spread = 8 & favorite wins) = (
0.730 )
= 0.70

Problem 1.6

Pr (identical twins & twin brother) = Pr (identical twins) x Pr (both boys | identical twins)
= ½ x (1/300)
Pr (fraternal twins & twin brother) = Pr (fraternal twins) x Pr (both boys | fraternal twins)
= ¼ x (1/125)

Conditional probability that Elvis was an identical twin is,

Page 4 of 7
Bayesian Statistics
3470: 589-001
HW - 04 Mir Shahnewaz Arefin
Fall 2016 Student ID No: 2824475

Pr (identical twins∧twin brothers )


Pr (identical twins | twin brother) =
Pr (twinbrother )
1 1
×
2 300 5
= =
1 1 1 1 11
× + ×
2 300 4 125

Problem 2.2

> mu<-10.75
> sig<- .8
> par(mfrow=c(1,2))
> x<- seq(7.9,13.9,length=500)
>
plot(x,pnorm(x,mu,sig),type="l",ylab=expression(paste(italic("F"),"(",italic("y"),")")),xlab=expr
ession(italic(y)),lwd=1)
> abline(h=c(0,.5,1),col="gray")
>
plot(x,dnorm(x,mu,sig),type="l",ylab=expression(paste(italic("p"),"(",italic("y"),")")),xlab=expre
ssion(italic(y)),lwd=1)
> abline(v=mu,col="gray")
>

Page 5 of 7
Bayesian Statistics
3470: 589-001
HW - 04 Mir Shahnewaz Arefin
Fall 2016 Student ID No: 2824475

Problem 2.3

> x<-seq(7.75,13.75,length=100)
> mu<-10.75 ; sig<-.8
> par(mfrow=c(1,2))
>
plot(x,dnorm(x,mu,sig),type="l",xlab=expression(italic(y)),ylab=expression(paste(italic("p"),"(",
italic("y"),")")) )
> abline(v=mu,lty=1,col=gray(0))
> abline(v=mu,lty=2,col=gray(.33))
> abline(v=mu,lty=4,col=gray(.66))
> #a<-6 ; b<-1.5
> #plot(x, dgamma(x,6,1.5),type="l", xlab=expression(italic(y)),
> # ylab= expression(italic("p(y)")))
> #abline(v=(a-1)/b,col="blue")
> #abline( v=qgamma(.5,a,b),col="green",lty=2)
> #abline(v=a/b,col="red",lty=4)
> #legend(4.5,.25,c("mode","median","mean"),lty=c(1,2,4),col=c("blue","green","red"),
> # bty="n",cex=.85)
> x<-seq( 0,300000,length=200)
> mu<-10.75 ; sig<-.8
> plot(x, dlnorm(x,mu,sig)*1e5,type="l", xlab=expression(italic(y)),
+ ylab= expression( 10^5*paste(italic("p"),"(",italic("y"),")")) )
> abline(v=24600,col=gray(0))
> abline( v=qlnorm(.5,mu,sig),col=gray(.3),lty=2)
> abline(v=exp(mu+.5*sig^2) , col=gray(.7),lty=4)
> legend(150000,1.0,c("mode","median","mean"),
+ lty=c(1,2,4),col=gray(c(0,.33,.66)),
+ bty="n",cex=.85)
>

Page 6 of 7
Bayesian Statistics
3470: 589-001
HW - 04 Mir Shahnewaz Arefin
Fall 2016 Student ID No: 2824475

Page 7 of 7

You might also like