Let’s look at the differences between some parameters in a fake posterior distribution.
Here’s an areas plot of 4 parameters.
FakePosterior %>% select(matches("a|b")) %>% precis()
## mean sd 5.5% 94.5% histogram
## a 10 1.999922 6.805612 13.19439 ▁▁▂▇▇▂▁▁
## b1 17 3.999844 10.611224 23.38878 ▁▁▃▇▃▁▁
## b2 17 3.999844 10.611224 23.38878 ▁▁▃▇▃▁▁
## b3 17 3.999844 10.611224 23.38878 ▁▁▃▇▃▁▁
FakePosterior %>% mcmc_areas( regex_pars = "a|b")
We are interested in the differences between the a parameter and the b parameters. Fortunately, we have heard enough times that we should compute those differences in the posterior and not just look at the plot above.
FakePosterior <-
FakePosterior %>%
mutate(
d1 = b1 - a,
d2 = b2 - a,
d3 = b3 - a
)
FakePosterior %>% mcmc_areas( regex_pars = "a|b1|d")
Can you figure out why this is happening? How do you think I created the fake posterior to make this happen? What plot might you make to see if that’s what I did?
FakePosterior %>% mcmc_pairs( regex_pars = "a|b")
## Warning: Only one chain in 'x'. This plot is more useful with multiple chains.
FakePosterior <-
FakePosterior %>%
mutate(
e12 = b1 - b2,
e23 = b2 - b3,
e31 = b3 - b1
)
FakePosterior %>% mcmc_areas( regex_pars = "b|e")