-
-
Notifications
You must be signed in to change notification settings - Fork 98
Description
Summary:
When running the sampler on a model which doesn't have any parameters, the command program should be
able to detect whether or not the model has no parameters, and in this case, it should run fixed_param automatically.
Description:
It is extremely annoying to get the "fixed_param" error message when trying to use Stan programs to produce simulated data.
check here:
cmdstan/src/cmdstan/command.hpp
Lines 390 to 392 in 9b711ed
| if (model.num_params_r() == 0 && algo->value() != "fixed_param") { | |
| info("Must use algorithm=fixed_param for model that has no parameters."); | |
| return_code = stan::services::error_codes::CONFIG; |
instead of quitting, the reasonable thing to do is run the non-adaptive sampler for the specified number of sampling iterations.
Reproducible Steps:
here's a datagen program in Stan:
// generate parameters, data, outcomes for poisson regression
transformed data {
int N_obs = 20; // specify constants
}
generated quantities {
int N = N_obs;
int y_sim[N_obs];
vector[N_obs] x_sim;
vector[N_obs] pop_sim;
real alpha_sim;
real beta_sim;
real phi_sim;
real mu[N_obs]; // mean
alpha_sim = normal_rng(0, 1); // simulate parameters
beta_sim = normal_rng(0, 1); // from prior
while (1) {
phi_sim = normal_rng(0, 1);
if (phi_sim > 0) break;
}
for (n in 1:N_obs) { // simulate data from params
pop_sim[n] = uniform_rng(500,2500);
x_sim[n] = uniform_rng(0.01,0.99);
mu[n] = log(pop_sim[n]) + alpha_sim + x_sim[n] * beta_sim;
y_sim[n] = neg_binomial_2_log_rng(mu[n], phi_sim);
}
}
Current Output:
Run the Stan sampler - error message: "Must use algorithm=fixed_param for model that has no parameters."
Expected Output:
Describe what you expect the output to be. Knowing the correct behavior is also very useful.
Should just work.
Current Version:
v2.25.0