Hi,
Suppose beta is my parameter of interest and it’s a vector of length 3. To help my model get quicker convergence I would like to specify some initial values for beta. May I ask that could I only specify the first two components of beta or I need to specify all the three components of beta?
Current I could only specify initial values for all three components of beta in Rstan like the following:
initfun_beta <- function(...) {
list(beta = c(1,10, 100))
}
model<- stan(...,init = initfun_beta)
But actually I only have good enough initial values for the first two components so could I only specify partial initial values for a vector of parameter in Stan?
Thx!
I think you have to specify them all, but you can just pick a random initialization for the last one (which is what Stan will do).
By default Stan initializes parameters from a uniform distribution [-2, 2] on the unconstrained space. If the variable has no constraints, then the [-2, 2] is the distribution of inits. If it is lower bound constrained at 0.0, what would actually happen is:
initial_value_unconstrained = runif(1, -2, 2)
initial_value = exp(initial_value_unconstrained)
1 Like
Thanks so much and the basic idea is starting from unif[-2,2] and do some transformation to get the proper support on the constrained space?
Thx!
Yeah, that’s what Stan does behind the scenes.
Nothing too special about [-2, 2]
, the idea is to start sampling from an overdispersed distribution (like, imagine a distribution that is wider than the one you are trying to sample). The idea in the overdispered case is all the chains kinda head in different directions and so when they come together its easier to tell. If they all start in different places but head in about the same direction, then it’s practically harder to tell when they’ve all ended up mixing.
The transformations are described here: 10 Constraint Transforms | Stan Reference Manual