See Bayesian inference
1. Dodgy coins
1.1 P(C∣H)∝P(H∣C)
0.75+0.5+0.25=1.5
1.2 Maximum likelihood estimate is C=1
1.3 P(C=c∣X=H)=P(X=H)P(X=H∩C=c)∝P(X=H∩C=c)=P(X=H∣C=c)×P(C=c)
1.4 & 1.5 Using Baye's theorem
C | likelihood | prior | likelihood x prior | posterior |
1 | 0.75 | 1/3 | 3/4 x 1/3 = 1/4 | 1/21/4=1/2 |
2 | 0.5 | 1/3 | 1/2 x 1/3 = 1/6 | 1/21/6=1/3 |
3 | 0.25 | 1/3 | 1/4 x 1/3 = 1/12 | 1/21/12=1/6 |
| | | P(X=H)=3/12+2/12+1/12=6/12=1/2 | |
1/2+1/3+1/6=3/6+2/6+1/6=1
1.6
C | likelihood | prior | likelihood x prior | posterior |
1 | 0.752 | 1/3 | 3/4 x 3/4 x 1/3 = 3/16 | 7/243/16=9/14 |
2 | 0.52 | 1/3 | 1/2 x 1/2 x 1/3 = 1/12 | 7/241/12=4/14 |
3 | 0.252 | 1/3 | 1/4 x 1/4 x 1/3 = 1/48 | 7/241/48=1/14 |
| | | P(X=H)=9/48+4/48+1/48=14/48=7/24 | |
1.7
0.11111... use this
P( C=1|H ) = 0.111111111111111
P( C=2|H ) = 0.37037037037037
P( C=3|H ) = 0.518518518518518. Maximum a posteriori
P(X~=H∣X=H)=0.75×1/2+0.5×1/3+0.25×1/6 =3/8+1/6+1/24=9/24+4/24+1/24=14/24=7/12
P(X~=T∣X=H)=5/12
1.10
P(X~=H∣X=H)=C=1∑rP(X~∩C∣X=H)=C=1∑rP(X~∣C∩X=H)×P(C∣X=H) =C=1∑rP(X~∣C)×P(C∣X=H)
2.1 Binomial distribution as likelihood of number of ticks with Borrelia bacteria is reasonable because it's the prob dist if the probability of each tick having the bacteria is the same, and they are independent.
2.2
L(Xi∣θ)=(Xin)θXi(1−θ)n−Xi
n=10
2.3
10θ(1−θ)9
https://www.wolframalpha.com/input/?i=10+theta+(1-%5Ctheta)%5E%7B9%7D
θ≈0.1 is MLE
2.4
https://www.wolframalpha.com/input/?i=integrate+10+q(1-q)%5E%7B9%7D+from+q%3D+0+to+1
2.5
https://www.wolframalpha.com/input/?i=binomial+distribution+with+p%3D0.1,+n%3D10
2.6
dθdlogL(X∣θ)=0
dθdlog(Xin)θXi(1−θ)n−Xi=dθd[log(Xin)+Xilogθ+(n−Xi)log(1−θ)] 0+θXi−(1−θ)(n−Xi)=0
Xi−Xiθ=θn−θXi
Xi=θn =>
θ=nXi=10Xi
2.7
Beta distribution as Prior distribution
Plot this on RStudio!
2.8
The expected value (mean) (μ) of a Beta distribution random variable X with two parameters α and β is a function of only the ratio β/α
2.9
Beta(a,b)=Γ(a)Γ(b)Γ(a+b)θa−1(1−θ)b−1
(Xin)θXi(1−θ)n−XiΓ(a)Γ(b)Γ(a+b)xθa−1(1−θ)b−1=Γ(n+1−Xi)Γ(Xi+1)Γ(n+1)Γ(a)Γ(b)Γ(a+b)θXi+a−1(1−θ)n−Xi+b−1 ∝θXi+a−1(1−θ)n−Xi+b−1, which is propto Beta(Xi1+a,n−Xi+b)
See wiki