29 - Posterior predictive distribution: example Disease

Поделиться
HTML-код
  • Опубликовано: 22 дек 2024

Комментарии • 11

  • @SiDanil
    @SiDanil 6 лет назад +2

    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?

    • @MatthewLandowski
      @MatthewLandowski 6 лет назад +1

      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.

  • @jpiabrantes
    @jpiabrantes 9 лет назад

    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

  • @afrianisinaga6009
    @afrianisinaga6009 7 лет назад

    where could I find the matlab codes for this?

    • @lemyul
      @lemyul 5 лет назад

      use a map

    • @JohnForbes
      @JohnForbes 4 года назад +2

      ```
      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

  • @sarashahnawaz448
    @sarashahnawaz448 7 лет назад

    hello...
    please mention which software program you used to draw posterior distribution.

    • @JohnForbes
      @JohnForbes 4 года назад

      The program used was MATLAB.

    • @JohnForbes
      @JohnForbes 4 года назад

      Alternatively you can use octave, www.gnu.org/software/octave/

  • @lemyul
    @lemyul 5 лет назад

    thanks oxi

  • @lemyul
    @lemyul 5 лет назад

    tangna di ako makatulog tunyt