[x] Created a short test run to check passing of user-defined parameters to stan_igbm.R. The creation of the datasets follows the documentation and is ommitted below. The relevant piece of code that replicates the error is:
parallel::detectCores()rstan_options(auto_write = TRUE)chains <- 4options(mc.cores = chains)igbm_fit <- stan_igbm( y_data = age_specific_mortality_counts, contact_matrix = aggr_cm, age_distribution_population = aggr_age, age_specific_ifr = aggr_age_ifr[[3]], itd_distr = ditd, incubation_period = 3, infectious_period = 4, likelihood_variance_type = "linear", prior_scale_x0 = 5, prior_scale_contactmatrix = 0.05, pi_perc = 0.1, prior_volatility = normal(location = 0, scale = 4), prior_nb_dispersion = exponential(rate = 1/5), algorithm_inference = "sampling", nBurn = 10, nPost = 50, nThin = 1, chains = chains, adapt_delta = 0.8, max_treedepth = 14, seed = 1)Error: passing unknown arguments: chains.
The error occurs because the option chains is not accepted by rstan::optimizing(). In https://github.com/stan-dev/rstanarm/blob/master/R/stan_betareg.fit.R, rstan::sampling() uses random initial random points. On the contrary, in the Bernadette package the initial points are informed by the estimates of the optimization routine.
[x] Prepare object for use in bayesplot::mcmc_pairs:
posterior_1 <- as.array(igbm_fit)Error in dim(x) <- length(x) : invalid first argument, must be vector (list or atomic)
parallel::detectCores()
rstan_options(auto_write = TRUE)
chains <- 4
options(mc.cores = chains)
igbm_fit <- stan_igbm( y_data = age_specific_mortality_counts, contact_matrix = aggr_cm, age_distribution_population = aggr_age, age_specific_ifr = aggr_age_ifr[[3]], itd_distr = ditd, incubation_period = 3, infectious_period = 4, likelihood_variance_type = "linear", prior_scale_x0 = 5, prior_scale_contactmatrix = 0.05, pi_perc = 0.1, prior_volatility = normal(location = 0, scale = 4), prior_nb_dispersion = exponential(rate = 1/5), algorithm_inference = "sampling", nBurn = 10, nPost = 50, nThin = 1, chains = chains, adapt_delta = 0.8, max_treedepth = 14, seed = 1)
Error: passing unknown arguments: chains.The error occurs because the option
chains
is not accepted by rstan::optimizing(). In https://github.com/stan-dev/rstanarm/blob/master/R/stan_betareg.fit.R, rstan::sampling() uses random initial random points. On the contrary, in the Bernadette package the initial points are informed by the estimates of the optimization routine.[x] Print MCMC summary statistics
print_summary <- summary(igbm_fit)
Error: C stack usage 15923824 is too close to the limit This is happening within the call tosummary-methods {rstan}
. See https://stackoverflow.com/questions/14719349/error-c-stack-usage-is-too-close-to-the-limit https://discourse.mc-stan.org/t/random-but-consistent-c-stack-error-on-windows-10/17799/16 https://github.com/stan-dev/rstan/issues/844[x] Prepare object for use in
bayesplot::mcmc_pairs
:posterior_1 <- as.array(igbm_fit)
Error in dim(x) <- length(x) : invalid first argument, must be vector (list or atomic)