### Bayesian - R

# Bayesian Statistics in R

# taught by Peter Congdon

Aim of Course:

After taking this online course, "Bayesian Statistics in R" you will be able to install and run rjags, a program for Bayesian analysis within R. Using R and rjags, you will learn how to specify and run Bayesian modeling procedures using regression models for continuous, count and categorical data. Procedures covered from a Bayesian perspective include linear regression, Poisson, logit and negative binomial regression, and ordinal regression.

This course may be taken individually (one-off) or as part of a certificate program.

Course Program:

Note: You will interact with your colleagues and the instructor on a daily basis via a private discussion forum.

## WEEK 1: Using rjags for Bayesian inference in R: Introductory Ideas and Programming Considerations

- Basic Principles of Bayesian Inference and MCMC Sampling
- R and rjags for Bayesian inference. Initial values, posterior summaries, checking convergence.
- JAGS and BUGS programming Syntax, with simple applications

## WEEK 2: Linear Regression with rjags

- Specifying Models
- Specifying Priors on Regression Coefficients and Residual Variances
- Posterior Summarisation in R

## WEEK 3: Regression for Count, Binary and Binomial Data

- Poisson Regression
- Logit and Probit Regression
- Negative Binomial Regression

## WEEK 4: Other Regression Techniques

- Ordinal and multinomial regression
- Categorical predictors
- Predictor selection

HOMEWORK:

The homework in this course consists of short answer questions to test concepts, guided exercises in writing code and guided data analysis problems using

software.

This course also has example software codes, supplemental readings available online, and an end of course project.

# Bayesian Statistics in R

Who Should Take This Course:

You should take this course if you are familiar with R and with Bayesian statistics at the introductory level, and work with or interpret statistical models and need to incorporate Bayesian methods. Analysts who need to incorporate their work into real-world decisions, as opposed to formal statistical inference for publication, will be especially interested. This includes business analysts, environmental scientists, regulators, medical researchers, and engineers. Note: In this course you will learn both BUGS coding and how to integrate it into R. If you are not familiar with BUGS, and want to take the time to learn BUGS first, consider taking the optional prerequisite listed below.

Level:

- Introduction to Bayesian Statistics
- Familiarity with R
- OPTIONAL: Introduction to Bayesian Computing (if needed - see "Who Should Take This Course" above)

Organization of the Course:

This course takes place online at the Institute for 4 weeks. During each course week, you participate at times of your own choosing - there are no set times when you must be online. Course participants will be given access to a private discussion board. In class discussions led by the instructor, you can post questions, seek clarification, and interact with your fellow students and the instructor.

At the beginning of each week, you receive the relevant material, in addition to answers to exercises from the previous session. During the week, you are expected to go over the course materials, work through exercises, and submit answers. Discussion among participants is encouraged. The instructor will provide answers and comments, and at the end of the week, you will receive individual feedback on your homework answers.

Time Requirement:

About 15 hours per week, at times of your choosing.

Credit:

Students come to the Institute for a variety of reasons. As you begin the course, you will be asked to specify your category:

- You may be interested only in learning the material presented, and not be concerned with grades or a record of completion.
- You may be enrolled in PASS (Programs in Analytics and Statistical Studies) that requires demonstration of proficiency in the subject, in which case your work will be assessed for a grade.
- You may require a "Record of Course Completion," along with professional development credit in the form of Continuing Education Units (CEU's). For those successfully completing the course, CEU's and a record of course completion will be issued by The Institute, upon request.

Course Text:

*The BUGS Book - A Practical Introduction to Bayesian Analysis*, David Lunn et al. CRC Press (2012). Note: This book is an excellent guide to BUGS; it is not specifically about R, but all required instruction about R coding will be provided in the course materials. If you are already well familiar with BUGS and have your own reference, you may not need this book.

Software:

JAGS (Just Another Gibbs Sampler)

The course will focus on use of RJAGS. An rjags implementation in R rests crucially on coding in JAGS, which is virtually identical to BUGS.

# Bayesian Statistics in R

March 24, 2017 to April 21, 2017September 22, 2017 to October 20, 2017March 23, 2018 to April 20, 2018September 21, 2018 to October 19, 2018