4

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!

r_user
  • 317
  • 3
  • 11
  • Take a look at the "Prior Distributions for rstanarm Models" vignette: https://cran.r-project.org/web/packages/rstanarm/vignettes/priors.html – dipetkov Apr 04 '19 at 18:23
  • Yeah I was looking at that, but the formatting and functions are like martian to me. I've no clue how they go from β1∈(−15,−5) and β2∈(−1,1) To β∼Normal((−10,0),(5,0,0,2)), – r_user Apr 04 '19 at 18:26

1 Answers1

5

β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)
eipi10
  • 91,525
  • 24
  • 209
  • 285
  • Thats makes so much sense, thanks! As a follow up question, can you apply two different types of priors to the predictor variables? Or, as in this case, do they all need to be normal? – r_user Apr 04 '19 at 18:51
  • 2
    The help for `stan_glm` implies that you have to choose one function and I got an error when I tried to combine them. The help says: `prior should be a call to one of the various functions provided by rstanarm for specifying priors.` – eipi10 Apr 04 '19 at 19:02
  • 2
    You can in some cases effectively get two different ones. For example, if you want normal and student-t priors, use the `student_t` function but set the degrees of freedom (`df` argument) to be large (since the t-distribution approaches the normal distribution as df increases) for the prior that you want to be normal. What combinations of priors did you have in mind? – eipi10 Apr 04 '19 at 19:04
  • The data I have is a big combination of scale and binary variables, and most of the variables will need to be non-informative due to the lack of prior knowledge. Right now I have information on the mean and standard deviation of one predictor variable, the others seem like they will follow a non-informative beta (ie., due to the nature of the data). To answer your question, I'm looking at a mix of Gaussian and beta's. Also, since I am very new to Bayesian inference, could you provide some insight on how to translate prior descriptive data (i.e., mean and sd) into a β prior? – r_user Apr 04 '19 at 19:14
  • 1
    Remember that the prior information applies to the possible values of the *regression coefficient* for each predictor variable, not the values of the predictor variables themselves, so you should be okay with normal priors for the regression coefficients of the binary predictor variables. – eipi10 Apr 04 '19 at 19:18