michael-franke / Bayesian-Regression

Material for a course on (intermediate) Bayesian regression modeling
16 stars 7 forks source link

Suggested update for materials #2

Closed TiagoAMarques closed 3 months ago

TiagoAMarques commented 3 months ago

At some pointe you state that "The brms package allows us to quickly evaluate how many posterior samples fall into a certain value range. Just for fun, let’s calculate the amount of posterior samples that are larger than 1. The following code chunk does this for us:

hypothesis(model1, 'MAD > 1')

Hypothesis Tests for class b: Hypothesis Estimate Est.Error CI.Lower CI.Upper Evid.Ratio Post.Prob Star 1 (MAD)-(1) > 0 -0.06 0.03 -0.12 -0.01 0.04 0.04

'CI': 90%-CI for one-sided and 95%-CI for two-sided hypotheses. '*': For one-sided hypotheses, the posterior probability exceeds 95%; for two-sided hypotheses, the value tested against lies outside the 95%-CI. Posterior probabilities of point hypotheses assume equal prior probabilities.

The results tell us that fewer than 5% of all posterior samples are larger than 1. It also tells us the evidence ratio (more on this later), which is the odds of the hypothesis in question (here ‘MAD > 1’)."

in fact, it was not obvious to me where to take from this output that " fewer than 5% of all posterior samples are larger than 1" from in the output above, since the point estimate is for the derived quantity MAD-1. Not sure a reader will know what the "Post.Prob Star" is (I searched the help for "hypothesis" and could not find it), and I guess that is part of what you'd need to understand the output?

I found this quite distracting, because if one really wanted to " calculate the amount of posterior samples that are larger than 1" it would be much simpler to do this:

sum(posteriors1>1)/nrow(posteriors1) [1] 0.04

michael-franke commented 3 months ago

Enlarged on the use of 'hypothesis' function in this context. Notice that there is a whole chapter on hypothesis testing later.

TiagoAMarques commented 3 months ago

Cool. Reads well now, especially with the forward link to the hipothesis testing section. Thanks for taking the time to include the suggestions :)