does anyone know why we ended up with beta-binomial? when we have beta posterior and binomial likelihood, shouldnt the final posterior be beta distribution?
If we wanted the posterior you are correct, but here the prior is P(\theta | x) since it is dependent on x you can't use the conjugate prior like you would normally. Hence once you do the math you get a different pdf.
results of your analysis. Would 10am on June 2 work for you?"[..] We see that the Posterior Predictive Distribution mirrors the posterior distribution[..]". Not true we can see that the probability of x'=0 is different than 0 even though the p(theta=0|x)=0. Which makes sense since a theta>0 can still generate by chance multiple data points with the 0 value. Really like these tutorials, thank you very much for doing them
does anyone know why we ended up with beta-binomial? when we have beta posterior and binomial likelihood, shouldnt the final posterior be beta distribution?
If we wanted the posterior you are correct, but here the prior is P(\theta | x) since it is dependent on x you can't use the conjugate prior like you would normally. Hence once you do the math you get a different pdf.
results of your analysis.
Would 10am on June 2 work for you?"[..] We see that the Posterior Predictive Distribution mirrors the posterior distribution[..]". Not true we can see that the probability of x'=0 is different than 0 even though the p(theta=0|x)=0. Which makes sense since a theta>0 can still generate by chance multiple data points with the 0 value. Really like these tutorials, thank you very much for doing them
where could I find the matlab codes for this?
use a map
```
clear; close all; clc
% Prior parameters
a = 1;
b = 1;
%Data
N1 = 10;
X = 1;
theta = linspace(0,1,100);
Y_prior = betapdf(theta,a,b);
Y_likelihood = nchoosek(N1,X)*(theta.^X).*(1-theta).^(N1-X);
Y_posterior = betapdf(theta, a+X,b+N1-X);
% New Data
N2 = 10
x = 0:N2;
for i = 1:N2+1
Y_postpredict(i) = bbinopdf(x(i),N2,X+a,N1+b-X);
end
h = figure(1);
subplot(4,1,1),
plot(theta,Y_prior, 'LineWidth', 3)
title('Prior', 'FontSize', 20)
set(gca, 'FontSize', 20)
ylabel('pdf')
subplot(4,1,2),
plot(theta,Y_likelihood,'m','LineWidth',3)
set(gca, 'FontSize', 20)
title('Likelihood','FontSize',20)
ylabel('likelihood')
subplot(4,1,3),
plot(theta,Y_posterior,'r','LineWidth',3)
title('Posterior','FontSize',20)
ylabel('pdf')
set(h,'Position', [1000 150 900 900])
subplot(4,1,4),
plot(x, Y_postpredict, 'co','LineWidth',3)
title('New sample disease predicted number','FontSize',20)
ylabel('pdf')
set(h,'Position', [1000 150 900 900])
```
bbinopdf() is available here: au.mathworks.com/matlabcentral/fileexchange/25454-bbinopdf
hello...
please mention which software program you used to draw posterior distribution.
The program used was MATLAB.
Alternatively you can use octave, www.gnu.org/software/octave/
thanks oxi
tangna di ako makatulog tunyt