r_user
r_user

Reputation: 374

Specifying priors for each predictor in rstanarm

I'm developing a Bayesian regression model through rstanarm that combines multinomial, binomial, and scale predictors on a scale dependent variable. As a regular model, my model would look as it does below:

````
 *
 deaths - scale
 gender - binomial
 hours - scale
 time - multinomial (i.e., morning, night, afternoon)
 *
lm(deaths ~ gender + hours + time)

I am attempting to create the same model through a Bayesian approach through rstanarm, however I am confused about how I would apply different priors to each of the predictor variables.

````
For example, lets say:
1. gender follows a beta prior
2. hours follows a normal prior
3. time follows a student_t

How would I implement this info?

Any help is appreciated, Thanks!

Upvotes: 5

Views: 1689

Answers (1)

eipi10
eipi10

Reputation: 93761

β1 ∈ (−15,−5) means (based on prior information) that we expect the coefficient of x1 to be roughly in the range of -15 to -5, so we choose a normal prior with mean=-10 and sd=5, which puts most of the prior probability between -15 and -5, and is more skeptical about values outside that range. Likewise, β2 ∈ (−1,1) means we expect the coefficient of x2 to be in the range -1 to 1, so we choose a normal prior with mean=0 and sd=2. These prior choices are notated in the vignette as β∼Normal((−10,0),(5,0,0,2)) (matrix form of the mean and variance/covariance).

For a concrete example, let's say we want to fit the following model with the mtcars data frame:

mpg ~  wt + hp + cyl

We want to specify priors for the three predictor variables. Let's say we want gaussian priors with, respectively, means of -1, 0, 1 and standard deviations of 4, 2, 3. We create these as follows:

my_prior <- normal(location = c(-1, 0, 1), scale = c(4, 2, 3), autoscale = FALSE)

Similarly, we can create priors for the intercept and the error standard deviation (which is what prior_aux is in this case):

my_prior_intercept <- student_t(4, 0, 10, autoscale=FALSE)
my_prior_aux <- cauchy(0, 3, autoscale=FALSE)

Then the model function is:

m1 = stan_glm(mpg ~  wt + hp + cyl, data = mtcars, 
              prior = my_prior, 
              prior_intercept=my_prior_intercept,
              prior_aux=my_prior_aux)

Upvotes: 6

Related Questions