Install the app

Install this application on your home screen for quick and easy access when you’re on the go.

Just tap Share then “Add to Home Screen”


Install the app

Install this application on your home screen for quick and easy access when you’re on the go.

Just tap Share then “Add to Home Screen”

Advanced Bayesian Statistics for the Social Sciences

Juraj Medzihorsky

University of Gothenburg

Juraj Medzihorsky gained his PhD in Political Science from CEU and is currently a Postdoc at the Department of International Relations there.

His main research interests are models of election returns, modelling unobserved heterogeneity with mixtures, and text analysis.

His research has appeared in Political Analysis and PS:Political Science & Politics.


Course Dates and Times

Monday 1 to Friday 5 August 2016
Generally classes are either 09:00-12:30 or 14:00-17:30
15 hours over 5 days

Prerequisite Knowledge

  • Understanding of the basics of Bayesian inference
  • Understanding of the differences between frequentist and Bayesian inference
  • Experience with the Generalized Linear Model (GLM), e.g. OLS, logit/probit
  • Experience with Multi-Level Models (MLM) is helpful, but not necessary
  • Comfortable with R
  • Some experience with at least one of the following WinBUGS/OpenBUGS/JAGS/Stan recommended, but not necessary

Short Outline

The course is intended for participants with a working understanding of Bayesian statistics who wish to learn about topics relevant for applied social research which are not standardly covered by introductions to Bayesian statistics for social scientists. These include robust regression, handling limited or zero-inflated dependent variables, the use of informative priors and regularization, mixture models, and latent variable models. The goal of the course is to allow the participants to competently use the methods in their own research. For that reason, the focus is on existing multi-purpose software as opposed to programming the Markov chain Monte Carlo algorithms from the ground, and the course does not include detailed technical expositions of the algorithms on which the methods rest. The primary software will be R and JAGS. Furthermore, the participants will be introduced also to  Stan, which allows to use Hamiltonian Monte Carlo with JAGS-like user comfort.

Long Course Outline

Day 1: Review

The first day reviews the material commonly included in introductory courses of Bayesian statistics for social sciences. These are the basics of Bayesian inference, the differences between frequentist and Bayesian statistics, basics of Bayesian computation using Markov chain Monte Carlo, Bayesian Normal linear regression, Bayesian Binomial logistic regression, Bayesian hierarchical linear model, and basics of Bayesian model evaluation. The topics will be reviewed with the emphasis on the use of the models with JAGS. The session is not a substitute for a first introduction to Bayesian statistics.


Day 2: GLM Special Topics
Normal linear regression and Binomial logistic regression are workhorses of social science research. However, in some contexts other members of the GLM family might be more appealing. Such contexts include count, limited, or zero-inflated left-hand-side (outcome/dependent) variables. The flexibility of Bayesian computation as implemented in JAGS or Stan makes easily accessible to applied researchers a wide variety of sampling distributions and link functions that allow to handle these issues in GLM/MLM. For example, in the linear-model context it might be desirable to reduce the influence of 'outlier' observations, i.e., a robust alternative to the Normal sampling distribution might be desirable. The t, Laplace, and Logistic distributions can be used to this aim. For another example, in some contexts the outcome of interest is a proportion limited to [0%, 100%], and the data contain considerable number of 0% and 100%. The Beta and Binomial distributions can be jointly used to handle it. For a final example, due to substantive or operational concerns a linear model that minimizes the largest absolute residual might be desirable, which can be achieved using the Uniform sampling distribution. 


Day 3: Informative Priors and Regularization

Introductions to Bayesian GLM often rely on priors that lead to results numerically close to those under MLE. Other priors are preferable in many contexts. Extra-data information such as expert judgment or qualitative case studies can be used to formulate priors. This is especially useful when the data is weak in the sense that it offers only limited information on the parameters of interest due to its small size or noisiness. Also, various deals on the bias-variance trade-off are available through priors. First, weakly informative priors can be used to handle linear separation in logistic models, or in other instances where MLE estimates are known to be biased. Second, through the use of priors are available Bayesian ridge and lasso, which offer to exchange an increase in bias for a substantial reduction of variance. The ridge can be used to handle multicollinearity. The lasso provides variable selection, which can appeal in settings with many right-hand-side (predictor/independent) variables. Furthermore, the 'horseshoe' prior offers an additional Bayesian alternative to the lasso.


Day 4: Mixture Models
In social science research, it is often an easy assumption that the observations differ in important but unobserved ways. In some contexts, it is appealing to assume that the population is composed of a limited number of groups that differ in a characterstic such as the association between two variables of interest. Mixture models can be used to handle such unobserved heterogeneity. The flexibility of MCMC as implemented in JAGS allows for an easy use of a variety of such models. Furthermore, from the Bayesian perspective it can be appealing to think of the groups in terms of a hierarchical model under which the memberships in upper-level units are not observed. Finally, mixture models can be used to evaluate competing theories using models in which each of the mixture components represents one of the theories.


