Determining the probability distribution for student-t priors for brms

I have conducted an intervention study (with three different types of instruction) investigating the effectiveness of different instructional method on learners’ accuracy (binary response: correct vs incorrect). This is a close replication study so I have the raw data set from the original study. I would like to use that to help set the priors for conducting the bayesian analysis for the replication study. Using the get_prior(), i got that I could set student-t distribution. My collaborator decided to not work on the results suddenly so I am trying my best in the past 3 months to figure out both R and Bayesian. I tried my best but still finding it very difficult to set the priors. I don’t know what to where to find the values to insert into the bracket, especially for the degree of freedom, this is the default priors in brms but I don’t know how to use the original data to decide what to use to replace the three digits - student-t (3,0,2.5). Any help would be much appreciated!


Though I acknowledge you have a specific use case, it looks like you need some resource recommendations for people new to R and Bayes. There are a lot of ways to code in R, but I’m partial to the tidyverse style of coding, and R for Data Science is a great free ebook for that. For introductory Bayesian textbooks featuring R, I like McElreath’s text (website here) and Kruschke’s text (website here). I have free ebook companions for both texts that feature tidyverse style code and brms for the models (website here). If you decide to go with McElreath’s text, he also has a lot of great online lectures here. Finally, I taught a week-long workshop introducing Bayesian statistics with R about a year ago. Though the lecture videos are not available, you can find all my lecture materials, which are mainly well-annotated R script files, here.


Also, it looks like this was your first post. Welcome to the Stan forums!

1 Like

Hi Solomon,

Thank you so much for your reply. I will definitely explore the resources you have provided. Actually I started with Kruschke (I covered couple of chapters) and then McElreath (on Lecture 4 now), but it would take much longer before I can possibly translate those to my project at hand. In the end, I decided to go for normal() distribution instead of student-t() and managed to retrieve the estimates and sd from the 2018 study as priors now. Then, after running my brm models, I am now learning how to visualize the posterior distributions using ggplot2 and bayesplot. I will definitely go back to the basics once I have submitted this revision.

But I was wondering if you could tell me whether I did something wrong in plotting this, my graph for ppcheck() is in a U-shaped.

pp_check(brm.cloze.PRIOR, ndraws=50),
pp_check(brm.cloze.FLAT, ndraws=50))

Rplot01.pdf (232.4 KB)

It looks like your dependent variable is binary. You might try setting type = "bars" within pp_check(), and also setting ndraws = 1000. But yes, based on what your plots indicated, both versions of your model appear to have done a good job capturing the overall counts in the data.

Thank you so much Solomon!! I am glad that I finally managed to do something right. I really appreciate your help.

1 Like