Choice of sampler


#1

Dear users,

Reading through Stan’s documentation under heading Sampling i would like to know about the following statement
“For continuous parameters, Stan uses Hamiltonian Monte Carlo (HMC) sampling”

  1. For a real parameter defined in the parameters{ } block does the stan( ) function automatically selects HMC sampler if algorithm is not specified?
    Example:
parameters {
real theta;
}
model{
theta ~ normal(0 , 1);
}

And use

fit <- stan("modelcode",
             data = stan_data,
             chains = 1, iter = 100, 
             warmup = 50,
             ) 
  1. If algorithm is not specified, the output of print( ) says “samples are draws using NUTS(diag_e)”. Then, if the parameter estimated is real, does this output means that the result we get from the default stan( ) function is incorrect? or do we need to specify algorithm = c(“HMC”) in the stan( ) function?

  2. Is it legal to specify more than one algorithm at the same time? For example: algorithm = c(“NUTS”, “HMC”, “Fixed_param”) .

Thanks


#2

After reading through
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup

I now understand that NUTS is a variant of HMC used in Stan.

I should have read more carefully.


#3

By default Stan uses NUTS. It’s one variant of HMC, so sometimes NUTS gets called an HMC or whatnot. There have been various NUTS versions as well. It’s all a little confusing :D.

To the third question, you only get to use one algorithm at a time.


#4

@bbbales2, Thanks for clearing this.