Day 5: Latent Variable Models

In social science research, latent variable models are used to a variety of aims, including the measurement of concepts which are not directly observable. An example of such application is scaling  two-way contingency tables to obtain estimates of legislator ideal points or voter ideology. Bayesian Latent Variable Models allow for straightforward modeling of hierarchical structures in such data as well as for the use of extra-data information.

Day Topic Details
Monday Review: Bayes, GLM, MLM

60 minutes seminar 120 minutes lab

Tuesday GLM Special Topics

60 minutes seminar 120 minutes lab

Wednesday Informative Priors and Regularization

60 minutes seminar 120 minutes lab

Thursday Mixture Models

60 minutes seminar 120 minutes lab

Friday Latent Variable Models

60 minutes seminar 120 minutes lab

Day Readings


Lynch, S.M. (2007). Introduction to Applied Bayesian Statistics and Estimation for Social Scientists. Springer. Chapters 3, 6-9.


Gelman, A., (2015). Bayesian Data Analysis, Third Edition. CRC Press, Chapter 6.


Gelman, A., (2015). Bayesian Data Analysis, Third Edition. CRC Press, Chapters 7, 14-16.


Clark, M. (2015). Bayesian Basiscs.


Gelman, A., Lee. D., Guo, J., (2015). Stan: A probabilistic programming language for Bayesian inference and optimization.



Gelman, A., (2015). Bayesian Data Analysis, Third Edition. CRC Press, Chapter 17.


Gelman, A., Jakulin, A., Pittau, M. G., & Su, Y. S. (2008). A weakly informative default prior distribution for logistic and other regression models. The Annals of Applied Statistics, 1360-1383.


Gill, J. (2014). Bayesian Methods: A Social and Behavioral Sciences Approach, Second Edition. CRC press. Chapter 4, 'The Bayesian Prior.'


Gill, J., & Walker, L. D. (2005). Elicited priors for Bayesian model specifications in political science research. Journal of Politics, 67(3), 841-872.


McCarthy, M.A. (2007). Bayesian Methods for Ecology. Cambridge University Press. Chapter 10, 'Subjective Priors'


Lykou, A., & Ntzoufras, I. (2013). On Bayesian lasso variable selection and the specification of the shrinkage parameter. Statistics and Computing, 23(3), 361-390.


Hastie, T., Tibshirani, R., Friedman, J., (2013). The Elements of Statistical Learning, Second Edition. Springer. Subsection 3.4,  61-73 (until 3.4.4).


Wedel, M., & DeSarbo, W.S. (2002), Mixture Regression Models, In: Hagenaars, J. A., & McCutcheon, A. L. (Eds.). Applied latent class analysis. Cambridge University Press. 366-382.


Gelman, A., (2015). Bayesian Data Analysis, Third Edition. CRC Press, Chapter 22. 519-544.


Imai, K., & Tingley, D. (2012). A statistical method for empirical testing of competing theories. American Journal of Political Science, 56(1), 218-236.


Barberá, P. (2015). Birds of the same feather tweet together: Bayesian ideal point estimation using Twitter data. Political Analysis, 23(1), 76-91.

Clinton, J., Jackman, S., & Rivers, D. (2004). The statistical analysis of roll call data. American Political Science Review, 98(02), 355-370.


Pemstein, D., Meserve, S. A., & Melton, J. (2010). Democratic compromise: A latent variable analysis of ten measures of regime type. Political Analysis, mpq020.

Software Requirements

R and JAGS, interfaced with the rjags R package. The rstan package is highly recommended by the instructor, but not necessary. It is not possible to indicate precise versions, as different versions might be available depending on the operating system. In any case, this  should make no difference with regards to the course content. The participants are strongly encouraged to set up the software in advance, and to contact the instructor regarding software issues if necessary.


Although it is not necessary, the participants might wish to use either RStudio or an editor with REPL. Examples of the latter are vim with vim-r-plugin (the instructor's personally preferred option), Emacs with Emacs Speaks Statistics, or Sublime Text with Sublime REPL and R-box. These options save time in reading and editing R scripts.




Stan and rstan:


Emacs Speaks Statistics:

on ESS see also:


Hardware Requirements

Participants to bring their own laptop. Disk space requirements vary depending on the operating system. In any case, 5 Gb of disk space should be enough under any conditions, and 2 Gb under most. For participants who wish to use their laptops, a minimum of 2 Gb of RAM is recommended.

Recommended Courses to Cover Before this One

<p>Introduction to Bayesian Inference</p> <p>Gentle Introduction to Bayesian Statistics</p>

Additional Information


This course description may be subject to subsequent adaptations (e.g. taking into account new developments in the field, participant demands, group size, etc). Registered participants will be informed at the time of change.

By registering for this course, you confirm that you possess the knowledge required to follow it. The instructor will not teach these prerequisite items. If in doubt, please contact us before registering.