Making Bayesian Predictions with Stan and R
stan

Making Bayesian Predictions with Stan and R

This is the third on a series of articles showing the basics of building models in Stan and accessing them in R. Now that we can specify a linear model and fit it in with formula syntax, and specify priors for the model, it would be useful to be able to make predictions with it. In principle making predictions from our linear model \( y \sim N(\alpha + \beta x, \sigma)\) is easy; to make point predictions we take central estimates of the coefficients \(\hat{\alpha}\) and \(\hat{\beta}\) and estimate \( y \approx \hat{\alpha} + \hat{\beta} x\).

Getting Started with RStan
r

Getting Started with RStan

I wanted to fit a Bayesian Tobit model, but I couldn't find one (probably because I didn't know how to look). So I decided to build one in Stan, which I had never used before. This article is the first in a series showing how I got there; this one builds a linear model in Stan and makes it useable from R using formula syntax, then next we add priors to the model, make model predictions from R, and then handle censored values with Tobit regression.

Fixing sampler errors in probit regression with rstanarm
stan

Fixing sampler errors in probit regression with rstanarm

I was working through problem 15.5 of Regression and Other Stories, which asks to fit a probit regression to a previous example with a logistic regression. I used a model I had built on the National Election Survey dataset (on rstanarm 2.21.1): fit_nes_probit <- rstanarm::stan_glm(rvote ~ income_int_std + gender + race + region + religion + education_cts + advanced_degree + party + ideology3 + gender : party, family=binomial(link="probit"), data=nes92) When I got this error about the chains not converging: