Rstan help


I’m just learning Stan using Rstan. I have successfully programed some basic linear regressions (one dependent and one independent variable). But I evidently don’t understand how to right the correct script to change adapt_delta. Here is the line of Rstan code that runs one of my regression programs that conducts a simple hierarchical regression for 5 populations:

fit<-stan(file = ‘SR5H2.stan’, data = stanDat, init=list(list(beta=rep(15000,5), logalpha=rep(1.9,5))), iter = 1000, chains = 1).
Two questions:

  1. What is the correct code to add to this for controlling adapt_delta?
  2. What is the correct code to add to modify the init list to apply the inits to more than one chain?
    Obviously, I’m not an adept R user.

Thanks for any help.


fit<-stan(file = ‘SR5H2.stan’, data = stanDat, 
              control = list(adapt_delta = 0.95))

You shouldn’t worry about the inits in 99% of situations, but it would be

fit<-stan(file = ‘SR5H2.stan’, data = stanDat, 
              init = list(list(alpha = 0.1, beta = 0.2),
                          list(alpha = 0.5, beta = 1.0),


Thank you! I’ll make these changes and let you know if I encounter any problems.