Skip to content

Posterior probability does not integrate to 1 #3

Description

@monga

The last line of slide 61 (https://speakerdeck.com/rmcelreath/statistical-rethinking-2022-lecture-02?slide=61) and in the book R code 3.2 (and R code 2.3) uses a standardization rule different from the one used for prior probability.

As explained by the Overthinking box at page 35 of the book, prior is an array of ones, since the important property is that it integrates to one over p_grid. The sum of the values of prior is indeed much greater than 1 (20 in code 2.3, 1000 in code 3.2).

The standardization used for posterior instead guarantees that sum(posterior) == 1, while the integral over p_grid is less than one.

This is not relevant for the shape of the posterior curve, but the asymmetry bothers me. I believe the right statement to use in 3.2 is

posterior <- (posterior / sum(posterior))*length(posterior)

then sum(posterior) == sum(prior) and both their integrals over p_grid should be 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions