From bab2e1b4b2c118d5e2c5f7acaf0c639413339cd0 Mon Sep 17 00:00:00 2001 From: Fonti Kar Date: Wed, 20 Mar 2024 15:36:39 +1100 Subject: [PATCH] Added internal testing data so no data is created within test_that() functions, y_single and y_multi are not evaluated globally #1 --- .Rbuildignore | 1 + R/sysdata.rda | Bin 0 -> 340 bytes data-raw/DATASET.R | 13 + src/stanExports_constant_multi_ind.h | 1188 ++++++++++----------- src/stanExports_constant_single_ind.h | 932 ++++++++--------- src/stanExports_linear.h | 661 ++++++------ tests/testthat/_snaps/rmot_models.md | 1378 +++---------------------- tests/testthat/test-rmot_models.R | 19 +- 8 files changed, 1484 insertions(+), 2708 deletions(-) create mode 100644 R/sysdata.rda create mode 100644 data-raw/DATASET.R diff --git a/.Rbuildignore b/.Rbuildignore index 74b0c8d..8e2aed1 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -6,3 +6,4 @@ ^LICENSE\.md$ ^\.github$ ^codecov\.yml$ +^data-raw$ diff --git a/R/sysdata.rda b/R/sysdata.rda new file mode 100644 index 0000000000000000000000000000000000000000..de52f8326ba32ce5dead56171457098e276d8330 GIT binary patch literal 340 zcmV-a0jvH(T4*^jL0KkKS+~Z3cmM!RfB*gWRq5~4eK7vgkl(YfZ?pii<(?sdnGwNK zK+@ibxCt--xv=75U?u>DMgS3l1_^)wOd}DaLkMP?2=q*79;VbdOaKJH011;!6951W z0GMiGXfYU=13&-(ff+0}-PmLn9{9G%z(910Vn}EI#2N*4aB9 z5ln4iQ4?{OlNE zR&T@0$zYf-+UO20h$o&4!iidnBD_Mk%lP};g?|+W*_b*4B37?>MjidJ^#I5Aa|7ty m01OPeL)Jg8y-b6fS}z@dAok)UkQdJPi@744C`eo5Ks*3mW{z3_ literal 0 HcmV?d00001 diff --git a/data-raw/DATASET.R b/data-raw/DATASET.R new file mode 100644 index 0000000..c5dffa0 --- /dev/null +++ b/data-raw/DATASET.R @@ -0,0 +1,13 @@ +## code to prepare `DATASET` dataset goes here + +true_single <- seq(from=1, by=2.5, length.out=7) +set.seed(2024) +y_single <- true_single + true_single*rnorm(n=7, 0, 0.02) + rnorm(n=7, 0, 0.2) + + +true_multi <- c(seq(from=1, by=2.5, length.out=7), + seq(from=2, by=2, length.out=7)) +set.seed(2024) +y_multi <- true_multi + true_multi*rnorm(n=14, 0, 0.02) + rnorm(n=14, 0, 0.2) + +usethis::use_data(y_single, y_multi, overwrite = TRUE, internal = TRUE) diff --git a/src/stanExports_constant_multi_ind.h b/src/stanExports_constant_multi_ind.h index d5dede6..a30c3f5 100644 --- a/src/stanExports_constant_multi_ind.h +++ b/src/stanExports_constant_multi_ind.h @@ -21,144 +21,91 @@ #define USE_STANC3 #endif #include -// Code generated by stanc v2.26.1-4-gd72b68b7-dirty +// Code generated by stanc v2.32.2 #include namespace model_constant_multi_ind_namespace { -inline void validate_positive_index(const char* var_name, const char* expr, - int val) { - if (val < 1) { - std::stringstream msg; - msg << "Found dimension size less than one in simplex declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -inline void validate_unit_vector_index(const char* var_name, const char* expr, - int val) { - if (val <= 1) { - std::stringstream msg; - if (val == 1) { - msg << "Found dimension size one in unit vector declaration." - << " One-dimensional unit vector is discrete" - << " but the target distribution must be continuous." - << " variable=" << var_name << "; dimension size expression=" << expr; - } else { - msg << "Found dimension size less than one in unit vector declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - } - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -using std::istream; -using std::string; -using std::stringstream; -using std::vector; -using std::pow; -using stan::io::dump; -using stan::math::lgamma; using stan::model::model_base_crtp; -using stan::model::rvalue; -using stan::model::cons_list; -using stan::model::index_uni; -using stan::model::index_max; -using stan::model::index_min; -using stan::model::index_min_max; -using stan::model::index_multi; -using stan::model::index_omni; -using stan::model::nil_index_list; using namespace stan::math; -using stan::math::pow; stan::math::profile_map profiles__; -static int current_statement__= 0; -static const std::vector locations_array__ = {" (found before start of program)", - " (in 'constant_multi_ind', line 21, column 2 to column 31)", - " (in 'constant_multi_ind', line 22, column 2 to column 32)", - " (in 'constant_multi_ind', line 23, column 2 to column 23)", - " (in 'constant_multi_ind', line 24, column 2 to column 35)", - " (in 'constant_multi_ind', line 26, column 2 to column 35)", - " (in 'constant_multi_ind', line 62, column 2 to column 20)", - " (in 'constant_multi_ind', line 63, column 2 to column 24)", - " (in 'constant_multi_ind', line 67, column 6 to column 36)", - " (in 'constant_multi_ind', line 66, column 23 to line 68, column 5)", - " (in 'constant_multi_ind', line 66, column 4 to line 68, column 5)", - " (in 'constant_multi_ind', line 70, column 4 to column 47)", - " (in 'constant_multi_ind', line 75, column 8 to column 65)", - " (in 'constant_multi_ind', line 73, column 32 to line 76, column 7)", - " (in 'constant_multi_ind', line 73, column 6 to line 76, column 7)", - " (in 'constant_multi_ind', line 72, column 17 to line 77, column 5)", - " (in 'constant_multi_ind', line 72, column 4 to line 77, column 5)", - " (in 'constant_multi_ind', line 64, column 19 to line 78, column 3)", - " (in 'constant_multi_ind', line 64, column 2 to line 78, column 3)", - " (in 'constant_multi_ind', line 30, column 13 to column 18)", - " (in 'constant_multi_ind', line 30, column 2 to column 20)", - " (in 'constant_multi_ind', line 31, column 17 to column 22)", - " (in 'constant_multi_ind', line 31, column 2 to column 24)", - " (in 'constant_multi_ind', line 35, column 6 to column 36)", - " (in 'constant_multi_ind', line 34, column 23 to line 36, column 5)", - " (in 'constant_multi_ind', line 34, column 4 to line 36, column 5)", - " (in 'constant_multi_ind', line 38, column 4 to column 47)", - " (in 'constant_multi_ind', line 43, column 8 to column 65)", - " (in 'constant_multi_ind', line 41, column 32 to line 44, column 7)", - " (in 'constant_multi_ind', line 41, column 6 to line 44, column 7)", - " (in 'constant_multi_ind', line 40, column 17 to line 45, column 5)", - " (in 'constant_multi_ind', line 40, column 4 to line 45, column 5)", - " (in 'constant_multi_ind', line 32, column 19 to line 46, column 3)", - " (in 'constant_multi_ind', line 32, column 2 to line 46, column 3)", - " (in 'constant_multi_ind', line 48, column 2 to column 44)", - " (in 'constant_multi_ind', line 51, column 2 to column 48)", - " (in 'constant_multi_ind', line 52, column 2 to line 53, column 40)", - " (in 'constant_multi_ind', line 55, column 2 to column 35)", - " (in 'constant_multi_ind', line 56, column 2 to column 37)", - " (in 'constant_multi_ind', line 58, column 2 to column 37)", - " (in 'constant_multi_ind', line 10, column 2 to column 12)", - " (in 'constant_multi_ind', line 11, column 2 to column 12)", - " (in 'constant_multi_ind', line 12, column 13 to column 18)", - " (in 'constant_multi_ind', line 12, column 2 to column 20)", - " (in 'constant_multi_ind', line 13, column 16 to column 21)", - " (in 'constant_multi_ind', line 13, column 2 to column 23)", - " (in 'constant_multi_ind', line 14, column 12 to column 17)", - " (in 'constant_multi_ind', line 14, column 2 to column 19)", - " (in 'constant_multi_ind', line 15, column 13 to column 18)", - " (in 'constant_multi_ind', line 15, column 2 to column 20)", - " (in 'constant_multi_ind', line 16, column 15 to column 20)", - " (in 'constant_multi_ind', line 16, column 2 to column 22)", - " (in 'constant_multi_ind', line 21, column 24 to column 29)", - " (in 'constant_multi_ind', line 22, column 25 to column 30)", - " (in 'constant_multi_ind', line 62, column 13 to column 18)", - " (in 'constant_multi_ind', line 63, column 17 to column 22)", - " (in 'constant_multi_ind', line 5, column 4 to column 16)", - " (in 'constant_multi_ind', line 4, column 24 to line 6, column 3)"}; -template -stan::promote_args_t -growth(const T0__& beta, std::ostream* pstream__) { +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'constant_multi_ind', line 21, column 2 to column 31)", + " (in 'constant_multi_ind', line 22, column 2 to column 32)", + " (in 'constant_multi_ind', line 23, column 2 to column 23)", + " (in 'constant_multi_ind', line 24, column 2 to column 35)", + " (in 'constant_multi_ind', line 26, column 2 to column 35)", + " (in 'constant_multi_ind', line 62, column 2 to column 20)", + " (in 'constant_multi_ind', line 63, column 2 to column 24)", + " (in 'constant_multi_ind', line 67, column 6 to column 36)", + " (in 'constant_multi_ind', line 66, column 23 to line 68, column 5)", + " (in 'constant_multi_ind', line 66, column 4 to line 68, column 5)", + " (in 'constant_multi_ind', line 70, column 4 to column 47)", + " (in 'constant_multi_ind', line 75, column 8 to column 65)", + " (in 'constant_multi_ind', line 73, column 32 to line 76, column 7)", + " (in 'constant_multi_ind', line 73, column 6 to line 76, column 7)", + " (in 'constant_multi_ind', line 72, column 17 to line 77, column 5)", + " (in 'constant_multi_ind', line 72, column 4 to line 77, column 5)", + " (in 'constant_multi_ind', line 64, column 19 to line 78, column 3)", + " (in 'constant_multi_ind', line 64, column 2 to line 78, column 3)", + " (in 'constant_multi_ind', line 30, column 13 to column 18)", + " (in 'constant_multi_ind', line 30, column 2 to column 20)", + " (in 'constant_multi_ind', line 31, column 17 to column 22)", + " (in 'constant_multi_ind', line 31, column 2 to column 24)", + " (in 'constant_multi_ind', line 35, column 6 to column 36)", + " (in 'constant_multi_ind', line 34, column 23 to line 36, column 5)", + " (in 'constant_multi_ind', line 34, column 4 to line 36, column 5)", + " (in 'constant_multi_ind', line 38, column 4 to column 47)", + " (in 'constant_multi_ind', line 43, column 8 to column 65)", + " (in 'constant_multi_ind', line 41, column 32 to line 44, column 7)", + " (in 'constant_multi_ind', line 41, column 6 to line 44, column 7)", + " (in 'constant_multi_ind', line 40, column 17 to line 45, column 5)", + " (in 'constant_multi_ind', line 40, column 4 to line 45, column 5)", + " (in 'constant_multi_ind', line 32, column 19 to line 46, column 3)", + " (in 'constant_multi_ind', line 32, column 2 to line 46, column 3)", + " (in 'constant_multi_ind', line 48, column 2 to column 44)", + " (in 'constant_multi_ind', line 51, column 2 to column 48)", + " (in 'constant_multi_ind', line 52, column 2 to line 53, column 40)", + " (in 'constant_multi_ind', line 55, column 2 to column 35)", + " (in 'constant_multi_ind', line 56, column 2 to column 37)", + " (in 'constant_multi_ind', line 58, column 2 to column 37)", + " (in 'constant_multi_ind', line 10, column 2 to column 12)", + " (in 'constant_multi_ind', line 11, column 2 to column 12)", + " (in 'constant_multi_ind', line 12, column 13 to column 18)", + " (in 'constant_multi_ind', line 12, column 2 to column 20)", + " (in 'constant_multi_ind', line 13, column 16 to column 21)", + " (in 'constant_multi_ind', line 13, column 2 to column 23)", + " (in 'constant_multi_ind', line 14, column 12 to column 17)", + " (in 'constant_multi_ind', line 14, column 2 to column 19)", + " (in 'constant_multi_ind', line 15, column 13 to column 18)", + " (in 'constant_multi_ind', line 15, column 2 to column 20)", + " (in 'constant_multi_ind', line 16, column 15 to column 20)", + " (in 'constant_multi_ind', line 16, column 2 to column 22)", + " (in 'constant_multi_ind', line 21, column 24 to column 29)", + " (in 'constant_multi_ind', line 22, column 25 to column 30)", + " (in 'constant_multi_ind', line 62, column 13 to column 18)", + " (in 'constant_multi_ind', line 63, column 17 to column 22)", + " (in 'constant_multi_ind', line 5, column 4 to column 16)", + " (in 'constant_multi_ind', line 4, column 24 to line 6, column 3)"}; +template >* = nullptr> +stan::promote_args_t growth(const T0__& beta, std::ostream* pstream__); +template >*> +stan::promote_args_t growth(const T0__& beta, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; - const static bool propto__ = true; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning (void) propto__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { current_statement__ = 56; return beta; } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - -} -struct growth_functor__ { -template -stan::promote_args_t -operator()(const T0__& beta, std::ostream* pstream__) const -{ -return growth(beta, pstream__); } -}; #include class model_constant_multi_ind final : public model_base_crtp { private: @@ -169,657 +116,622 @@ class model_constant_multi_ind final : public model_base_crtp time; std::vector ind_id; std::vector y_0_obs; - public: - ~model_constant_multi_ind() { } - - inline std::string model_name() const final { return "model_constant_multi_ind"; } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = stanc3 v2.26.1-4-gd72b68b7-dirty", "stancflags = "}; - } - - - model_constant_multi_ind(stan::io::var_context& context__, - unsigned int random_seed__ = 0, - std::ostream* pstream__ = nullptr) : model_base_crtp(0) { - using local_scalar_t__ = double ; - boost::ecuyer1988 base_rng__ = - stan::services::util::create_rng(random_seed__, 0); - (void) base_rng__; // suppress unused var warning - static const char* function__ = "model_constant_multi_ind_namespace::model_constant_multi_ind"; - (void) function__; // suppress unused var warning + ~model_constant_multi_ind() {} + model_constant_multi_ind(stan::io::var_context& context__, unsigned int + random_seed__ = 0, std::ostream* + pstream__ = nullptr) : model_base_crtp(0) { + int current_statement__ = 0; + using local_scalar_t__ = double; + boost::ecuyer1988 base_rng__ = + stan::services::util::create_rng(random_seed__, 0); + // suppress unused var warning + (void) base_rng__; + static constexpr const char* function__ = + "model_constant_multi_ind_namespace::model_constant_multi_ind"; + // suppress unused var warning + (void) function__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + int pos__ = std::numeric_limits::min(); pos__ = 1; current_statement__ = 40; - context__.validate_dims("data initialization","n_obs","int", - context__.to_vec()); + context__.validate_dims("data initialization", "n_obs", "int", + std::vector{}); n_obs = std::numeric_limits::min(); - current_statement__ = 40; n_obs = context__.vals_i("n_obs")[(1 - 1)]; current_statement__ = 41; - context__.validate_dims("data initialization","n_ind","int", - context__.to_vec()); + context__.validate_dims("data initialization", "n_ind", "int", + std::vector{}); n_ind = std::numeric_limits::min(); - current_statement__ = 41; n_ind = context__.vals_i("n_ind")[(1 - 1)]; current_statement__ = 42; - validate_non_negative_index("y_obs", "n_obs", n_obs); + stan::math::validate_non_negative_index("y_obs", "n_obs", n_obs); current_statement__ = 43; - context__.validate_dims("data initialization","y_obs","double", - context__.to_vec(n_obs)); - y_obs = std::vector(n_obs, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "y_obs", "double", + std::vector{static_cast(n_obs)}); + y_obs = std::vector(n_obs, + std::numeric_limits::quiet_NaN()); current_statement__ = 43; - assign(y_obs, nil_index_list(), context__.vals_r("y_obs"), - "assigning variable y_obs"); + y_obs = context__.vals_r("y_obs"); current_statement__ = 44; - validate_non_negative_index("obs_index", "n_obs", n_obs); + stan::math::validate_non_negative_index("obs_index", "n_obs", n_obs); current_statement__ = 45; - context__.validate_dims("data initialization","obs_index","int", - context__.to_vec(n_obs)); + context__.validate_dims("data initialization", "obs_index", "int", + std::vector{static_cast(n_obs)}); obs_index = std::vector(n_obs, std::numeric_limits::min()); - current_statement__ = 45; - assign(obs_index, nil_index_list(), context__.vals_i("obs_index"), - "assigning variable obs_index"); + obs_index = context__.vals_i("obs_index"); current_statement__ = 46; - validate_non_negative_index("time", "n_obs", n_obs); + stan::math::validate_non_negative_index("time", "n_obs", n_obs); current_statement__ = 47; - context__.validate_dims("data initialization","time","double", - context__.to_vec(n_obs)); - time = std::vector(n_obs, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "time", "double", + std::vector{static_cast(n_obs)}); + time = std::vector(n_obs, + std::numeric_limits::quiet_NaN()); current_statement__ = 47; - assign(time, nil_index_list(), context__.vals_r("time"), - "assigning variable time"); + time = context__.vals_r("time"); current_statement__ = 48; - validate_non_negative_index("ind_id", "n_obs", n_obs); + stan::math::validate_non_negative_index("ind_id", "n_obs", n_obs); current_statement__ = 49; - context__.validate_dims("data initialization","ind_id","int", - context__.to_vec(n_obs)); + context__.validate_dims("data initialization", "ind_id", "int", + std::vector{static_cast(n_obs)}); ind_id = std::vector(n_obs, std::numeric_limits::min()); - current_statement__ = 49; - assign(ind_id, nil_index_list(), context__.vals_i("ind_id"), - "assigning variable ind_id"); + ind_id = context__.vals_i("ind_id"); current_statement__ = 50; - validate_non_negative_index("y_0_obs", "n_ind", n_ind); + stan::math::validate_non_negative_index("y_0_obs", "n_ind", n_ind); current_statement__ = 51; - context__.validate_dims("data initialization","y_0_obs","double", - context__.to_vec(n_ind)); - y_0_obs = std::vector(n_ind, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "y_0_obs", "double", + std::vector{static_cast(n_ind)}); + y_0_obs = std::vector(n_ind, + std::numeric_limits::quiet_NaN()); current_statement__ = 51; - assign(y_0_obs, nil_index_list(), context__.vals_r("y_0_obs"), - "assigning variable y_0_obs"); + y_0_obs = context__.vals_r("y_0_obs"); current_statement__ = 52; - validate_non_negative_index("ind_y_0", "n_ind", n_ind); + stan::math::validate_non_negative_index("ind_y_0", "n_ind", n_ind); current_statement__ = 53; - validate_non_negative_index("ind_beta", "n_ind", n_ind); + stan::math::validate_non_negative_index("ind_beta", "n_ind", n_ind); current_statement__ = 54; - validate_non_negative_index("y_hat", "n_obs", n_obs); + stan::math::validate_non_negative_index("y_hat", "n_obs", n_obs); current_statement__ = 55; - validate_non_negative_index("Delta_hat", "n_obs", n_obs); - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); - } - num_params_r__ = 0U; - - try { - num_params_r__ += n_ind; - num_params_r__ += n_ind; - num_params_r__ += 1; - num_params_r__ += 1; - num_params_r__ += 1; + stan::math::validate_non_negative_index("Delta_hat", "n_obs", n_obs); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } + num_params_r__ = n_ind + n_ind + 1 + 1 + 1; + } + inline std::string model_name() const final { + return "model_constant_multi_ind"; } - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline stan::scalar_type_t log_prob_impl(VecR& params_r__, - VecI& params_i__, - std::ostream* pstream__ = nullptr) const { + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = stanc3 v2.32.2", + "stancflags = --allow-undefined"}; + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline stan::scalar_type_t + log_prob_impl(VecR& params_r__, VecI& params_i__, std::ostream* + pstream__ = nullptr) const { using T__ = stan::scalar_type_t; using local_scalar_t__ = T__; T__ lp__(0.0); stan::math::accumulator lp_accum__; - static const char* function__ = "model_constant_multi_ind_namespace::log_prob"; -(void) function__; // suppress unused var warning - stan::io::reader in__(params_r__, params_i__); + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "model_constant_multi_ind_namespace::log_prob"; + // suppress unused var warning + (void) function__; try { - std::vector ind_y_0; - ind_y_0 = std::vector(n_ind, DUMMY_VAR__); - - current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - current_statement__ = 1; - assign(ind_y_0, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable ind_y_0");} + std::vector ind_y_0 = + std::vector(n_ind, DUMMY_VAR__); current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - current_statement__ = 1; - if (jacobian__) { - current_statement__ = 1; - assign(ind_y_0, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(ind_y_0[(sym1__ - 1)], 0, lp__), - "assigning variable ind_y_0"); - } else { - current_statement__ = 1; - assign(ind_y_0, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(ind_y_0[(sym1__ - 1)], 0), - "assigning variable ind_y_0"); - }} - std::vector ind_beta; - ind_beta = std::vector(n_ind, DUMMY_VAR__); - + ind_y_0 = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, n_ind); + std::vector ind_beta = + std::vector(n_ind, DUMMY_VAR__); current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - current_statement__ = 2; - assign(ind_beta, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable ind_beta");} - current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - current_statement__ = 2; - if (jacobian__) { - current_statement__ = 2; - assign(ind_beta, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(ind_beta[(sym1__ - 1)], 0, lp__), - "assigning variable ind_beta"); - } else { - current_statement__ = 2; - assign(ind_beta, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(ind_beta[(sym1__ - 1)], 0), - "assigning variable ind_beta"); - }} - local_scalar_t__ species_beta_mu; - species_beta_mu = DUMMY_VAR__; - + ind_beta = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, n_ind); + local_scalar_t__ species_beta_mu = DUMMY_VAR__; current_statement__ = 3; - species_beta_mu = in__.scalar(); - local_scalar_t__ species_beta_sigma; - species_beta_sigma = DUMMY_VAR__; - - current_statement__ = 4; - species_beta_sigma = in__.scalar(); + species_beta_mu = in__.template read(); + local_scalar_t__ species_beta_sigma = DUMMY_VAR__; current_statement__ = 4; - if (jacobian__) { - current_statement__ = 4; - species_beta_sigma = stan::math::lb_constrain(species_beta_sigma, 0, - lp__); - } else { - current_statement__ = 4; - species_beta_sigma = stan::math::lb_constrain(species_beta_sigma, 0); - } - local_scalar_t__ global_error_sigma; - global_error_sigma = DUMMY_VAR__; - + species_beta_sigma = in__.template read_constrain_lb(0, lp__); + local_scalar_t__ global_error_sigma = DUMMY_VAR__; current_statement__ = 5; - global_error_sigma = in__.scalar(); - current_statement__ = 5; - if (jacobian__) { - current_statement__ = 5; - global_error_sigma = stan::math::lb_constrain(global_error_sigma, 0, - lp__); - } else { - current_statement__ = 5; - global_error_sigma = stan::math::lb_constrain(global_error_sigma, 0); - } + global_error_sigma = in__.template read_constrain_lb(0, lp__); { current_statement__ = 19; - validate_non_negative_index("y_hat", "n_obs", n_obs); - std::vector y_hat; - y_hat = std::vector(n_obs, DUMMY_VAR__); - + stan::math::validate_non_negative_index("y_hat", "n_obs", n_obs); + std::vector y_hat = + std::vector(n_obs, DUMMY_VAR__); current_statement__ = 21; - validate_non_negative_index("Delta_hat", "n_obs", n_obs); - std::vector Delta_hat; - Delta_hat = std::vector(n_obs, DUMMY_VAR__); - + stan::math::validate_non_negative_index("Delta_hat", "n_obs", n_obs); + std::vector Delta_hat = + std::vector(n_obs, DUMMY_VAR__); current_statement__ = 33; for (int i = 1; i <= n_obs; ++i) { current_statement__ = 25; - if (logical_eq(obs_index[(i - 1)], 1)) { + if (stan::math::logical_eq( + stan::model::rvalue(obs_index, "obs_index", + stan::model::index_uni(i)), 1)) { current_statement__ = 23; - assign(y_hat, cons_list(index_uni(i), nil_index_list()), - ind_y_0[(ind_id[(i - 1)] - 1)], "assigning variable y_hat"); - } + stan::model::assign(y_hat, + stan::model::rvalue(ind_y_0, "ind_y_0", + stan::model::index_uni( + stan::model::rvalue(ind_id, "ind_id", + stan::model::index_uni(i)))), "assigning variable y_hat", + stan::model::index_uni(i)); + } current_statement__ = 26; - assign(Delta_hat, cons_list(index_uni(i), nil_index_list()), - growth(ind_beta[(ind_id[(i - 1)] - 1)], pstream__), - "assigning variable Delta_hat"); + stan::model::assign(Delta_hat, + growth( + stan::model::rvalue(ind_beta, "ind_beta", + stan::model::index_uni( + stan::model::rvalue(ind_id, "ind_id", + stan::model::index_uni(i)))), pstream__), + "assigning variable Delta_hat", stan::model::index_uni(i)); current_statement__ = 31; - if (logical_lt(i, n_obs)) { + if (stan::math::logical_lt(i, n_obs)) { current_statement__ = 29; - if (logical_eq(ind_id[((i + 1) - 1)], ind_id[(i - 1)])) { + if (stan::math::logical_eq( + stan::model::rvalue(ind_id, "ind_id", + stan::model::index_uni((i + 1))), + stan::model::rvalue(ind_id, "ind_id", + stan::model::index_uni(i)))) { current_statement__ = 27; - assign(y_hat, cons_list(index_uni((i + 1)), nil_index_list()), - (y_hat[(i - 1)] + - (Delta_hat[(i - 1)] * - (time[((i + 1) - 1)] - time[(i - 1)]))), - "assigning variable y_hat"); - } - } } + stan::model::assign(y_hat, + (stan::model::rvalue(y_hat, "y_hat", + stan::model::index_uni(i)) + + (stan::model::rvalue(Delta_hat, "Delta_hat", + stan::model::index_uni(i)) * + (stan::model::rvalue(time, "time", + stan::model::index_uni((i + 1))) - + stan::model::rvalue(time, "time", stan::model::index_uni(i))))), + "assigning variable y_hat", stan::model::index_uni((i + 1))); + } + } + } current_statement__ = 34; - lp_accum__.add( - normal_lpdf(y_obs, y_hat, global_error_sigma)); + lp_accum__.add(stan::math::normal_lpdf(y_obs, y_hat, + global_error_sigma)); current_statement__ = 35; - lp_accum__.add( - normal_lpdf(ind_y_0, y_0_obs, global_error_sigma)); + lp_accum__.add(stan::math::normal_lpdf(ind_y_0, y_0_obs, + global_error_sigma)); current_statement__ = 36; - lp_accum__.add( - lognormal_lpdf(ind_beta, species_beta_mu, - species_beta_sigma)); + lp_accum__.add(stan::math::lognormal_lpdf(ind_beta, + species_beta_mu, species_beta_sigma)); current_statement__ = 37; - lp_accum__.add(normal_lpdf(species_beta_mu, 0.1, 1)); + lp_accum__.add(stan::math::normal_lpdf(species_beta_mu, + 0.1, 1)); current_statement__ = 38; - lp_accum__.add(cauchy_lpdf(species_beta_sigma, 0.1, 1)); + lp_accum__.add(stan::math::cauchy_lpdf(species_beta_sigma, + 0.1, 1)); current_statement__ = 39; - lp_accum__.add(cauchy_lpdf(global_error_sigma, 0.1, 1)); + lp_accum__.add(stan::math::cauchy_lpdf(global_error_sigma, + 0.1, 1)); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } lp_accum__.add(lp__); return lp_accum__.sum(); - } // log_prob_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_std_vector_vt* = nullptr> - inline void write_array_impl(RNG& base_rng__, VecR& params_r__, - VecI& params_i__, VecVar& vars__, - const bool emit_transformed_parameters__ = true, - const bool emit_generated_quantities__ = true, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_vector_vt* = nullptr> + inline void + write_array_impl(RNG& base_rng__, VecR& params_r__, VecI& params_i__, + VecVar& vars__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true, std::ostream* + pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.resize(0); - stan::io::reader in__(params_r__, params_i__); - static const char* function__ = "model_constant_multi_ind_namespace::write_array"; -(void) function__; // suppress unused var warning - (void) function__; // suppress unused var warning + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; double lp__ = 0.0; - (void) lp__; // dummy to suppress unused var warning + // suppress unused var warning + (void) lp__; + int current_statement__ = 0; stan::math::accumulator lp_accum__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "model_constant_multi_ind_namespace::write_array"; + // suppress unused var warning + (void) function__; try { - std::vector ind_y_0; - ind_y_0 = std::vector(n_ind, std::numeric_limits::quiet_NaN()); - + std::vector ind_y_0 = + std::vector(n_ind, std::numeric_limits::quiet_NaN()); current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - current_statement__ = 1; - assign(ind_y_0, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable ind_y_0");} - current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - current_statement__ = 1; - assign(ind_y_0, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(ind_y_0[(sym1__ - 1)], 0), - "assigning variable ind_y_0");} - std::vector ind_beta; - ind_beta = std::vector(n_ind, std::numeric_limits::quiet_NaN()); - - current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - current_statement__ = 2; - assign(ind_beta, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable ind_beta");} + ind_y_0 = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, n_ind); + std::vector ind_beta = + std::vector(n_ind, std::numeric_limits::quiet_NaN()); current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - current_statement__ = 2; - assign(ind_beta, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(ind_beta[(sym1__ - 1)], 0), - "assigning variable ind_beta");} - double species_beta_mu; - species_beta_mu = std::numeric_limits::quiet_NaN(); - + ind_beta = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, n_ind); + double species_beta_mu = std::numeric_limits::quiet_NaN(); current_statement__ = 3; - species_beta_mu = in__.scalar(); - double species_beta_sigma; - species_beta_sigma = std::numeric_limits::quiet_NaN(); - - current_statement__ = 4; - species_beta_sigma = in__.scalar(); + species_beta_mu = in__.template read(); + double species_beta_sigma = std::numeric_limits::quiet_NaN(); current_statement__ = 4; - species_beta_sigma = stan::math::lb_constrain(species_beta_sigma, 0); - double global_error_sigma; - global_error_sigma = std::numeric_limits::quiet_NaN(); - + species_beta_sigma = in__.template read_constrain_lb(0, lp__); + double global_error_sigma = std::numeric_limits::quiet_NaN(); current_statement__ = 5; - global_error_sigma = in__.scalar(); - current_statement__ = 5; - global_error_sigma = stan::math::lb_constrain(global_error_sigma, 0); - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - vars__.emplace_back(ind_y_0[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - vars__.emplace_back(ind_beta[(sym1__ - 1)]);} - vars__.emplace_back(species_beta_mu); - vars__.emplace_back(species_beta_sigma); - vars__.emplace_back(global_error_sigma); - if (logical_negation((primitive_value(emit_transformed_parameters__) || - primitive_value(emit_generated_quantities__)))) { + global_error_sigma = in__.template read_constrain_lb(0, lp__); + out__.write(ind_y_0); + out__.write(ind_beta); + out__.write(species_beta_mu); + out__.write(species_beta_sigma); + out__.write(global_error_sigma); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { return ; - } - if (logical_negation(emit_generated_quantities__)) { + } + if (stan::math::logical_negation(emit_generated_quantities__)) { return ; - } - std::vector y_hat; - y_hat = std::vector(n_obs, std::numeric_limits::quiet_NaN()); - - std::vector Delta_hat; - Delta_hat = std::vector(n_obs, std::numeric_limits::quiet_NaN()); - + } + std::vector y_hat = + std::vector(n_obs, std::numeric_limits::quiet_NaN()); + std::vector Delta_hat = + std::vector(n_obs, std::numeric_limits::quiet_NaN()); current_statement__ = 18; for (int i = 1; i <= n_obs; ++i) { current_statement__ = 10; - if (logical_eq(obs_index[(i - 1)], 1)) { + if (stan::math::logical_eq( + stan::model::rvalue(obs_index, "obs_index", + stan::model::index_uni(i)), 1)) { current_statement__ = 8; - assign(y_hat, cons_list(index_uni(i), nil_index_list()), - ind_y_0[(ind_id[(i - 1)] - 1)], "assigning variable y_hat"); - } + stan::model::assign(y_hat, + stan::model::rvalue(ind_y_0, "ind_y_0", + stan::model::index_uni( + stan::model::rvalue(ind_id, "ind_id", + stan::model::index_uni(i)))), "assigning variable y_hat", + stan::model::index_uni(i)); + } current_statement__ = 11; - assign(Delta_hat, cons_list(index_uni(i), nil_index_list()), - growth(ind_beta[(ind_id[(i - 1)] - 1)], pstream__), - "assigning variable Delta_hat"); + stan::model::assign(Delta_hat, + growth( + stan::model::rvalue(ind_beta, "ind_beta", + stan::model::index_uni( + stan::model::rvalue(ind_id, "ind_id", + stan::model::index_uni(i)))), pstream__), + "assigning variable Delta_hat", stan::model::index_uni(i)); current_statement__ = 16; - if (logical_lt(i, n_obs)) { + if (stan::math::logical_lt(i, n_obs)) { current_statement__ = 14; - if (logical_eq(ind_id[((i + 1) - 1)], ind_id[(i - 1)])) { + if (stan::math::logical_eq( + stan::model::rvalue(ind_id, "ind_id", + stan::model::index_uni((i + 1))), + stan::model::rvalue(ind_id, "ind_id", + stan::model::index_uni(i)))) { current_statement__ = 12; - assign(y_hat, cons_list(index_uni((i + 1)), nil_index_list()), - (y_hat[(i - 1)] + - (Delta_hat[(i - 1)] * (time[((i + 1) - 1)] - time[(i - 1)]))), - "assigning variable y_hat"); - } - } } - for (int sym1__ = 1; sym1__ <= n_obs; ++sym1__) { - vars__.emplace_back(y_hat[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= n_obs; ++sym1__) { - vars__.emplace_back(Delta_hat[(sym1__ - 1)]);} + stan::model::assign(y_hat, + (stan::model::rvalue(y_hat, "y_hat", stan::model::index_uni(i)) + + + (stan::model::rvalue(Delta_hat, "Delta_hat", + stan::model::index_uni(i)) * + (stan::model::rvalue(time, "time", + stan::model::index_uni((i + 1))) - + stan::model::rvalue(time, "time", stan::model::index_uni(i))))), + "assigning variable y_hat", stan::model::index_uni((i + 1))); + } + } + } + out__.write(y_hat); + out__.write(Delta_hat); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } // write_array_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline void transform_inits_impl(const stan::io::var_context& context__, - VecI& params_i__, VecVar& vars__, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + unconstrain_array_impl(const VecVar& params_r__, const VecI& params_i__, + VecVar& vars__, std::ostream* pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.clear(); - vars__.reserve(num_params_r__); - + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + int pos__ = std::numeric_limits::min(); pos__ = 1; - std::vector ind_y_0; - ind_y_0 = std::vector(n_ind, std::numeric_limits::quiet_NaN()); - + std::vector ind_y_0 = + std::vector(n_ind, DUMMY_VAR__); current_statement__ = 1; - assign(ind_y_0, nil_index_list(), context__.vals_r("ind_y_0"), + stan::model::assign(ind_y_0, + in__.read>(n_ind), "assigning variable ind_y_0"); - std::vector ind_y_0_free__; - ind_y_0_free__ = std::vector(n_ind, std::numeric_limits::quiet_NaN()); - - current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - current_statement__ = 1; - assign(ind_y_0_free__, - cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_free(ind_y_0[(sym1__ - 1)], 0), - "assigning variable ind_y_0_free__");} - std::vector ind_beta; - ind_beta = std::vector(n_ind, std::numeric_limits::quiet_NaN()); - + out__.write_free_lb(0, ind_y_0); + std::vector ind_beta = + std::vector(n_ind, DUMMY_VAR__); current_statement__ = 2; - assign(ind_beta, nil_index_list(), context__.vals_r("ind_beta"), + stan::model::assign(ind_beta, + in__.read>(n_ind), "assigning variable ind_beta"); - std::vector ind_beta_free__; - ind_beta_free__ = std::vector(n_ind, std::numeric_limits::quiet_NaN()); - + out__.write_free_lb(0, ind_beta); + local_scalar_t__ species_beta_mu = DUMMY_VAR__; + current_statement__ = 3; + species_beta_mu = in__.read(); + out__.write(species_beta_mu); + local_scalar_t__ species_beta_sigma = DUMMY_VAR__; + current_statement__ = 4; + species_beta_sigma = in__.read(); + out__.write_free_lb(0, species_beta_sigma); + local_scalar_t__ global_error_sigma = DUMMY_VAR__; + current_statement__ = 5; + global_error_sigma = in__.read(); + out__.write_free_lb(0, global_error_sigma); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr> + inline void + transform_inits_impl(const stan::io::var_context& context__, VecVar& + vars__, std::ostream* pstream__ = nullptr) const { + using local_scalar_t__ = double; + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 1; + context__.validate_dims("parameter initialization", "ind_y_0", + "double", std::vector{static_cast(n_ind)}); current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - current_statement__ = 2; - assign(ind_beta_free__, - cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_free(ind_beta[(sym1__ - 1)], 0), - "assigning variable ind_beta_free__");} - double species_beta_mu; - species_beta_mu = std::numeric_limits::quiet_NaN(); - + context__.validate_dims("parameter initialization", "ind_beta", + "double", std::vector{static_cast(n_ind)}); + current_statement__ = 3; + context__.validate_dims("parameter initialization", "species_beta_mu", + "double", std::vector{}); + current_statement__ = 4; + context__.validate_dims("parameter initialization", + "species_beta_sigma", "double", std::vector{}); + current_statement__ = 5; + context__.validate_dims("parameter initialization", + "global_error_sigma", "double", std::vector{}); + int pos__ = std::numeric_limits::min(); + pos__ = 1; + std::vector ind_y_0 = + std::vector(n_ind, DUMMY_VAR__); + current_statement__ = 1; + ind_y_0 = context__.vals_r("ind_y_0"); + out__.write_free_lb(0, ind_y_0); + std::vector ind_beta = + std::vector(n_ind, DUMMY_VAR__); + current_statement__ = 2; + ind_beta = context__.vals_r("ind_beta"); + out__.write_free_lb(0, ind_beta); + local_scalar_t__ species_beta_mu = DUMMY_VAR__; current_statement__ = 3; species_beta_mu = context__.vals_r("species_beta_mu")[(1 - 1)]; - double species_beta_sigma; - species_beta_sigma = std::numeric_limits::quiet_NaN(); - + out__.write(species_beta_mu); + local_scalar_t__ species_beta_sigma = DUMMY_VAR__; current_statement__ = 4; species_beta_sigma = context__.vals_r("species_beta_sigma")[(1 - 1)]; - double species_beta_sigma_free__; - species_beta_sigma_free__ = std::numeric_limits::quiet_NaN(); - - current_statement__ = 4; - species_beta_sigma_free__ = stan::math::lb_free(species_beta_sigma, 0); - double global_error_sigma; - global_error_sigma = std::numeric_limits::quiet_NaN(); - + out__.write_free_lb(0, species_beta_sigma); + local_scalar_t__ global_error_sigma = DUMMY_VAR__; current_statement__ = 5; global_error_sigma = context__.vals_r("global_error_sigma")[(1 - 1)]; - double global_error_sigma_free__; - global_error_sigma_free__ = std::numeric_limits::quiet_NaN(); - - current_statement__ = 5; - global_error_sigma_free__ = stan::math::lb_free(global_error_sigma, 0); - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - vars__.emplace_back(ind_y_0_free__[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - vars__.emplace_back(ind_beta_free__[(sym1__ - 1)]);} - vars__.emplace_back(species_beta_mu); - vars__.emplace_back(species_beta_sigma_free__); - vars__.emplace_back(global_error_sigma_free__); + out__.write_free_lb(0, global_error_sigma); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } // transform_inits_impl() - - inline void get_param_names(std::vector& names__) const { - - names__.clear(); - names__.emplace_back("ind_y_0"); - names__.emplace_back("ind_beta"); - names__.emplace_back("species_beta_mu"); - names__.emplace_back("species_beta_sigma"); - names__.emplace_back("global_error_sigma"); - names__.emplace_back("y_hat"); - names__.emplace_back("Delta_hat"); - } // get_param_names() - - inline void get_dims(std::vector>& dimss__) const { - dimss__.clear(); - dimss__.emplace_back(std::vector{static_cast(n_ind)}); - - dimss__.emplace_back(std::vector{static_cast(n_ind)}); - - dimss__.emplace_back(std::vector{}); - - dimss__.emplace_back(std::vector{}); - - dimss__.emplace_back(std::vector{}); - - dimss__.emplace_back(std::vector{static_cast(n_obs)}); - - dimss__.emplace_back(std::vector{static_cast(n_obs)}); - - } // get_dims() - - inline void constrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + } + inline void + get_param_names(std::vector& names__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + names__ = std::vector{"ind_y_0", "ind_beta", + "species_beta_mu", "species_beta_sigma", + "global_error_sigma"}; + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) { + std::vector temp{"y_hat", "Delta_hat"}; + names__.reserve(names__.size() + temp.size()); + names__.insert(names__.end(), temp.begin(), temp.end()); + } + } + inline void + get_dims(std::vector>& dimss__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + dimss__ = std::vector>{std::vector{static_cast< + size_t>( + n_ind)}, + std::vector{static_cast(n_ind)}, + std::vector{}, std::vector{}, + std::vector{}}; + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) { + std::vector> + temp{std::vector{static_cast(n_obs)}, + std::vector{static_cast(n_obs)}}; + dimss__.reserve(dimss__.size() + temp.size()); + dimss__.insert(dimss__.end(), temp.begin(), temp.end()); + } + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - { - param_names__.emplace_back(std::string() + "ind_y_0" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "ind_y_0" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - { - param_names__.emplace_back(std::string() + "ind_beta" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "ind_beta" + '.' + + std::to_string(sym1__)); + } param_names__.emplace_back(std::string() + "species_beta_mu"); param_names__.emplace_back(std::string() + "species_beta_sigma"); param_names__.emplace_back(std::string() + "global_error_sigma"); - if (emit_transformed_parameters__) { - - } - + if (emit_transformed_parameters__) {} if (emit_generated_quantities__) { for (int sym1__ = 1; sym1__ <= n_obs; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_hat" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_hat" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n_obs; ++sym1__) { - { - param_names__.emplace_back(std::string() + "Delta_hat" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "Delta_hat" + '.' + + std::to_string(sym1__)); + } } - - } // constrained_param_names() - - inline void unconstrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + } + inline void + unconstrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - { - param_names__.emplace_back(std::string() + "ind_y_0" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "ind_y_0" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n_ind; ++sym1__) { - { - param_names__.emplace_back(std::string() + "ind_beta" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "ind_beta" + '.' + + std::to_string(sym1__)); + } param_names__.emplace_back(std::string() + "species_beta_mu"); param_names__.emplace_back(std::string() + "species_beta_sigma"); param_names__.emplace_back(std::string() + "global_error_sigma"); - if (emit_transformed_parameters__) { - - } - + if (emit_transformed_parameters__) {} if (emit_generated_quantities__) { for (int sym1__ = 1; sym1__ <= n_obs; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_hat" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_hat" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n_obs; ++sym1__) { - { - param_names__.emplace_back(std::string() + "Delta_hat" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "Delta_hat" + '.' + + std::to_string(sym1__)); + } } - - } // unconstrained_param_names() - + } inline std::string get_constrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"ind_y_0\",\"type\":{\"name\":\"array\",\"length\":" << n_ind << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"ind_beta\",\"type\":{\"name\":\"array\",\"length\":" << n_ind << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"species_beta_mu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"species_beta_sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"global_error_sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"array\",\"length\":" << n_obs << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"},{\"name\":\"Delta_hat\",\"type\":{\"name\":\"array\",\"length\":" << n_obs << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"}]"; - return s__.str(); - } // get_constrained_sizedtypes() - + return std::string("[{\"name\":\"ind_y_0\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_ind) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"ind_beta\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_ind) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"species_beta_mu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"species_beta_sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"global_error_sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_obs) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"},{\"name\":\"Delta_hat\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_obs) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"}]"); + } inline std::string get_unconstrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"ind_y_0\",\"type\":{\"name\":\"array\",\"length\":" << n_ind << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"ind_beta\",\"type\":{\"name\":\"array\",\"length\":" << n_ind << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"species_beta_mu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"species_beta_sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"global_error_sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"array\",\"length\":" << n_obs << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"},{\"name\":\"Delta_hat\",\"type\":{\"name\":\"array\",\"length\":" << n_obs << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"}]"; - return s__.str(); - } // get_unconstrained_sizedtypes() - - - // Begin method overload boilerplate - template - inline void write_array(RNG& base_rng, - Eigen::Matrix& params_r, - Eigen::Matrix& vars, - const bool emit_transformed_parameters = true, - const bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - std::vector vars_vec(vars.size()); - std::vector params_i; - write_array_impl(base_rng, params_r, params_i, vars_vec, - emit_transformed_parameters, emit_generated_quantities, pstream); - vars.resize(vars_vec.size()); - for (int i = 0; i < vars.size(); ++i) { - vars.coeffRef(i) = vars_vec[i]; - } - } - template - inline void write_array(RNG& base_rng, std::vector& params_r, - std::vector& params_i, - std::vector& vars, - bool emit_transformed_parameters = true, - bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - write_array_impl(base_rng, params_r, params_i, vars, emit_transformed_parameters, emit_generated_quantities, pstream); - } - template - inline T_ log_prob(Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const { - Eigen::Matrix params_i; - return log_prob_impl(params_r, params_i, pstream); - } - template - inline T__ log_prob(std::vector& params_r, - std::vector& params_i, - std::ostream* pstream = nullptr) const { - return log_prob_impl(params_r, params_i, pstream); - } - - inline void transform_inits(const stan::io::var_context& context, - Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const final { - std::vector params_r_vec(params_r.size()); - std::vector params_i; - transform_inits_impl(context, params_i, params_r_vec, pstream); - params_r.resize(params_r_vec.size()); - for (int i = 0; i < params_r.size(); ++i) { - params_r.coeffRef(i) = params_r_vec[i]; - } - } - inline void transform_inits(const stan::io::var_context& context, - std::vector& params_i, - std::vector& vars, - std::ostream* pstream = nullptr) const final { - transform_inits_impl(context, params_i, vars, pstream); - } + return std::string("[{\"name\":\"ind_y_0\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_ind) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"ind_beta\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_ind) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"species_beta_mu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"species_beta_sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"global_error_sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_obs) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"},{\"name\":\"Delta_hat\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_obs) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"}]"); + } + // Begin method overload boilerplate + template inline void + write_array(RNG& base_rng, Eigen::Matrix& params_r, + Eigen::Matrix& vars, const bool + emit_transformed_parameters = true, const bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = ((((n_ind + n_ind) + 1) + 1) + 1); + const size_t num_transformed = emit_transformed_parameters * (0); + const size_t num_gen_quantities = emit_generated_quantities * ((n_obs + + n_obs)); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + std::vector params_i; + vars = Eigen::Matrix::Constant(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline void + write_array(RNG& base_rng, std::vector& params_r, std::vector& + params_i, std::vector& vars, bool + emit_transformed_parameters = true, bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = ((((n_ind + n_ind) + 1) + 1) + 1); + const size_t num_transformed = emit_transformed_parameters * (0); + const size_t num_gen_quantities = emit_generated_quantities * ((n_obs + + n_obs)); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + vars = std::vector(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline T_ + log_prob(Eigen::Matrix& params_r, std::ostream* pstream = nullptr) const { + Eigen::Matrix params_i; + return log_prob_impl(params_r, params_i, pstream); + } + template inline T_ + log_prob(std::vector& params_r, std::vector& params_i, + std::ostream* pstream = nullptr) const { + return log_prob_impl(params_r, params_i, pstream); + } + inline void + transform_inits(const stan::io::var_context& context, + Eigen::Matrix& params_r, std::ostream* + pstream = nullptr) const final { + std::vector params_r_vec(params_r.size()); + std::vector params_i; + transform_inits(context, params_i, params_r_vec, pstream); + params_r = Eigen::Map>(params_r_vec.data(), + params_r_vec.size()); + } + inline void + transform_inits(const stan::io::var_context& context, std::vector& + params_i, std::vector& vars, std::ostream* + pstream__ = nullptr) const { + vars.resize(num_params_r__); + transform_inits_impl(context, vars, pstream__); + } + inline void + unconstrain_array(const std::vector& params_constrained, + std::vector& params_unconstrained, std::ostream* + pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = std::vector(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } + inline void + unconstrain_array(const Eigen::Matrix& params_constrained, + Eigen::Matrix& params_unconstrained, + std::ostream* pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = Eigen::Matrix::Constant(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } }; } using stan_model = model_constant_multi_ind_namespace::model_constant_multi_ind; #ifndef USING_R // Boilerplate -stan::model::model_base& new_model( - stan::io::var_context& data_context, - unsigned int seed, - std::ostream* msg_stream) { +stan::model::model_base& +new_model(stan::io::var_context& data_context, unsigned int seed, + std::ostream* msg_stream) { stan_model* m = new stan_model(data_context, seed, msg_stream); return *m; } diff --git a/src/stanExports_constant_single_ind.h b/src/stanExports_constant_single_ind.h index a88757d..c97f444 100644 --- a/src/stanExports_constant_single_ind.h +++ b/src/stanExports_constant_single_ind.h @@ -21,132 +21,82 @@ #define USE_STANC3 #endif #include -// Code generated by stanc v2.26.1-4-gd72b68b7-dirty +// Code generated by stanc v2.32.2 #include namespace model_constant_single_ind_namespace { -inline void validate_positive_index(const char* var_name, const char* expr, - int val) { - if (val < 1) { - std::stringstream msg; - msg << "Found dimension size less than one in simplex declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -inline void validate_unit_vector_index(const char* var_name, const char* expr, - int val) { - if (val <= 1) { - std::stringstream msg; - if (val == 1) { - msg << "Found dimension size one in unit vector declaration." - << " One-dimensional unit vector is discrete" - << " but the target distribution must be continuous." - << " variable=" << var_name << "; dimension size expression=" << expr; - } else { - msg << "Found dimension size less than one in unit vector declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - } - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -using std::istream; -using std::string; -using std::stringstream; -using std::vector; -using std::pow; -using stan::io::dump; -using stan::math::lgamma; using stan::model::model_base_crtp; -using stan::model::rvalue; -using stan::model::cons_list; -using stan::model::index_uni; -using stan::model::index_max; -using stan::model::index_min; -using stan::model::index_min_max; -using stan::model::index_multi; -using stan::model::index_omni; -using stan::model::nil_index_list; using namespace stan::math; -using stan::math::pow; stan::math::profile_map profiles__; -static int current_statement__= 0; -static const std::vector locations_array__ = {" (found before start of program)", - " (in 'constant_single_ind', line 19, column 2 to column 24)", - " (in 'constant_single_ind', line 20, column 2 to column 25)", - " (in 'constant_single_ind', line 22, column 2 to column 35)", - " (in 'constant_single_ind', line 48, column 2 to column 20)", - " (in 'constant_single_ind', line 49, column 2 to column 24)", - " (in 'constant_single_ind', line 52, column 6 to column 25)", - " (in 'constant_single_ind', line 51, column 23 to line 53, column 5)", - " (in 'constant_single_ind', line 51, column 4 to line 53, column 5)", - " (in 'constant_single_ind', line 54, column 4 to column 46)", - " (in 'constant_single_ind', line 56, column 6 to column 63)", - " (in 'constant_single_ind', line 55, column 17 to line 57, column 5)", - " (in 'constant_single_ind', line 55, column 4 to line 57, column 5)", - " (in 'constant_single_ind', line 50, column 19 to line 58, column 3)", - " (in 'constant_single_ind', line 50, column 2 to line 58, column 3)", - " (in 'constant_single_ind', line 26, column 13 to column 18)", - " (in 'constant_single_ind', line 26, column 2 to column 20)", - " (in 'constant_single_ind', line 27, column 17 to column 22)", - " (in 'constant_single_ind', line 27, column 2 to column 24)", - " (in 'constant_single_ind', line 30, column 6 to column 25)", - " (in 'constant_single_ind', line 29, column 23 to line 31, column 5)", - " (in 'constant_single_ind', line 29, column 4 to line 31, column 5)", - " (in 'constant_single_ind', line 32, column 4 to column 46)", - " (in 'constant_single_ind', line 34, column 6 to column 63)", - " (in 'constant_single_ind', line 33, column 17 to line 35, column 5)", - " (in 'constant_single_ind', line 33, column 4 to line 35, column 5)", - " (in 'constant_single_ind', line 28, column 19 to line 36, column 3)", - " (in 'constant_single_ind', line 28, column 2 to line 36, column 3)", - " (in 'constant_single_ind', line 38, column 2 to column 44)", - " (in 'constant_single_ind', line 41, column 2 to column 48)", - " (in 'constant_single_ind', line 42, column 2 to column 31)", - " (in 'constant_single_ind', line 44, column 2 to column 37)", - " (in 'constant_single_ind', line 10, column 2 to column 12)", - " (in 'constant_single_ind', line 11, column 13 to column 18)", - " (in 'constant_single_ind', line 11, column 2 to column 20)", - " (in 'constant_single_ind', line 12, column 16 to column 21)", - " (in 'constant_single_ind', line 12, column 2 to column 23)", - " (in 'constant_single_ind', line 13, column 12 to column 17)", - " (in 'constant_single_ind', line 13, column 2 to column 19)", - " (in 'constant_single_ind', line 14, column 2 to column 15)", - " (in 'constant_single_ind', line 48, column 13 to column 18)", - " (in 'constant_single_ind', line 49, column 17 to column 22)", - " (in 'constant_single_ind', line 5, column 4 to column 16)", - " (in 'constant_single_ind', line 4, column 32 to line 6, column 3)"}; -template -stan::promote_args_t +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'constant_single_ind', line 19, column 2 to column 24)", + " (in 'constant_single_ind', line 20, column 2 to column 25)", + " (in 'constant_single_ind', line 22, column 2 to column 35)", + " (in 'constant_single_ind', line 48, column 2 to column 20)", + " (in 'constant_single_ind', line 49, column 2 to column 24)", + " (in 'constant_single_ind', line 52, column 6 to column 25)", + " (in 'constant_single_ind', line 51, column 23 to line 53, column 5)", + " (in 'constant_single_ind', line 51, column 4 to line 53, column 5)", + " (in 'constant_single_ind', line 54, column 4 to column 46)", + " (in 'constant_single_ind', line 56, column 6 to column 63)", + " (in 'constant_single_ind', line 55, column 17 to line 57, column 5)", + " (in 'constant_single_ind', line 55, column 4 to line 57, column 5)", + " (in 'constant_single_ind', line 50, column 19 to line 58, column 3)", + " (in 'constant_single_ind', line 50, column 2 to line 58, column 3)", + " (in 'constant_single_ind', line 26, column 13 to column 18)", + " (in 'constant_single_ind', line 26, column 2 to column 20)", + " (in 'constant_single_ind', line 27, column 17 to column 22)", + " (in 'constant_single_ind', line 27, column 2 to column 24)", + " (in 'constant_single_ind', line 30, column 6 to column 25)", + " (in 'constant_single_ind', line 29, column 23 to line 31, column 5)", + " (in 'constant_single_ind', line 29, column 4 to line 31, column 5)", + " (in 'constant_single_ind', line 32, column 4 to column 46)", + " (in 'constant_single_ind', line 34, column 6 to column 63)", + " (in 'constant_single_ind', line 33, column 17 to line 35, column 5)", + " (in 'constant_single_ind', line 33, column 4 to line 35, column 5)", + " (in 'constant_single_ind', line 28, column 19 to line 36, column 3)", + " (in 'constant_single_ind', line 28, column 2 to line 36, column 3)", + " (in 'constant_single_ind', line 38, column 2 to column 44)", + " (in 'constant_single_ind', line 41, column 2 to column 48)", + " (in 'constant_single_ind', line 42, column 2 to column 31)", + " (in 'constant_single_ind', line 44, column 2 to column 37)", + " (in 'constant_single_ind', line 10, column 2 to column 12)", + " (in 'constant_single_ind', line 11, column 13 to column 18)", + " (in 'constant_single_ind', line 11, column 2 to column 20)", + " (in 'constant_single_ind', line 12, column 16 to column 21)", + " (in 'constant_single_ind', line 12, column 2 to column 23)", + " (in 'constant_single_ind', line 13, column 12 to column 17)", + " (in 'constant_single_ind', line 13, column 2 to column 19)", + " (in 'constant_single_ind', line 14, column 2 to column 15)", + " (in 'constant_single_ind', line 48, column 13 to column 18)", + " (in 'constant_single_ind', line 49, column 17 to column 22)", + " (in 'constant_single_ind', line 5, column 4 to column 16)", + " (in 'constant_single_ind', line 4, column 32 to line 6, column 3)"}; +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +growth(const T0__& y, const T1__& beta, std::ostream* pstream__); +template , + stan::is_stan_scalar>*> +stan::promote_args_t growth(const T0__& y, const T1__& beta, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; - const static bool propto__ = true; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning (void) propto__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { current_statement__ = 42; return beta; } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - -} -struct growth_functor__ { -template -stan::promote_args_t -operator()(const T0__& y, const T1__& beta, std::ostream* pstream__) const -{ -return growth(y, beta, pstream__); } -}; #include class model_constant_single_ind final : public model_base_crtp { private: @@ -155,498 +105,496 @@ class model_constant_single_ind final : public model_base_crtp obs_index; std::vector time; double y_0_obs; - public: - ~model_constant_single_ind() { } - - inline std::string model_name() const final { return "model_constant_single_ind"; } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = stanc3 v2.26.1-4-gd72b68b7-dirty", "stancflags = "}; - } - - - model_constant_single_ind(stan::io::var_context& context__, - unsigned int random_seed__ = 0, - std::ostream* pstream__ = nullptr) : model_base_crtp(0) { - using local_scalar_t__ = double ; - boost::ecuyer1988 base_rng__ = - stan::services::util::create_rng(random_seed__, 0); - (void) base_rng__; // suppress unused var warning - static const char* function__ = "model_constant_single_ind_namespace::model_constant_single_ind"; - (void) function__; // suppress unused var warning + ~model_constant_single_ind() {} + model_constant_single_ind(stan::io::var_context& context__, unsigned int + random_seed__ = 0, std::ostream* + pstream__ = nullptr) : model_base_crtp(0) { + int current_statement__ = 0; + using local_scalar_t__ = double; + boost::ecuyer1988 base_rng__ = + stan::services::util::create_rng(random_seed__, 0); + // suppress unused var warning + (void) base_rng__; + static constexpr const char* function__ = + "model_constant_single_ind_namespace::model_constant_single_ind"; + // suppress unused var warning + (void) function__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + int pos__ = std::numeric_limits::min(); pos__ = 1; current_statement__ = 32; - context__.validate_dims("data initialization","n_obs","int", - context__.to_vec()); + context__.validate_dims("data initialization", "n_obs", "int", + std::vector{}); n_obs = std::numeric_limits::min(); - current_statement__ = 32; n_obs = context__.vals_i("n_obs")[(1 - 1)]; current_statement__ = 33; - validate_non_negative_index("y_obs", "n_obs", n_obs); + stan::math::validate_non_negative_index("y_obs", "n_obs", n_obs); current_statement__ = 34; - context__.validate_dims("data initialization","y_obs","double", - context__.to_vec(n_obs)); - y_obs = std::vector(n_obs, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "y_obs", "double", + std::vector{static_cast(n_obs)}); + y_obs = std::vector(n_obs, + std::numeric_limits::quiet_NaN()); current_statement__ = 34; - assign(y_obs, nil_index_list(), context__.vals_r("y_obs"), - "assigning variable y_obs"); + y_obs = context__.vals_r("y_obs"); current_statement__ = 35; - validate_non_negative_index("obs_index", "n_obs", n_obs); + stan::math::validate_non_negative_index("obs_index", "n_obs", n_obs); current_statement__ = 36; - context__.validate_dims("data initialization","obs_index","int", - context__.to_vec(n_obs)); + context__.validate_dims("data initialization", "obs_index", "int", + std::vector{static_cast(n_obs)}); obs_index = std::vector(n_obs, std::numeric_limits::min()); - current_statement__ = 36; - assign(obs_index, nil_index_list(), context__.vals_i("obs_index"), - "assigning variable obs_index"); + obs_index = context__.vals_i("obs_index"); current_statement__ = 37; - validate_non_negative_index("time", "n_obs", n_obs); + stan::math::validate_non_negative_index("time", "n_obs", n_obs); current_statement__ = 38; - context__.validate_dims("data initialization","time","double", - context__.to_vec(n_obs)); - time = std::vector(n_obs, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "time", "double", + std::vector{static_cast(n_obs)}); + time = std::vector(n_obs, + std::numeric_limits::quiet_NaN()); current_statement__ = 38; - assign(time, nil_index_list(), context__.vals_r("time"), - "assigning variable time"); + time = context__.vals_r("time"); current_statement__ = 39; - context__.validate_dims("data initialization","y_0_obs","double", - context__.to_vec()); + context__.validate_dims("data initialization", "y_0_obs", "double", + std::vector{}); y_0_obs = std::numeric_limits::quiet_NaN(); - current_statement__ = 39; y_0_obs = context__.vals_r("y_0_obs")[(1 - 1)]; current_statement__ = 40; - validate_non_negative_index("y_hat", "n_obs", n_obs); + stan::math::validate_non_negative_index("y_hat", "n_obs", n_obs); current_statement__ = 41; - validate_non_negative_index("Delta_hat", "n_obs", n_obs); + stan::math::validate_non_negative_index("Delta_hat", "n_obs", n_obs); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); - } - num_params_r__ = 0U; - - try { - num_params_r__ += 1; - num_params_r__ += 1; - num_params_r__ += 1; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } + num_params_r__ = 1 + 1 + 1; + } + inline std::string model_name() const final { + return "model_constant_single_ind"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = stanc3 v2.32.2", + "stancflags = --allow-undefined"}; } - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline stan::scalar_type_t log_prob_impl(VecR& params_r__, - VecI& params_i__, - std::ostream* pstream__ = nullptr) const { + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline stan::scalar_type_t + log_prob_impl(VecR& params_r__, VecI& params_i__, std::ostream* + pstream__ = nullptr) const { using T__ = stan::scalar_type_t; using local_scalar_t__ = T__; T__ lp__(0.0); stan::math::accumulator lp_accum__; - static const char* function__ = "model_constant_single_ind_namespace::log_prob"; -(void) function__; // suppress unused var warning - stan::io::reader in__(params_r__, params_i__); + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "model_constant_single_ind_namespace::log_prob"; + // suppress unused var warning + (void) function__; try { - local_scalar_t__ ind_y_0; - ind_y_0 = DUMMY_VAR__; - - current_statement__ = 1; - ind_y_0 = in__.scalar(); + local_scalar_t__ ind_y_0 = DUMMY_VAR__; current_statement__ = 1; - if (jacobian__) { - current_statement__ = 1; - ind_y_0 = stan::math::lb_constrain(ind_y_0, 0, lp__); - } else { - current_statement__ = 1; - ind_y_0 = stan::math::lb_constrain(ind_y_0, 0); - } - local_scalar_t__ ind_beta; - ind_beta = DUMMY_VAR__; - + ind_y_0 = in__.template read_constrain_lb(0, lp__); + local_scalar_t__ ind_beta = DUMMY_VAR__; current_statement__ = 2; - ind_beta = in__.scalar(); - current_statement__ = 2; - if (jacobian__) { - current_statement__ = 2; - ind_beta = stan::math::lb_constrain(ind_beta, 0, lp__); - } else { - current_statement__ = 2; - ind_beta = stan::math::lb_constrain(ind_beta, 0); - } - local_scalar_t__ global_error_sigma; - global_error_sigma = DUMMY_VAR__; - + ind_beta = in__.template read_constrain_lb(0, lp__); + local_scalar_t__ global_error_sigma = DUMMY_VAR__; current_statement__ = 3; - global_error_sigma = in__.scalar(); - current_statement__ = 3; - if (jacobian__) { - current_statement__ = 3; - global_error_sigma = stan::math::lb_constrain(global_error_sigma, 0, - lp__); - } else { - current_statement__ = 3; - global_error_sigma = stan::math::lb_constrain(global_error_sigma, 0); - } + global_error_sigma = in__.template read_constrain_lb(0, lp__); { current_statement__ = 15; - validate_non_negative_index("y_hat", "n_obs", n_obs); - std::vector y_hat; - y_hat = std::vector(n_obs, DUMMY_VAR__); - + stan::math::validate_non_negative_index("y_hat", "n_obs", n_obs); + std::vector y_hat = + std::vector(n_obs, DUMMY_VAR__); current_statement__ = 17; - validate_non_negative_index("Delta_hat", "n_obs", n_obs); - std::vector Delta_hat; - Delta_hat = std::vector(n_obs, DUMMY_VAR__); - + stan::math::validate_non_negative_index("Delta_hat", "n_obs", n_obs); + std::vector Delta_hat = + std::vector(n_obs, DUMMY_VAR__); current_statement__ = 27; for (int i = 1; i <= n_obs; ++i) { current_statement__ = 21; - if (logical_eq(obs_index[(i - 1)], 1)) { + if (stan::math::logical_eq( + stan::model::rvalue(obs_index, "obs_index", + stan::model::index_uni(i)), 1)) { current_statement__ = 19; - assign(y_hat, cons_list(index_uni(i), nil_index_list()), ind_y_0, - "assigning variable y_hat"); - } + stan::model::assign(y_hat, ind_y_0, "assigning variable y_hat", + stan::model::index_uni(i)); + } current_statement__ = 22; - assign(Delta_hat, cons_list(index_uni(i), nil_index_list()), - growth(y_hat[(i - 1)], ind_beta, pstream__), - "assigning variable Delta_hat"); + stan::model::assign(Delta_hat, + growth( + stan::model::rvalue(y_hat, "y_hat", stan::model::index_uni(i)), + ind_beta, pstream__), "assigning variable Delta_hat", + stan::model::index_uni(i)); current_statement__ = 25; - if (logical_lt(i, n_obs)) { + if (stan::math::logical_lt(i, n_obs)) { current_statement__ = 23; - assign(y_hat, cons_list(index_uni((i + 1)), nil_index_list()), - (y_hat[(i - 1)] + - (Delta_hat[(i - 1)] * (time[((i + 1) - 1)] - time[(i - 1)]))), - "assigning variable y_hat"); - } } + stan::model::assign(y_hat, + (stan::model::rvalue(y_hat, "y_hat", stan::model::index_uni(i)) + + + (stan::model::rvalue(Delta_hat, "Delta_hat", + stan::model::index_uni(i)) * + (stan::model::rvalue(time, "time", + stan::model::index_uni((i + 1))) - + stan::model::rvalue(time, "time", stan::model::index_uni(i))))), + "assigning variable y_hat", stan::model::index_uni((i + 1))); + } + } current_statement__ = 28; - lp_accum__.add( - normal_lpdf(y_obs, y_hat, global_error_sigma)); + lp_accum__.add(stan::math::normal_lpdf(y_obs, y_hat, + global_error_sigma)); current_statement__ = 29; - lp_accum__.add( - normal_lpdf(ind_y_0, y_0_obs, global_error_sigma)); + lp_accum__.add(stan::math::normal_lpdf(ind_y_0, y_0_obs, + global_error_sigma)); current_statement__ = 30; - lp_accum__.add(lognormal_lpdf(ind_beta, 0.1, 1)); + lp_accum__.add(stan::math::lognormal_lpdf(ind_beta, 0.1, 1)); current_statement__ = 31; - lp_accum__.add(cauchy_lpdf(global_error_sigma, 0.1, 1)); + lp_accum__.add(stan::math::cauchy_lpdf(global_error_sigma, + 0.1, 1)); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } lp_accum__.add(lp__); return lp_accum__.sum(); - } // log_prob_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_std_vector_vt* = nullptr> - inline void write_array_impl(RNG& base_rng__, VecR& params_r__, - VecI& params_i__, VecVar& vars__, - const bool emit_transformed_parameters__ = true, - const bool emit_generated_quantities__ = true, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_vector_vt* = nullptr> + inline void + write_array_impl(RNG& base_rng__, VecR& params_r__, VecI& params_i__, + VecVar& vars__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true, std::ostream* + pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.resize(0); - stan::io::reader in__(params_r__, params_i__); - static const char* function__ = "model_constant_single_ind_namespace::write_array"; -(void) function__; // suppress unused var warning - (void) function__; // suppress unused var warning + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; double lp__ = 0.0; - (void) lp__; // dummy to suppress unused var warning + // suppress unused var warning + (void) lp__; + int current_statement__ = 0; stan::math::accumulator lp_accum__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "model_constant_single_ind_namespace::write_array"; + // suppress unused var warning + (void) function__; try { - double ind_y_0; - ind_y_0 = std::numeric_limits::quiet_NaN(); - + double ind_y_0 = std::numeric_limits::quiet_NaN(); current_statement__ = 1; - ind_y_0 = in__.scalar(); - current_statement__ = 1; - ind_y_0 = stan::math::lb_constrain(ind_y_0, 0); - double ind_beta; - ind_beta = std::numeric_limits::quiet_NaN(); - - current_statement__ = 2; - ind_beta = in__.scalar(); + ind_y_0 = in__.template read_constrain_lb(0, lp__); + double ind_beta = std::numeric_limits::quiet_NaN(); current_statement__ = 2; - ind_beta = stan::math::lb_constrain(ind_beta, 0); - double global_error_sigma; - global_error_sigma = std::numeric_limits::quiet_NaN(); - - current_statement__ = 3; - global_error_sigma = in__.scalar(); + ind_beta = in__.template read_constrain_lb(0, lp__); + double global_error_sigma = std::numeric_limits::quiet_NaN(); current_statement__ = 3; - global_error_sigma = stan::math::lb_constrain(global_error_sigma, 0); - vars__.emplace_back(ind_y_0); - vars__.emplace_back(ind_beta); - vars__.emplace_back(global_error_sigma); - if (logical_negation((primitive_value(emit_transformed_parameters__) || - primitive_value(emit_generated_quantities__)))) { + global_error_sigma = in__.template read_constrain_lb(0, lp__); + out__.write(ind_y_0); + out__.write(ind_beta); + out__.write(global_error_sigma); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { return ; - } - if (logical_negation(emit_generated_quantities__)) { + } + if (stan::math::logical_negation(emit_generated_quantities__)) { return ; - } - std::vector y_hat; - y_hat = std::vector(n_obs, std::numeric_limits::quiet_NaN()); - - std::vector Delta_hat; - Delta_hat = std::vector(n_obs, std::numeric_limits::quiet_NaN()); - + } + std::vector y_hat = + std::vector(n_obs, std::numeric_limits::quiet_NaN()); + std::vector Delta_hat = + std::vector(n_obs, std::numeric_limits::quiet_NaN()); current_statement__ = 14; for (int i = 1; i <= n_obs; ++i) { current_statement__ = 8; - if (logical_eq(obs_index[(i - 1)], 1)) { + if (stan::math::logical_eq( + stan::model::rvalue(obs_index, "obs_index", + stan::model::index_uni(i)), 1)) { current_statement__ = 6; - assign(y_hat, cons_list(index_uni(i), nil_index_list()), ind_y_0, - "assigning variable y_hat"); - } + stan::model::assign(y_hat, ind_y_0, "assigning variable y_hat", + stan::model::index_uni(i)); + } current_statement__ = 9; - assign(Delta_hat, cons_list(index_uni(i), nil_index_list()), - growth(y_hat[(i - 1)], ind_beta, pstream__), - "assigning variable Delta_hat"); + stan::model::assign(Delta_hat, + growth( + stan::model::rvalue(y_hat, "y_hat", stan::model::index_uni(i)), + ind_beta, pstream__), "assigning variable Delta_hat", + stan::model::index_uni(i)); current_statement__ = 12; - if (logical_lt(i, n_obs)) { + if (stan::math::logical_lt(i, n_obs)) { current_statement__ = 10; - assign(y_hat, cons_list(index_uni((i + 1)), nil_index_list()), - (y_hat[(i - 1)] + - (Delta_hat[(i - 1)] * (time[((i + 1) - 1)] - time[(i - 1)]))), - "assigning variable y_hat"); - } } - for (int sym1__ = 1; sym1__ <= n_obs; ++sym1__) { - vars__.emplace_back(y_hat[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= n_obs; ++sym1__) { - vars__.emplace_back(Delta_hat[(sym1__ - 1)]);} + stan::model::assign(y_hat, + (stan::model::rvalue(y_hat, "y_hat", stan::model::index_uni(i)) + + (stan::model::rvalue(Delta_hat, "Delta_hat", + stan::model::index_uni(i)) * + (stan::model::rvalue(time, "time", + stan::model::index_uni((i + 1))) - + stan::model::rvalue(time, "time", stan::model::index_uni(i))))), + "assigning variable y_hat", stan::model::index_uni((i + 1))); + } + } + out__.write(y_hat); + out__.write(Delta_hat); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } // write_array_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline void transform_inits_impl(const stan::io::var_context& context__, - VecI& params_i__, VecVar& vars__, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + unconstrain_array_impl(const VecVar& params_r__, const VecI& params_i__, + VecVar& vars__, std::ostream* pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.clear(); - vars__.reserve(num_params_r__); - + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + int pos__ = std::numeric_limits::min(); pos__ = 1; - double ind_y_0; - ind_y_0 = std::numeric_limits::quiet_NaN(); - + local_scalar_t__ ind_y_0 = DUMMY_VAR__; current_statement__ = 1; - ind_y_0 = context__.vals_r("ind_y_0")[(1 - 1)]; - double ind_y_0_free__; - ind_y_0_free__ = std::numeric_limits::quiet_NaN(); - + ind_y_0 = in__.read(); + out__.write_free_lb(0, ind_y_0); + local_scalar_t__ ind_beta = DUMMY_VAR__; + current_statement__ = 2; + ind_beta = in__.read(); + out__.write_free_lb(0, ind_beta); + local_scalar_t__ global_error_sigma = DUMMY_VAR__; + current_statement__ = 3; + global_error_sigma = in__.read(); + out__.write_free_lb(0, global_error_sigma); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr> + inline void + transform_inits_impl(const stan::io::var_context& context__, VecVar& + vars__, std::ostream* pstream__ = nullptr) const { + using local_scalar_t__ = double; + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { current_statement__ = 1; - ind_y_0_free__ = stan::math::lb_free(ind_y_0, 0); - double ind_beta; - ind_beta = std::numeric_limits::quiet_NaN(); - + context__.validate_dims("parameter initialization", "ind_y_0", + "double", std::vector{}); current_statement__ = 2; - ind_beta = context__.vals_r("ind_beta")[(1 - 1)]; - double ind_beta_free__; - ind_beta_free__ = std::numeric_limits::quiet_NaN(); - + context__.validate_dims("parameter initialization", "ind_beta", + "double", std::vector{}); + current_statement__ = 3; + context__.validate_dims("parameter initialization", + "global_error_sigma", "double", std::vector{}); + int pos__ = std::numeric_limits::min(); + pos__ = 1; + local_scalar_t__ ind_y_0 = DUMMY_VAR__; + current_statement__ = 1; + ind_y_0 = context__.vals_r("ind_y_0")[(1 - 1)]; + out__.write_free_lb(0, ind_y_0); + local_scalar_t__ ind_beta = DUMMY_VAR__; current_statement__ = 2; - ind_beta_free__ = stan::math::lb_free(ind_beta, 0); - double global_error_sigma; - global_error_sigma = std::numeric_limits::quiet_NaN(); - + ind_beta = context__.vals_r("ind_beta")[(1 - 1)]; + out__.write_free_lb(0, ind_beta); + local_scalar_t__ global_error_sigma = DUMMY_VAR__; current_statement__ = 3; global_error_sigma = context__.vals_r("global_error_sigma")[(1 - 1)]; - double global_error_sigma_free__; - global_error_sigma_free__ = std::numeric_limits::quiet_NaN(); - - current_statement__ = 3; - global_error_sigma_free__ = stan::math::lb_free(global_error_sigma, 0); - vars__.emplace_back(ind_y_0_free__); - vars__.emplace_back(ind_beta_free__); - vars__.emplace_back(global_error_sigma_free__); + out__.write_free_lb(0, global_error_sigma); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } // transform_inits_impl() - - inline void get_param_names(std::vector& names__) const { - - names__.clear(); - names__.emplace_back("ind_y_0"); - names__.emplace_back("ind_beta"); - names__.emplace_back("global_error_sigma"); - names__.emplace_back("y_hat"); - names__.emplace_back("Delta_hat"); - } // get_param_names() - - inline void get_dims(std::vector>& dimss__) const { - dimss__.clear(); - dimss__.emplace_back(std::vector{}); - - dimss__.emplace_back(std::vector{}); - - dimss__.emplace_back(std::vector{}); - - dimss__.emplace_back(std::vector{static_cast(n_obs)}); - - dimss__.emplace_back(std::vector{static_cast(n_obs)}); - - } // get_dims() - - inline void constrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + } + inline void + get_param_names(std::vector& names__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + names__ = std::vector{"ind_y_0", "ind_beta", + "global_error_sigma"}; + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) { + std::vector temp{"y_hat", "Delta_hat"}; + names__.reserve(names__.size() + temp.size()); + names__.insert(names__.end(), temp.begin(), temp.end()); + } + } + inline void + get_dims(std::vector>& dimss__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + dimss__ = std::vector>{std::vector{}, + std::vector{}, std::vector{}}; + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) { + std::vector> + temp{std::vector{static_cast(n_obs)}, + std::vector{static_cast(n_obs)}}; + dimss__.reserve(dimss__.size() + temp.size()); + dimss__.insert(dimss__.end(), temp.begin(), temp.end()); + } + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { param_names__.emplace_back(std::string() + "ind_y_0"); param_names__.emplace_back(std::string() + "ind_beta"); param_names__.emplace_back(std::string() + "global_error_sigma"); - if (emit_transformed_parameters__) { - - } - + if (emit_transformed_parameters__) {} if (emit_generated_quantities__) { for (int sym1__ = 1; sym1__ <= n_obs; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_hat" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_hat" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n_obs; ++sym1__) { - { - param_names__.emplace_back(std::string() + "Delta_hat" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "Delta_hat" + '.' + + std::to_string(sym1__)); + } } - - } // constrained_param_names() - - inline void unconstrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + } + inline void + unconstrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { param_names__.emplace_back(std::string() + "ind_y_0"); param_names__.emplace_back(std::string() + "ind_beta"); param_names__.emplace_back(std::string() + "global_error_sigma"); - if (emit_transformed_parameters__) { - - } - + if (emit_transformed_parameters__) {} if (emit_generated_quantities__) { for (int sym1__ = 1; sym1__ <= n_obs; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_hat" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_hat" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n_obs; ++sym1__) { - { - param_names__.emplace_back(std::string() + "Delta_hat" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "Delta_hat" + '.' + + std::to_string(sym1__)); + } } - - } // unconstrained_param_names() - + } inline std::string get_constrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"ind_y_0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"ind_beta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"global_error_sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"array\",\"length\":" << n_obs << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"},{\"name\":\"Delta_hat\",\"type\":{\"name\":\"array\",\"length\":" << n_obs << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"}]"; - return s__.str(); - } // get_constrained_sizedtypes() - + return std::string("[{\"name\":\"ind_y_0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"ind_beta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"global_error_sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_obs) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"},{\"name\":\"Delta_hat\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_obs) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"}]"); + } inline std::string get_unconstrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"ind_y_0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"ind_beta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"global_error_sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"array\",\"length\":" << n_obs << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"},{\"name\":\"Delta_hat\",\"type\":{\"name\":\"array\",\"length\":" << n_obs << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"}]"; - return s__.str(); - } // get_unconstrained_sizedtypes() - - - // Begin method overload boilerplate - template - inline void write_array(RNG& base_rng, - Eigen::Matrix& params_r, - Eigen::Matrix& vars, - const bool emit_transformed_parameters = true, - const bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - std::vector vars_vec(vars.size()); - std::vector params_i; - write_array_impl(base_rng, params_r, params_i, vars_vec, - emit_transformed_parameters, emit_generated_quantities, pstream); - vars.resize(vars_vec.size()); - for (int i = 0; i < vars.size(); ++i) { - vars.coeffRef(i) = vars_vec[i]; - } - } - template - inline void write_array(RNG& base_rng, std::vector& params_r, - std::vector& params_i, - std::vector& vars, - bool emit_transformed_parameters = true, - bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - write_array_impl(base_rng, params_r, params_i, vars, emit_transformed_parameters, emit_generated_quantities, pstream); - } - template - inline T_ log_prob(Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const { - Eigen::Matrix params_i; - return log_prob_impl(params_r, params_i, pstream); - } - template - inline T__ log_prob(std::vector& params_r, - std::vector& params_i, - std::ostream* pstream = nullptr) const { - return log_prob_impl(params_r, params_i, pstream); - } - - inline void transform_inits(const stan::io::var_context& context, - Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const final { - std::vector params_r_vec(params_r.size()); - std::vector params_i; - transform_inits_impl(context, params_i, params_r_vec, pstream); - params_r.resize(params_r_vec.size()); - for (int i = 0; i < params_r.size(); ++i) { - params_r.coeffRef(i) = params_r_vec[i]; - } - } - inline void transform_inits(const stan::io::var_context& context, - std::vector& params_i, - std::vector& vars, - std::ostream* pstream = nullptr) const final { - transform_inits_impl(context, params_i, vars, pstream); - } + return std::string("[{\"name\":\"ind_y_0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"ind_beta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"global_error_sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_obs) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"},{\"name\":\"Delta_hat\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_obs) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"generated_quantities\"}]"); + } + // Begin method overload boilerplate + template inline void + write_array(RNG& base_rng, Eigen::Matrix& params_r, + Eigen::Matrix& vars, const bool + emit_transformed_parameters = true, const bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = ((1 + 1) + 1); + const size_t num_transformed = emit_transformed_parameters * (0); + const size_t num_gen_quantities = emit_generated_quantities * ((n_obs + + n_obs)); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + std::vector params_i; + vars = Eigen::Matrix::Constant(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline void + write_array(RNG& base_rng, std::vector& params_r, std::vector& + params_i, std::vector& vars, bool + emit_transformed_parameters = true, bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = ((1 + 1) + 1); + const size_t num_transformed = emit_transformed_parameters * (0); + const size_t num_gen_quantities = emit_generated_quantities * ((n_obs + + n_obs)); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + vars = std::vector(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline T_ + log_prob(Eigen::Matrix& params_r, std::ostream* pstream = nullptr) const { + Eigen::Matrix params_i; + return log_prob_impl(params_r, params_i, pstream); + } + template inline T_ + log_prob(std::vector& params_r, std::vector& params_i, + std::ostream* pstream = nullptr) const { + return log_prob_impl(params_r, params_i, pstream); + } + inline void + transform_inits(const stan::io::var_context& context, + Eigen::Matrix& params_r, std::ostream* + pstream = nullptr) const final { + std::vector params_r_vec(params_r.size()); + std::vector params_i; + transform_inits(context, params_i, params_r_vec, pstream); + params_r = Eigen::Map>(params_r_vec.data(), + params_r_vec.size()); + } + inline void + transform_inits(const stan::io::var_context& context, std::vector& + params_i, std::vector& vars, std::ostream* + pstream__ = nullptr) const { + vars.resize(num_params_r__); + transform_inits_impl(context, vars, pstream__); + } + inline void + unconstrain_array(const std::vector& params_constrained, + std::vector& params_unconstrained, std::ostream* + pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = std::vector(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } + inline void + unconstrain_array(const Eigen::Matrix& params_constrained, + Eigen::Matrix& params_unconstrained, + std::ostream* pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = Eigen::Matrix::Constant(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } }; } using stan_model = model_constant_single_ind_namespace::model_constant_single_ind; #ifndef USING_R // Boilerplate -stan::model::model_base& new_model( - stan::io::var_context& data_context, - unsigned int seed, - std::ostream* msg_stream) { +stan::model::model_base& +new_model(stan::io::var_context& data_context, unsigned int seed, + std::ostream* msg_stream) { stan_model* m = new stan_model(data_context, seed, msg_stream); return *m; } diff --git a/src/stanExports_linear.h b/src/stanExports_linear.h index b072723..b9e1696 100644 --- a/src/stanExports_linear.h +++ b/src/stanExports_linear.h @@ -21,457 +21,418 @@ #define USE_STANC3 #endif #include -// Code generated by stanc v2.26.1-4-gd72b68b7-dirty +// Code generated by stanc v2.32.2 #include namespace model_linear_namespace { -inline void validate_positive_index(const char* var_name, const char* expr, - int val) { - if (val < 1) { - std::stringstream msg; - msg << "Found dimension size less than one in simplex declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -inline void validate_unit_vector_index(const char* var_name, const char* expr, - int val) { - if (val <= 1) { - std::stringstream msg; - if (val == 1) { - msg << "Found dimension size one in unit vector declaration." - << " One-dimensional unit vector is discrete" - << " but the target distribution must be continuous." - << " variable=" << var_name << "; dimension size expression=" << expr; - } else { - msg << "Found dimension size less than one in unit vector declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - } - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -using std::istream; -using std::string; -using std::stringstream; -using std::vector; -using std::pow; -using stan::io::dump; -using stan::math::lgamma; using stan::model::model_base_crtp; -using stan::model::rvalue; -using stan::model::cons_list; -using stan::model::index_uni; -using stan::model::index_max; -using stan::model::index_min; -using stan::model::index_min_max; -using stan::model::index_multi; -using stan::model::index_omni; -using stan::model::nil_index_list; using namespace stan::math; -using stan::math::pow; stan::math::profile_map profiles__; -static int current_statement__= 0; -static const std::vector locations_array__ = {" (found before start of program)", - " (in 'linear', line 8, column 2 to column 17)", - " (in 'linear', line 9, column 2 to column 12)", - " (in 'linear', line 10, column 2 to column 22)", - " (in 'linear', line 14, column 2 to column 42)", - " (in 'linear', line 3, column 2 to column 17)", - " (in 'linear', line 4, column 9 to column 10)", - " (in 'linear', line 4, column 2 to column 14)", - " (in 'linear', line 5, column 9 to column 10)", - " (in 'linear', line 5, column 2 to column 14)"}; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'linear', line 8, column 2 to column 17)", + " (in 'linear', line 9, column 2 to column 12)", + " (in 'linear', line 10, column 2 to column 22)", + " (in 'linear', line 14, column 2 to column 42)", + " (in 'linear', line 3, column 2 to column 17)", + " (in 'linear', line 4, column 9 to column 10)", + " (in 'linear', line 4, column 2 to column 14)", + " (in 'linear', line 5, column 9 to column 10)", + " (in 'linear', line 5, column 2 to column 14)"}; #include class model_linear final : public model_base_crtp { private: int N; - Eigen::Matrix X; - Eigen::Matrix Y; - + Eigen::Matrix X_data__; + Eigen::Matrix Y_data__; + Eigen::Map> X{nullptr, 0}; + Eigen::Map> Y{nullptr, 0}; public: - ~model_linear() { } - - inline std::string model_name() const final { return "model_linear"; } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = stanc3 v2.26.1-4-gd72b68b7-dirty", "stancflags = "}; - } - - - model_linear(stan::io::var_context& context__, - unsigned int random_seed__ = 0, - std::ostream* pstream__ = nullptr) : model_base_crtp(0) { - using local_scalar_t__ = double ; - boost::ecuyer1988 base_rng__ = - stan::services::util::create_rng(random_seed__, 0); - (void) base_rng__; // suppress unused var warning - static const char* function__ = "model_linear_namespace::model_linear"; - (void) function__; // suppress unused var warning + ~model_linear() {} + model_linear(stan::io::var_context& context__, unsigned int + random_seed__ = 0, std::ostream* pstream__ = nullptr) + : model_base_crtp(0) { + int current_statement__ = 0; + using local_scalar_t__ = double; + boost::ecuyer1988 base_rng__ = + stan::services::util::create_rng(random_seed__, 0); + // suppress unused var warning + (void) base_rng__; + static constexpr const char* function__ = + "model_linear_namespace::model_linear"; + // suppress unused var warning + (void) function__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + int pos__ = std::numeric_limits::min(); pos__ = 1; current_statement__ = 5; - context__.validate_dims("data initialization","N","int", - context__.to_vec()); + context__.validate_dims("data initialization", "N", "int", + std::vector{}); N = std::numeric_limits::min(); - current_statement__ = 5; N = context__.vals_i("N")[(1 - 1)]; current_statement__ = 5; - current_statement__ = 5; - check_greater_or_equal(function__, "N", N, 1); + stan::math::check_greater_or_equal(function__, "N", N, 1); current_statement__ = 6; - validate_non_negative_index("X", "N", N); + stan::math::validate_non_negative_index("X", "N", N); current_statement__ = 7; - context__.validate_dims("data initialization","X","double", - context__.to_vec(N)); - X = Eigen::Matrix(N); - stan::math::fill(X, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "X", "double", + std::vector{static_cast(N)}); + X_data__ = Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + new (&X) Eigen::Map>(X_data__.data(), N); { std::vector X_flat__; current_statement__ = 7; - assign(X_flat__, nil_index_list(), context__.vals_r("X"), - "assigning variable X_flat__"); + X_flat__ = context__.vals_r("X"); current_statement__ = 7; pos__ = 1; current_statement__ = 7; for (int sym1__ = 1; sym1__ <= N; ++sym1__) { current_statement__ = 7; - assign(X, cons_list(index_uni(sym1__), nil_index_list()), - X_flat__[(pos__ - 1)], "assigning variable X"); + stan::model::assign(X, X_flat__[(pos__ - 1)], + "assigning variable X", stan::model::index_uni(sym1__)); current_statement__ = 7; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 8; - validate_non_negative_index("Y", "N", N); + stan::math::validate_non_negative_index("Y", "N", N); current_statement__ = 9; - context__.validate_dims("data initialization","Y","double", - context__.to_vec(N)); - Y = Eigen::Matrix(N); - stan::math::fill(Y, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "Y", "double", + std::vector{static_cast(N)}); + Y_data__ = Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + new (&Y) Eigen::Map>(Y_data__.data(), N); { std::vector Y_flat__; current_statement__ = 9; - assign(Y_flat__, nil_index_list(), context__.vals_r("Y"), - "assigning variable Y_flat__"); + Y_flat__ = context__.vals_r("Y"); current_statement__ = 9; pos__ = 1; current_statement__ = 9; for (int sym1__ = 1; sym1__ <= N; ++sym1__) { current_statement__ = 9; - assign(Y, cons_list(index_uni(sym1__), nil_index_list()), - Y_flat__[(pos__ - 1)], "assigning variable Y"); + stan::model::assign(Y, Y_flat__[(pos__ - 1)], + "assigning variable Y", stan::model::index_uni(sym1__)); current_statement__ = 9; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); - } - num_params_r__ = 0U; - - try { - num_params_r__ += 1; - num_params_r__ += 1; - num_params_r__ += 1; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } + num_params_r__ = 1 + 1 + 1; } - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline stan::scalar_type_t log_prob_impl(VecR& params_r__, - VecI& params_i__, - std::ostream* pstream__ = nullptr) const { + inline std::string model_name() const final { + return "model_linear"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = stanc3 v2.32.2", + "stancflags = --allow-undefined"}; + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline stan::scalar_type_t + log_prob_impl(VecR& params_r__, VecI& params_i__, std::ostream* + pstream__ = nullptr) const { using T__ = stan::scalar_type_t; using local_scalar_t__ = T__; T__ lp__(0.0); stan::math::accumulator lp_accum__; - static const char* function__ = "model_linear_namespace::log_prob"; -(void) function__; // suppress unused var warning - stan::io::reader in__(params_r__, params_i__); + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "model_linear_namespace::log_prob"; + // suppress unused var warning + (void) function__; try { - local_scalar_t__ intercept; - intercept = DUMMY_VAR__; - + local_scalar_t__ intercept = DUMMY_VAR__; current_statement__ = 1; - intercept = in__.scalar(); - local_scalar_t__ beta; - beta = DUMMY_VAR__; - + intercept = in__.template read(); + local_scalar_t__ beta = DUMMY_VAR__; current_statement__ = 2; - beta = in__.scalar(); - local_scalar_t__ sigma; - sigma = DUMMY_VAR__; - - current_statement__ = 3; - sigma = in__.scalar(); + beta = in__.template read(); + local_scalar_t__ sigma = DUMMY_VAR__; current_statement__ = 3; - if (jacobian__) { - current_statement__ = 3; - sigma = stan::math::lb_constrain(sigma, 0, lp__); - } else { - current_statement__ = 3; - sigma = stan::math::lb_constrain(sigma, 0); - } + sigma = in__.template read_constrain_lb(0, lp__); { current_statement__ = 4; - lp_accum__.add( - normal_lpdf(Y, add(intercept, multiply(beta, X)), sigma)); + lp_accum__.add(stan::math::normal_lpdf(Y, + stan::math::add(intercept, + stan::math::multiply(beta, X)), sigma)); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } lp_accum__.add(lp__); return lp_accum__.sum(); - } // log_prob_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_std_vector_vt* = nullptr> - inline void write_array_impl(RNG& base_rng__, VecR& params_r__, - VecI& params_i__, VecVar& vars__, - const bool emit_transformed_parameters__ = true, - const bool emit_generated_quantities__ = true, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_vector_vt* = nullptr> + inline void + write_array_impl(RNG& base_rng__, VecR& params_r__, VecI& params_i__, + VecVar& vars__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true, std::ostream* + pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.resize(0); - stan::io::reader in__(params_r__, params_i__); - static const char* function__ = "model_linear_namespace::write_array"; -(void) function__; // suppress unused var warning - (void) function__; // suppress unused var warning + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; double lp__ = 0.0; - (void) lp__; // dummy to suppress unused var warning + // suppress unused var warning + (void) lp__; + int current_statement__ = 0; stan::math::accumulator lp_accum__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "model_linear_namespace::write_array"; + // suppress unused var warning + (void) function__; try { - double intercept; - intercept = std::numeric_limits::quiet_NaN(); - + double intercept = std::numeric_limits::quiet_NaN(); current_statement__ = 1; - intercept = in__.scalar(); - double beta; - beta = std::numeric_limits::quiet_NaN(); - + intercept = in__.template read(); + double beta = std::numeric_limits::quiet_NaN(); current_statement__ = 2; - beta = in__.scalar(); - double sigma; - sigma = std::numeric_limits::quiet_NaN(); - + beta = in__.template read(); + double sigma = std::numeric_limits::quiet_NaN(); current_statement__ = 3; - sigma = in__.scalar(); - current_statement__ = 3; - sigma = stan::math::lb_constrain(sigma, 0); - vars__.emplace_back(intercept); - vars__.emplace_back(beta); - vars__.emplace_back(sigma); - if (logical_negation((primitive_value(emit_transformed_parameters__) || - primitive_value(emit_generated_quantities__)))) { + sigma = in__.template read_constrain_lb(0, lp__); + out__.write(intercept); + out__.write(beta); + out__.write(sigma); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { return ; - } - if (logical_negation(emit_generated_quantities__)) { + } + if (stan::math::logical_negation(emit_generated_quantities__)) { return ; - } + } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } // write_array_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline void transform_inits_impl(const stan::io::var_context& context__, - VecI& params_i__, VecVar& vars__, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + unconstrain_array_impl(const VecVar& params_r__, const VecI& params_i__, + VecVar& vars__, std::ostream* pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.clear(); - vars__.reserve(num_params_r__); - + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + int pos__ = std::numeric_limits::min(); pos__ = 1; - double intercept; - intercept = std::numeric_limits::quiet_NaN(); - + local_scalar_t__ intercept = DUMMY_VAR__; + current_statement__ = 1; + intercept = in__.read(); + out__.write(intercept); + local_scalar_t__ beta = DUMMY_VAR__; + current_statement__ = 2; + beta = in__.read(); + out__.write(beta); + local_scalar_t__ sigma = DUMMY_VAR__; + current_statement__ = 3; + sigma = in__.read(); + out__.write_free_lb(0, sigma); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr> + inline void + transform_inits_impl(const stan::io::var_context& context__, VecVar& + vars__, std::ostream* pstream__ = nullptr) const { + using local_scalar_t__ = double; + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 1; + context__.validate_dims("parameter initialization", "intercept", + "double", std::vector{}); + current_statement__ = 2; + context__.validate_dims("parameter initialization", "beta", "double", + std::vector{}); + current_statement__ = 3; + context__.validate_dims("parameter initialization", "sigma", "double", + std::vector{}); + int pos__ = std::numeric_limits::min(); + pos__ = 1; + local_scalar_t__ intercept = DUMMY_VAR__; current_statement__ = 1; intercept = context__.vals_r("intercept")[(1 - 1)]; - double beta; - beta = std::numeric_limits::quiet_NaN(); - + out__.write(intercept); + local_scalar_t__ beta = DUMMY_VAR__; current_statement__ = 2; beta = context__.vals_r("beta")[(1 - 1)]; - double sigma; - sigma = std::numeric_limits::quiet_NaN(); - + out__.write(beta); + local_scalar_t__ sigma = DUMMY_VAR__; current_statement__ = 3; sigma = context__.vals_r("sigma")[(1 - 1)]; - double sigma_free__; - sigma_free__ = std::numeric_limits::quiet_NaN(); - - current_statement__ = 3; - sigma_free__ = stan::math::lb_free(sigma, 0); - vars__.emplace_back(intercept); - vars__.emplace_back(beta); - vars__.emplace_back(sigma_free__); + out__.write_free_lb(0, sigma); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } // transform_inits_impl() - - inline void get_param_names(std::vector& names__) const { - - names__.clear(); - names__.emplace_back("intercept"); - names__.emplace_back("beta"); - names__.emplace_back("sigma"); - } // get_param_names() - - inline void get_dims(std::vector>& dimss__) const { - dimss__.clear(); - dimss__.emplace_back(std::vector{}); - - dimss__.emplace_back(std::vector{}); - - dimss__.emplace_back(std::vector{}); - - } // get_dims() - - inline void constrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + } + inline void + get_param_names(std::vector& names__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + names__ = std::vector{"intercept", "beta", "sigma"}; + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) {} + } + inline void + get_dims(std::vector>& dimss__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + dimss__ = std::vector>{std::vector{}, + std::vector{}, std::vector{}}; + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) {} + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { param_names__.emplace_back(std::string() + "intercept"); param_names__.emplace_back(std::string() + "beta"); param_names__.emplace_back(std::string() + "sigma"); - if (emit_transformed_parameters__) { - - } - - if (emit_generated_quantities__) { - - } - - } // constrained_param_names() - - inline void unconstrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) {} + } + inline void + unconstrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { param_names__.emplace_back(std::string() + "intercept"); param_names__.emplace_back(std::string() + "beta"); param_names__.emplace_back(std::string() + "sigma"); - if (emit_transformed_parameters__) { - - } - - if (emit_generated_quantities__) { - - } - - } // unconstrained_param_names() - + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) {} + } inline std::string get_constrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"intercept\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"}]"; - return s__.str(); - } // get_constrained_sizedtypes() - + return std::string("[{\"name\":\"intercept\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"}]"); + } inline std::string get_unconstrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"intercept\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"}]"; - return s__.str(); - } // get_unconstrained_sizedtypes() - - - // Begin method overload boilerplate - template - inline void write_array(RNG& base_rng, - Eigen::Matrix& params_r, - Eigen::Matrix& vars, - const bool emit_transformed_parameters = true, - const bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - std::vector vars_vec(vars.size()); - std::vector params_i; - write_array_impl(base_rng, params_r, params_i, vars_vec, - emit_transformed_parameters, emit_generated_quantities, pstream); - vars.resize(vars_vec.size()); - for (int i = 0; i < vars.size(); ++i) { - vars.coeffRef(i) = vars_vec[i]; - } - } - template - inline void write_array(RNG& base_rng, std::vector& params_r, - std::vector& params_i, - std::vector& vars, - bool emit_transformed_parameters = true, - bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - write_array_impl(base_rng, params_r, params_i, vars, emit_transformed_parameters, emit_generated_quantities, pstream); - } - template - inline T_ log_prob(Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const { - Eigen::Matrix params_i; - return log_prob_impl(params_r, params_i, pstream); - } - template - inline T__ log_prob(std::vector& params_r, - std::vector& params_i, - std::ostream* pstream = nullptr) const { - return log_prob_impl(params_r, params_i, pstream); - } - - inline void transform_inits(const stan::io::var_context& context, - Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const final { - std::vector params_r_vec(params_r.size()); - std::vector params_i; - transform_inits_impl(context, params_i, params_r_vec, pstream); - params_r.resize(params_r_vec.size()); - for (int i = 0; i < params_r.size(); ++i) { - params_r.coeffRef(i) = params_r_vec[i]; - } - } - inline void transform_inits(const stan::io::var_context& context, - std::vector& params_i, - std::vector& vars, - std::ostream* pstream = nullptr) const final { - transform_inits_impl(context, params_i, vars, pstream); - } + return std::string("[{\"name\":\"intercept\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"}]"); + } + // Begin method overload boilerplate + template inline void + write_array(RNG& base_rng, Eigen::Matrix& params_r, + Eigen::Matrix& vars, const bool + emit_transformed_parameters = true, const bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = ((1 + 1) + 1); + const size_t num_transformed = emit_transformed_parameters * (0); + const size_t num_gen_quantities = emit_generated_quantities * (0); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + std::vector params_i; + vars = Eigen::Matrix::Constant(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline void + write_array(RNG& base_rng, std::vector& params_r, std::vector& + params_i, std::vector& vars, bool + emit_transformed_parameters = true, bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = ((1 + 1) + 1); + const size_t num_transformed = emit_transformed_parameters * (0); + const size_t num_gen_quantities = emit_generated_quantities * (0); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + vars = std::vector(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline T_ + log_prob(Eigen::Matrix& params_r, std::ostream* pstream = nullptr) const { + Eigen::Matrix params_i; + return log_prob_impl(params_r, params_i, pstream); + } + template inline T_ + log_prob(std::vector& params_r, std::vector& params_i, + std::ostream* pstream = nullptr) const { + return log_prob_impl(params_r, params_i, pstream); + } + inline void + transform_inits(const stan::io::var_context& context, + Eigen::Matrix& params_r, std::ostream* + pstream = nullptr) const final { + std::vector params_r_vec(params_r.size()); + std::vector params_i; + transform_inits(context, params_i, params_r_vec, pstream); + params_r = Eigen::Map>(params_r_vec.data(), + params_r_vec.size()); + } + inline void + transform_inits(const stan::io::var_context& context, std::vector& + params_i, std::vector& vars, std::ostream* + pstream__ = nullptr) const { + vars.resize(num_params_r__); + transform_inits_impl(context, vars, pstream__); + } + inline void + unconstrain_array(const std::vector& params_constrained, + std::vector& params_unconstrained, std::ostream* + pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = std::vector(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } + inline void + unconstrain_array(const Eigen::Matrix& params_constrained, + Eigen::Matrix& params_unconstrained, + std::ostream* pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = Eigen::Matrix::Constant(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } }; } using stan_model = model_linear_namespace::model_linear; #ifndef USING_R // Boilerplate -stan::model::model_base& new_model( - stan::io::var_context& data_context, - unsigned int seed, - std::ostream* msg_stream) { +stan::model::model_base& +new_model(stan::io::var_context& data_context, unsigned int seed, + std::ostream* msg_stream) { stan_model* m = new stan_model(data_context, seed, msg_stream); return *m; } diff --git a/tests/testthat/_snaps/rmot_models.md b/tests/testthat/_snaps/rmot_models.md index d41d639..bd59349 100644 --- a/tests/testthat/_snaps/rmot_models.md +++ b/tests/testthat/_snaps/rmot_models.md @@ -1,1226 +1,174 @@ # Execution and output: Linear Code - samps_linear + samps_linear_summary Output - , , parameters = intercept + $summary + mean se_mean sd 2.5% 25% + intercept -1.356421 0.063051077 0.60921523 -2.594061 -1.717373 + beta 2.592872 0.003928795 0.04006136 2.517866 2.567322 + sigma 3.001566 0.014199783 0.20913421 2.632488 2.869261 + lp__ -132.153970 0.098941463 1.18636974 -135.421503 -132.712525 + 50% 75% 97.5% n_eff Rhat + intercept -1.302390 -0.9281353 -0.3286294 93.35906 1.0154047 + beta 2.590268 2.6198523 2.6809435 103.97585 1.0178614 + sigma 2.984077 3.1226079 3.5039587 216.91357 0.9992496 + lp__ -131.830320 -131.3064360 -130.8260911 143.77503 1.0072447 - chains - iterations chain:1 chain:2 - [1,] -0.91940946 -0.17997577 - [2,] -0.91940946 -0.17997577 - [3,] -0.91940946 -0.17997577 - [4,] -0.91940946 -0.17997577 - [5,] -0.92433246 -0.16012721 - [6,] -0.95899455 -0.15601386 - [7,] -0.91111703 -0.16553905 - [8,] -0.82998754 -0.09316345 - [9,] -0.82998754 -0.08200645 - [10,] -0.86355810 -0.02659005 - [11,] -0.90157500 0.02460963 - [12,] -0.79760461 -0.06727737 - [13,] -0.81977699 0.56935040 - [14,] -0.81593374 0.53617947 - [15,] -0.81593374 0.52342011 - [16,] -0.84151631 0.63989085 - [17,] -0.82940498 0.46104695 - [18,] -0.83967413 0.29745271 - [19,] -0.78929980 0.20050998 - [20,] -0.93499010 0.28072578 - [21,] -0.90429296 0.32563188 - [22,] -0.74901920 0.30209545 - [23,] -0.19878656 0.30209545 - [24,] -0.18903494 0.35542684 - [25,] -0.20184008 0.31477141 - [26,] -0.15834765 -0.61884115 - [27,] 0.06319311 -0.61182774 - [28,] -0.20328872 -0.76236066 - [29,] -0.28845259 -0.63038229 - [30,] -0.93785063 -0.87109084 - [31,] -0.98481750 -0.82653536 - [32,] -0.98766237 -0.82653536 - [33,] -1.57624562 -0.82138439 - [34,] -1.57624562 -0.82055505 - [35,] -0.93653493 -0.83510158 - [36,] -0.74042015 -0.87010138 - [37,] -0.73855465 -0.87963275 - [38,] -1.58900123 -0.85832191 - [39,] -1.71837393 -0.85832191 - [40,] -1.91485432 -0.87338994 - [41,] -1.43542601 -0.91766615 - [42,] -1.87470142 -0.77050460 - [43,] -2.28501781 -0.86554240 - [44,] -2.27287693 -0.94740362 - [45,] -2.27287693 -0.94740362 - [46,] -2.28599592 -1.84702097 - [47,] -2.31627611 -2.30209598 - [48,] -1.89826665 -2.26220254 - [49,] -1.93357645 -1.85347030 - [50,] -1.80207258 -1.85347030 - [51,] -1.82849930 -1.23602270 - [52,] -1.54601793 -1.22650682 - [53,] -0.60054960 -1.21453683 - [54,] -0.49992220 -1.23651122 - [55,] -0.45670943 -1.43865956 - [56,] -0.47185763 -2.46760500 - [57,] -0.46556640 -2.44900523 - [58,] -0.42999497 -2.46207020 - [59,] -0.42085889 -2.29357656 - [60,] -0.53343821 -2.30231039 - [61,] -0.53343821 -1.65324657 - [62,] -1.00629429 -1.70124859 - [63,] -1.94940147 -1.68366140 - [64,] -1.91783563 -1.53804000 - [65,] -1.24130835 -1.70280380 - [66,] -1.24130835 -1.68852998 - [67,] -1.58910989 -1.67539077 - [68,] -0.95998445 -1.67539077 - [69,] -0.99283764 -1.20817687 - [70,] -1.13454416 -0.91775956 - [71,] -1.14094299 -1.31838134 - [72,] -1.16999279 -1.29522431 - [73,] -1.14505494 -0.07795584 - [74,] -1.15560566 -0.07795584 - [75,] -1.02079105 -0.07478097 - [76,] -1.20073930 -0.21770415 - [77,] -0.92269582 -0.13360611 - [78,] -0.87582855 0.19628132 - [79,] -0.87582393 0.20120425 - [80,] -0.89184608 0.18943891 - [81,] -0.79913189 -0.16093997 - [82,] -0.77013891 -0.16188830 - [83,] -0.76440428 -0.15000778 - [84,] -0.76440428 -0.49667058 - [85,] -2.05136636 -0.49667058 - [86,] -1.15954368 -0.50763577 - [87,] -1.24046041 -0.47268646 - [88,] -1.24046041 -1.98387976 - [89,] -1.23282227 -2.02255855 - [90,] -1.12125038 -2.03254035 - [91,] -1.25342126 -1.00273883 - [92,] -1.26801083 -0.99706830 - [93,] -1.22842392 -1.22254384 - [94,] -1.25498367 -0.99930999 - [95,] -1.13159342 -1.07264886 - [96,] -0.99831190 -1.07264886 - [97,] -0.91599154 -1.09092417 - [98,] -0.81601528 -1.08349025 - [99,] -0.46324858 -1.40674698 - [100,] -0.86771683 -1.46283947 - [101,] -1.38501057 -1.46283947 - [102,] -1.38501057 -1.46283947 - [103,] -0.45724985 -1.57140441 - [104,] -0.42874213 -1.87185704 - [105,] -0.59637409 -1.24092437 - [106,] -0.59637409 -1.47117433 - [107,] -0.57433753 -1.57371731 - [108,] -0.31964616 -1.57371731 - [109,] -1.11980592 -1.46241779 - [110,] -0.49703109 -1.04210105 - [111,] -0.37420002 -0.99198715 - [112,] -0.89114574 -0.81086038 - [113,] -2.07862810 -1.35470271 - [114,] -1.98279346 -1.35470271 - [115,] -2.16310915 -2.22233183 - [116,] -1.88505316 -1.76641698 - [117,] -1.74448455 -1.76641698 - [118,] -1.40361871 -1.67276231 - [119,] -1.40361871 -1.57286526 - [120,] -1.41091022 -2.33526904 - [121,] -1.56389907 -2.25833987 - [122,] -1.02788515 -2.25754832 - [123,] -1.78121350 -0.63616385 - [124,] -1.58554779 -1.78534822 - [125,] -1.37219171 -1.54849719 - [126,] -1.37219171 -1.54849719 - [127,] -1.31196716 -0.92991570 - [128,] -1.10578916 -1.24469585 - [129,] -1.40028379 -1.23394356 - [130,] -1.40768160 -0.90528268 - [131,] -1.20800357 -0.90528268 - [132,] -2.28017351 -1.15219347 - [133,] -2.17104638 -0.49387992 - [134,] -0.84736909 -0.95037112 - [135,] -2.36402335 -1.22899041 - [136,] -2.06405435 -1.22899041 - [137,] -2.06405435 -1.17055697 - [138,] -1.99016531 -0.82086658 - [139,] -1.91466010 -3.51961365 - [140,] -2.19335034 -2.20702927 - [141,] -0.38489218 -2.32504298 - [142,] -0.38489218 -2.32504298 - [143,] -1.61225188 -2.48054796 - [144,] -1.72302145 -0.72495363 - [145,] -1.62108963 -0.30026316 - [146,] -1.07552369 -0.36743794 - [147,] -1.07552369 -0.90091743 - [148,] -0.98366507 -0.77657076 - [149,] -1.27647060 -0.78428847 - [150,] -1.51556915 -0.78428847 - [151,] -1.45920794 -0.68441477 - [152,] -1.51333482 -1.56836970 - [153,] -1.26293127 -1.13156992 - [154,] -1.50113595 -1.12644731 - [155,] -0.92023842 -1.25552904 - [156,] -1.05614789 -1.25180996 - [157,] -1.38152518 -0.94585261 - [158,] -1.62664524 -1.08647384 - [159,] -0.82399325 -0.20419204 - [160,] -0.62893692 0.01654434 - [161,] -0.58518585 -1.17693452 - [162,] -1.48039448 -1.19682231 - [163,] -1.40662372 -1.55964494 - [164,] -2.94156205 -1.11814669 - [165,] -2.79258273 -1.47403773 - [166,] -2.86042079 -0.83122491 - [167,] -1.84050220 -2.12412096 - [168,] -2.56271669 -1.82444954 - [169,] -2.08594397 -1.06611575 - [170,] -1.96865094 -1.64029461 - [171,] -2.04099007 -1.34118394 - [172,] -2.38657970 -1.54821753 - [173,] -2.02575755 -0.55420614 - [174,] -2.19841892 -0.78802967 - [175,] -2.28855344 -0.91315606 - [176,] -0.11491275 -2.21545520 - [177,] 0.11738203 -2.25192142 - [178,] -0.51320013 -2.34733168 - [179,] -0.46200731 -2.01585877 - [180,] -0.71880916 -0.93082086 - [181,] -0.87470142 -1.58247630 - [182,] -0.59746489 -1.20075080 - [183,] -0.88757590 0.28362761 - [184,] -0.96144263 -2.57980691 - [185,] -1.21308564 -2.04146300 - [186,] -1.15336110 -2.61291966 - [187,] -1.04681066 -0.62473832 - [188,] -1.24892341 -2.34345467 - [189,] -1.24705646 -2.13301032 - [190,] -0.66770479 -1.75992300 - [191,] -0.65929361 -0.90069535 - [192,] -0.67934935 -0.54252411 - [193,] -1.05622735 -0.60838615 - [194,] -1.06194150 -1.10652003 - [195,] -0.48305359 -1.05540098 - [196,] -1.97563011 -1.12942191 - [197,] -2.35984130 -0.44716827 - [198,] -2.13008599 -0.50542005 - [199,] -1.87552359 -1.72920871 - [200,] -1.89939680 -1.86753299 - [201,] -2.00512033 -0.95351680 - [202,] -1.91969603 -1.25650990 - [203,] -1.98459032 -1.56697038 - [204,] -0.73660545 -1.80565837 - [205,] -1.61373730 -1.14441655 - [206,] -2.03955440 -1.01156627 - [207,] -2.18986140 -1.18097818 - [208,] -2.13739558 -1.95942752 - [209,] -2.11722405 -1.55202583 - [210,] -1.28308174 -0.96257673 - [211,] -0.99619383 -1.43382316 - [212,] -0.69274619 -0.39884407 - [213,] -0.89381618 -2.19539646 - [214,] -1.52808983 -1.21880480 - [215,] -2.30203854 -1.33124991 - [216,] -1.68388663 -1.30463894 - [217,] -1.48132644 -1.15968829 - [218,] -1.68072287 -2.29933584 - [219,] -1.07223380 -1.67060973 - [220,] -1.36802232 -1.66487016 - [221,] -2.02780898 -1.79850690 - [222,] -1.29987919 -2.02531518 - [223,] -1.29148284 -2.13167419 - [224,] -0.92604110 -1.18392435 - [225,] -1.30486698 -1.15142113 - [226,] -1.26718304 -1.40836355 - [227,] -0.94066257 -1.43293529 - [228,] -0.71661726 -1.29874656 - [229,] -0.72547903 -1.52864251 - [230,] -1.39276433 -1.81669181 - [231,] -1.68677762 -1.52759695 - [232,] -1.38958712 -2.13079784 - [233,] -0.81624293 -0.85453430 - [234,] -0.53141901 -1.19234538 - [235,] -0.91315300 -0.60776775 - [236,] -0.58283363 -0.55000121 - [237,] 0.10047151 -0.71998836 - [238,] 0.06371408 -0.97777915 - [239,] -0.74847952 -0.45851450 - [240,] -1.05401767 -1.75312388 - [241,] -1.08250166 -1.88609684 - [242,] -1.00167755 -2.57244617 - [243,] -1.06177085 -2.40572153 - [244,] -1.15123744 -1.73216672 - [245,] -2.23392347 -1.68821462 - [246,] -1.38847391 -0.61847857 - [247,] -0.58666220 -1.39031774 - [248,] -0.45024133 -1.40934914 - [249,] -1.34485371 -1.40514103 - [250,] -1.55449677 -0.56512859 - [251,] -2.31724155 -1.36799916 - [252,] -1.11956328 -2.36160942 - [253,] -0.19729741 -1.80472920 - [254,] -1.09866366 -2.14824450 - [255,] -0.38366078 -2.03289415 - [256,] -0.41947920 -1.80943436 - [257,] -0.49240509 -1.34293521 - [258,] -1.05816939 -0.58466089 - [259,] -1.74673835 -0.39016661 - [260,] -1.41000748 -1.06739416 - [261,] -1.09364348 -1.50563744 - [262,] -0.58244697 -0.69466858 - [263,] -1.42017893 -1.01824740 - [264,] -1.26253823 -1.08061986 - [265,] -2.66700348 -1.25256143 - [266,] -2.32556840 -1.24682712 - [267,] -2.08584285 -0.92925560 - [268,] -1.34857537 -1.31629798 - [269,] -2.29470586 -0.56081402 - [270,] -0.52386967 -0.98518678 - [271,] 0.12608829 -1.20611458 - [272,] -0.85032314 -1.24330129 - [273,] -1.04657960 -1.34050186 - [274,] -0.63460993 -1.06301823 - [275,] -0.66616348 -0.54579550 - [276,] -1.39560877 -1.83466754 - [277,] -0.46975539 -1.68920901 - [278,] -1.46903148 -1.58517910 - [279,] -1.59161414 -1.71333636 - [280,] -2.38895478 -1.86648166 - [281,] -1.66860899 -1.30704668 - [282,] -1.61091232 -1.70925989 - [283,] -2.32684978 -0.99154136 - [284,] -1.86386388 -1.06679088 - [285,] -3.11940392 -1.23966258 - [286,] -2.46015365 -1.29844732 - [287,] -2.38200308 -1.02834820 - [288,] -1.87609961 -1.51282671 - [289,] -2.22394178 -1.86325848 - [290,] -1.86117256 -1.24812012 - [291,] -1.51978046 -1.50055875 - [292,] -1.16189517 -0.60103957 - [293,] -1.04163224 -0.68340097 - [294,] -0.85885452 -1.51866128 - [295,] -1.22262829 -1.49603870 - [296,] -1.33710126 -1.65098681 - [297,] -2.01998367 -1.57919560 - [298,] -1.33262591 -1.05042222 - [299,] -1.10269041 -1.00084218 - [300,] -1.70084622 -1.63639227 + $c_summary + , , chains = chain:1 - , , parameters = beta + stats + parameter mean sd 2.5% 25% 50% + intercept -1.355784 0.6782875 -2.701524 -1.875972 -1.302390 + beta 2.590545 0.0439151 2.511166 2.560300 2.586961 + sigma 2.995313 0.2010721 2.636456 2.877605 2.982298 + lp__ -132.217043 1.1657964 -135.413687 -132.779363 -131.988344 + stats + parameter 75% 97.5% + intercept -0.8779058 -0.06578957 + beta 2.6241823 2.68418901 + sigma 3.0991194 3.44213670 + lp__ -131.3744630 -130.85672424 - chains - iterations chain:1 chain:2 - [1,] 0.9152248 -0.33598094 - [2,] 0.9152248 -0.33598094 - [3,] 0.9152248 -0.33598094 - [4,] 0.9152248 -0.33598094 - [5,] 1.0228705 -0.01872118 - [6,] 1.1678574 0.36122492 - [7,] 1.3641521 0.56054355 - [8,] 1.6164809 0.58820812 - [9,] 1.6164809 0.66106074 - [10,] 2.0757431 0.68989178 - [11,] 2.5047391 0.90431660 - [12,] 2.5189136 1.23972859 - [13,] 2.4915060 2.80142849 - [14,] 2.5891962 2.40572549 - [15,] 2.5891962 2.44189568 - [16,] 2.5849898 2.50936282 - [17,] 2.6083976 2.47994265 - [18,] 2.4791420 2.48917332 - [19,] 2.5926026 2.50330986 - [20,] 2.5968045 2.50288756 - [21,] 2.6014620 2.49788148 - [22,] 2.5935282 2.50186525 - [23,] 2.5703527 2.50186525 - [24,] 2.5537750 2.49308251 - [25,] 2.5367103 2.49104793 - [26,] 2.5496195 2.54296758 - [27,] 2.5302150 2.56475987 - [28,] 2.5549202 2.57282203 - [29,] 2.5165191 2.52473718 - [30,] 2.6036436 2.55046128 - [31,] 2.5747170 2.57820516 - [32,] 2.5716870 2.57820516 - [33,] 2.6013888 2.55979992 - [34,] 2.6013888 2.57240120 - [35,] 2.5727031 2.56300980 - [36,] 2.5519555 2.58071694 - [37,] 2.5500165 2.57309141 - [38,] 2.6147050 2.56277674 - [39,] 2.6210726 2.56277674 - [40,] 2.6158326 2.55512834 - [41,] 2.6028261 2.57047723 - [42,] 2.6163902 2.54575758 - [43,] 2.6734664 2.55866955 - [44,] 2.6358571 2.57052298 - [45,] 2.6358571 2.57052298 - [46,] 2.6360122 2.62170531 - [47,] 2.6583931 2.64609506 - [48,] 2.6074667 2.66341881 - [49,] 2.6498672 2.64038761 - [50,] 2.5932727 2.64038761 - [51,] 2.6709937 2.60705581 - [52,] 2.5509307 2.57740562 - [53,] 2.4942215 2.58388713 - [54,] 2.5461789 2.58977415 - [55,] 2.5279022 2.60299146 - [56,] 2.5583425 2.62807036 - [57,] 2.5587702 2.67198052 - [58,] 2.5482704 2.63115479 - [59,] 2.5265620 2.62097435 - [60,] 2.5280396 2.67995803 - [61,] 2.5280396 2.62049584 - [62,] 2.5566093 2.56846608 - [63,] 2.6299091 2.61125332 - [64,] 2.6050812 2.56944359 - [65,] 2.6011829 2.61190730 - [66,] 2.6011829 2.59314849 - [67,] 2.6304011 2.60390119 - [68,] 2.5851542 2.60390119 - [69,] 2.5753463 2.57142006 - [70,] 2.5830899 2.59128471 - [71,] 2.5506842 2.59161287 - [72,] 2.5705584 2.60867289 - [73,] 2.6164164 2.51108901 - [74,] 2.6039543 2.51108901 - [75,] 2.5624390 2.53916566 - [76,] 2.6090148 2.54238965 - [77,] 2.5924016 2.50579120 - [78,] 2.5745457 2.52409212 - [79,] 2.5692953 2.54383356 - [80,] 2.5903091 2.46101143 - [81,] 2.5406280 2.53078583 - [82,] 2.5617508 2.51070713 - [83,] 2.5601185 2.54737241 - [84,] 2.5601185 2.55038181 - [85,] 2.6328474 2.55038181 - [86,] 2.5727807 2.51797753 - [87,] 2.5863014 2.52767713 - [88,] 2.5863014 2.64509802 - [89,] 2.5588771 2.58722124 - [90,] 2.6015658 2.62337279 - [91,] 2.5853711 2.58967620 - [92,] 2.5902868 2.57906250 - [93,] 2.6026205 2.57247967 - [94,] 2.5728193 2.55657894 - [95,] 2.5945054 2.57900815 - [96,] 2.5775038 2.57900815 - [97,] 2.5628471 2.56462276 - [98,] 2.5550181 2.58634943 - [99,] 2.5387887 2.57886932 - [100,] 2.5839336 2.64432448 - [101,] 2.5608994 2.64432448 - [102,] 2.5608994 2.64432448 - [103,] 2.5197702 2.63266667 - [104,] 2.5453009 2.60768988 - [105,] 2.5571783 2.58848801 - [106,] 2.5571783 2.60378208 - [107,] 2.5437759 2.61439815 - [108,] 2.5264950 2.61439815 - [109,] 2.5786944 2.60354954 - [110,] 2.5192842 2.57956176 - [111,] 2.5855590 2.54271608 - [112,] 2.5708815 2.57635102 - [113,] 2.6179170 2.59300457 - [114,] 2.5912490 2.59300457 - [115,] 2.6518160 2.64001290 - [116,] 2.6129384 2.62410505 - [117,] 2.6053049 2.62410505 - [118,] 2.6108429 2.60406324 - [119,] 2.6108429 2.60170945 - [120,] 2.5892643 2.65228556 - [121,] 2.5760371 2.66037106 - [122,] 2.5949679 2.65748743 - [123,] 2.5868248 2.52654359 - [124,] 2.5889597 2.58929485 - [125,] 2.5746379 2.58895995 - [126,] 2.5746379 2.58895995 - [127,] 2.5692112 2.58465737 - [128,] 2.5643023 2.57945761 - [129,] 2.5719361 2.59637919 - [130,] 2.5650963 2.57026577 - [131,] 2.5661195 2.57026577 - [132,] 2.6607563 2.55616209 - [133,] 2.6529483 2.53663292 - [134,] 2.5451894 2.56829950 - [135,] 2.6487055 2.58264249 - [136,] 2.6693593 2.58264249 - [137,] 2.6693593 2.59743544 - [138,] 2.6462556 2.56032657 - [139,] 2.6395218 2.72451645 - [140,] 2.6246349 2.66625307 - [141,] 2.5471188 2.64053575 - [142,] 2.5471188 2.64053575 - [143,] 2.6022682 2.65425003 - [144,] 2.6362144 2.55932195 - [145,] 2.6495739 2.55141783 - [146,] 2.5869525 2.55973325 - [147,] 2.5869525 2.57855288 - [148,] 2.5517652 2.57750928 - [149,] 2.5635168 2.51525553 - [150,] 2.6072529 2.51525553 - [151,] 2.6026535 2.58641417 - [152,] 2.6108639 2.58005866 - [153,] 2.5738658 2.59752785 - [154,] 2.6274517 2.57571530 - [155,] 2.5624235 2.53395667 - [156,] 2.5893092 2.55176269 - [157,] 2.6239206 2.58371298 - [158,] 2.6174929 2.58400486 - [159,] 2.5652406 2.49878739 - [160,] 2.5592215 2.50515682 - [161,] 2.5359137 2.59495196 - [162,] 2.6108789 2.61813748 - [163,] 2.5813530 2.56666888 - [164,] 2.6924856 2.58778500 - [165,] 2.6842371 2.59293739 - [166,] 2.6780750 2.56420343 - [167,] 2.6540373 2.66806398 - [168,] 2.6284346 2.65661054 - [169,] 2.6023534 2.60724302 - [170,] 2.6003533 2.59107675 - [171,] 2.6562276 2.61562789 - [172,] 2.6302095 2.61524770 - [173,] 2.6242684 2.56006863 - [174,] 2.6262962 2.53824443 - [175,] 2.6140343 2.58149379 - [176,] 2.5053982 2.65969152 - [177,] 2.5009699 2.65551036 - [178,] 2.5221935 2.61558586 - [179,] 2.5168509 2.61633701 - [180,] 2.5950728 2.55876449 - [181,] 2.5312176 2.59648368 - [182,] 2.5726584 2.56837705 - [183,] 2.5458282 2.49114259 - [184,] 2.5730572 2.65484632 - [185,] 2.5606629 2.67748860 - [186,] 2.5907071 2.64796649 - [187,] 2.5927547 2.52620660 - [188,] 2.5601792 2.62877656 - [189,] 2.5727967 2.64850722 - [190,] 2.5983835 2.65790474 - [191,] 2.4813937 2.52625571 - [192,] 2.6036127 2.52884196 - [193,] 2.5885952 2.51274002 - [194,] 2.5520117 2.56344706 - [195,] 2.5636999 2.57067172 - [196,] 2.6369847 2.58294784 - [197,] 2.6448721 2.54770597 - [198,] 2.6288409 2.53225521 - [199,] 2.6521144 2.60165417 - [200,] 2.6282896 2.61501565 - [201,] 2.6383179 2.57017545 - [202,] 2.6139381 2.57781889 - [203,] 2.5917590 2.62368541 - [204,] 2.5636095 2.62012460 - [205,] 2.5968832 2.58324460 - [206,] 2.6504145 2.57674870 - [207,] 2.6502914 2.58361456 - [208,] 2.6092198 2.62523339 - [209,] 2.6029317 2.57545746 - [210,] 2.5445895 2.59111297 - [211,] 2.5569548 2.59761967 - [212,] 2.5277546 2.53254502 - [213,] 2.5678958 2.64469780 - [214,] 2.6314286 2.60540510 - [215,] 2.6835406 2.57157074 - [216,] 2.5771329 2.61310809 - [217,] 2.6355857 2.61870110 - [218,] 2.5898256 2.60713777 - [219,] 2.5967664 2.61336304 - [220,] 2.5485953 2.63703643 - [221,] 2.6513030 2.60998995 - [222,] 2.5403199 2.61832254 - [223,] 2.6304219 2.62593779 - [224,] 2.5324244 2.56730205 - [225,] 2.5860773 2.57663183 - [226,] 2.5750867 2.60804660 - [227,] 2.5749232 2.58744248 - [228,] 2.5522393 2.59920114 - [229,] 2.5690743 2.57871866 - [230,] 2.6041159 2.63819363 - [231,] 2.5759681 2.63581953 - [232,] 2.5843030 2.62379984 - [233,] 2.5593236 2.58790085 - [234,] 2.5314795 2.57429929 - [235,] 2.5614224 2.54770271 - [236,] 2.5683259 2.55264857 - [237,] 2.5122018 2.56447454 - [238,] 2.5084373 2.59770196 - [239,] 2.5462776 2.56680065 - [240,] 2.5743707 2.60734298 - [241,] 2.5732524 2.59480957 - [242,] 2.5551410 2.65091229 - [243,] 2.5594832 2.62284768 - [244,] 2.5760141 2.66364290 - [245,] 2.6488831 2.56953537 - [246,] 2.5761407 2.58986630 - [247,] 2.5297533 2.56006478 - [248,] 2.5741129 2.65487264 - [249,] 2.5984767 2.53615477 - [250,] 2.5821952 2.56695518 - [251,] 2.6877450 2.60909076 - [252,] 2.5696012 2.64922197 - [253,] 2.5328741 2.58212916 - [254,] 2.5680393 2.62379457 - [255,] 2.5564969 2.64322101 - [256,] 2.5458810 2.61878563 - [257,] 2.5499142 2.57756967 - [258,] 2.5668117 2.55332061 - [259,] 2.6372524 2.54288232 - [260,] 2.5826204 2.58015379 - [261,] 2.5870296 2.60491049 - [262,] 2.5462587 2.54948408 - [263,] 2.5868943 2.54970502 - [264,] 2.5946103 2.56551873 - [265,] 2.6229621 2.59079350 - [266,] 2.6889020 2.58310223 - [267,] 2.6064861 2.58755853 - [268,] 2.6191434 2.55138185 - [269,] 2.6489306 2.56249670 - [270,] 2.5128115 2.54709654 - [271,] 2.5526724 2.59530757 - [272,] 2.5311442 2.58186725 - [273,] 2.5382962 2.58199041 - [274,] 2.5944760 2.59794262 - [275,] 2.5503217 2.51396985 - [276,] 2.5938764 2.57264255 - [277,] 2.5244060 2.58228125 - [278,] 2.5858252 2.59374136 - [279,] 2.5974363 2.61713444 - [280,] 2.6458332 2.63324196 - [281,] 2.5997769 2.57528546 - [282,] 2.6319995 2.62863862 - [283,] 2.6332854 2.57795874 - [284,] 2.6435082 2.56430427 - [285,] 2.6841707 2.60381044 - [286,] 2.6491927 2.59087361 - [287,] 2.6567380 2.56958916 - [288,] 2.6230959 2.60312550 - [289,] 2.6500963 2.61438038 - [290,] 2.6277049 2.60872544 - [291,] 2.6155679 2.61971903 - [292,] 2.5849471 2.56171023 - [293,] 2.5676119 2.56390438 - [294,] 2.5751376 2.58744927 - [295,] 2.5780558 2.61021838 - [296,] 2.6212365 2.60925107 - [297,] 2.6034748 2.62523546 - [298,] 2.5764460 2.56700151 - [299,] 2.5414001 2.55966190 - [300,] 2.6330450 2.60509373 + , , chains = chain:2 - , , parameters = sigma + stats + parameter mean sd 2.5% 25% 50% + intercept -1.357058 0.53357524 -2.499695 -1.625619 -1.312808 + beta 2.595199 0.03579326 2.530471 2.572440 2.594828 + sigma 3.007820 0.21739144 2.632504 2.861515 2.986503 + lp__ -132.090898 1.20718746 -135.467340 -132.523345 -131.703494 + stats + parameter 75% 97.5% + intercept -0.9729786 -0.4627504 + beta 2.6145964 2.6705621 + sigma 3.1518017 3.5340329 + lp__ -131.2722826 -130.7969250 - chains - iterations chain:1 chain:2 - [1,] 6.775827 5.835427 - [2,] 6.775827 5.835427 - [3,] 6.775827 5.835427 - [4,] 6.775827 5.835427 - [5,] 8.158151 12.710050 - [6,] 9.704390 25.185230 - [7,] 12.790353 34.364226 - [8,] 15.281854 31.459854 - [9,] 15.281854 32.675439 - [10,] 12.161982 32.387294 - [11,] 10.391766 30.624549 - [12,] 6.004323 24.885935 - [13,] 5.751083 6.269539 - [14,] 5.387803 6.013417 - [15,] 5.387803 5.806927 - [16,] 4.607369 4.873370 - [17,] 4.598493 2.724348 - [18,] 3.890423 3.249951 - [19,] 3.633178 3.373173 - [20,] 3.132389 2.951481 - [21,] 3.129806 2.864356 - [22,] 2.969199 2.987058 - [23,] 3.045255 2.987058 - [24,] 3.031782 2.746688 - [25,] 3.000114 3.024253 - [26,] 2.775931 3.322087 - [27,] 3.256441 3.258903 - [28,] 3.003443 3.495690 - [29,] 3.212950 3.048460 - [30,] 3.116331 2.736991 - [31,] 2.943858 2.652705 - [32,] 2.980012 2.652705 - [33,] 2.940491 3.246394 - [34,] 2.940491 3.088576 - [35,] 2.828219 2.907566 - [36,] 2.932539 2.876219 - [37,] 3.125129 2.527342 - [38,] 3.337467 2.593469 - [39,] 2.700724 2.593469 - [40,] 2.992742 2.732445 - [41,] 3.057770 2.571116 - [42,] 2.556263 3.611578 - [43,] 2.774096 3.245212 - [44,] 2.676014 2.702779 - [45,] 2.676014 2.702779 - [46,] 2.716204 2.746279 - [47,] 3.047451 3.173287 - [48,] 2.895159 3.072415 - [49,] 2.908545 3.190016 - [50,] 2.997852 3.190016 - [51,] 2.720002 3.243894 - [52,] 3.168122 3.203870 - [53,] 3.291506 3.008897 - [54,] 3.479856 2.797723 - [55,] 3.247331 2.960573 - [56,] 3.003095 3.014112 - [57,] 3.153640 3.052508 - [58,] 2.804441 3.036250 - [59,] 2.776229 3.112721 - [60,] 2.903063 3.199106 - [61,] 2.903063 3.490244 - [62,] 2.883342 3.051423 - [63,] 2.760379 3.048914 - [64,] 2.817781 2.728795 - [65,] 2.849370 3.287022 - [66,] 2.849370 3.245842 - [67,] 3.076817 3.015647 - [68,] 3.257101 3.015647 - [69,] 2.827862 3.415490 - [70,] 2.968433 2.735717 - [71,] 2.828977 2.739391 - [72,] 3.092395 2.849899 - [73,] 3.145051 2.929918 - [74,] 3.153491 2.929918 - [75,] 2.724121 2.851372 - [76,] 3.273264 2.938912 - [77,] 3.108255 2.600864 - [78,] 2.807905 3.453393 - [79,] 2.648924 3.681664 - [80,] 3.010792 3.610682 - [81,] 3.115744 2.921567 - [82,] 2.795883 3.344768 - [83,] 2.804606 3.143237 - [84,] 2.804606 2.944839 - [85,] 3.199883 2.944839 - [86,] 3.155878 2.962572 - [87,] 2.885232 2.919582 - [88,] 2.885232 3.019495 - [89,] 2.964111 3.064384 - [90,] 2.993675 3.034019 - [91,] 2.947897 2.680521 - [92,] 3.115071 2.695767 - [93,] 3.253442 3.151802 - [94,] 3.269513 3.177539 - [95,] 2.570193 3.702877 - [96,] 3.274899 3.702877 - [97,] 3.264852 3.528658 - [98,] 2.625239 3.521650 - [99,] 3.352750 2.639510 - [100,] 3.088374 2.932791 - [101,] 3.324592 2.932791 - [102,] 3.324592 2.932791 - [103,] 2.673514 2.786498 - [104,] 3.121315 2.762251 - [105,] 2.930455 2.927772 - [106,] 2.930455 3.141844 - [107,] 2.728337 3.167922 - [108,] 2.634020 3.167922 - [109,] 3.274826 3.068000 - [110,] 3.058786 2.729329 - [111,] 2.862500 3.158065 - [112,] 3.109007 2.737915 - [113,] 2.603795 3.140956 - [114,] 2.718061 3.140956 - [115,] 2.835102 2.766709 - [116,] 3.024240 2.826925 - [117,] 3.210723 2.826925 - [118,] 3.012534 3.020479 - [119,] 3.012534 2.976920 - [120,] 3.004594 3.304216 - [121,] 2.952964 3.010294 - [122,] 2.995791 3.135744 - [123,] 2.806837 3.213161 - [124,] 3.135347 3.024314 - [125,] 2.786411 2.713966 - [126,] 2.786411 2.713966 - [127,] 2.993919 3.096675 - [128,] 3.045547 3.230478 - [129,] 2.934168 2.966149 - [130,] 3.284160 2.761228 - [131,] 2.854485 2.761228 - [132,] 2.933437 2.749480 - [133,] 3.324797 3.041253 - [134,] 2.615226 3.016409 - [135,] 3.539516 2.853328 - [136,] 3.118214 2.853328 - [137,] 3.118214 2.978184 - [138,] 3.646173 3.111370 - [139,] 3.509000 2.998760 - [140,] 3.011699 3.352794 - [141,] 2.788789 3.044409 - [142,] 2.788789 3.044409 - [143,] 3.127173 2.872692 - [144,] 3.020552 2.687982 - [145,] 3.067540 2.754055 - [146,] 2.873731 2.777296 - [147,] 2.873731 3.691320 - [148,] 2.998939 3.644894 - [149,] 3.079479 3.025895 - [150,] 2.699347 3.025895 - [151,] 3.083512 3.041997 - [152,] 2.712890 3.082615 - [153,] 3.073470 2.862825 - [154,] 2.748635 3.327438 - [155,] 3.151375 2.958231 - [156,] 3.170552 2.765620 - [157,] 2.985223 2.859241 - [158,] 2.927645 2.872533 - [159,] 3.172519 3.579266 - [160,] 2.819459 3.779555 - [161,] 2.523662 2.435191 - [162,] 3.110907 2.545234 - [163,] 3.166622 3.050300 - [164,] 2.835913 2.926432 - [165,] 2.802044 3.071751 - [166,] 2.748602 3.043719 - [167,] 3.215514 2.851991 - [168,] 3.005105 2.966452 - [169,] 3.109967 2.970146 - [170,] 3.185196 2.868938 - [171,] 2.754692 2.976527 - [172,] 3.096082 2.863400 - [173,] 3.122375 2.970630 - [174,] 2.887117 3.105444 - [175,] 3.020569 3.097770 - [176,] 2.915551 2.762153 - [177,] 2.989119 2.963461 - [178,] 3.185791 3.366843 - [179,] 3.126116 3.130680 - [180,] 2.868543 2.662409 - [181,] 3.096582 2.670396 - [182,] 3.171685 3.163446 - [183,] 3.551257 2.607065 - [184,] 2.778538 3.657670 - [185,] 3.017474 2.708258 - [186,] 3.785723 2.840314 - [187,] 3.436335 2.934726 - [188,] 3.324797 2.997520 - [189,] 3.093717 2.954872 - [190,] 2.907551 2.974793 - [191,] 3.071827 3.313449 - [192,] 2.946231 3.332686 - [193,] 2.966990 2.794848 - [194,] 2.818306 2.856031 - [195,] 3.029113 3.013936 - [196,] 2.812010 3.469402 - [197,] 2.972061 3.658853 - [198,] 2.848432 3.498406 - [199,] 3.036229 2.672733 - [200,] 2.961167 3.288682 - [201,] 3.189131 2.693223 - [202,] 2.929978 2.775014 - [203,] 3.006881 2.847557 - [204,] 2.783099 2.843794 - [205,] 2.972106 3.070086 - [206,] 2.810219 3.034310 - [207,] 3.074972 2.754176 - [208,] 3.225117 3.257981 - [209,] 2.956734 2.691602 - [210,] 3.187270 2.889561 - [211,] 3.003311 2.996240 - [212,] 2.834809 3.115716 - [213,] 2.941887 2.790838 - [214,] 3.120939 2.917470 - [215,] 2.882268 3.193824 - [216,] 2.797923 2.721431 - [217,] 2.893731 3.119256 - [218,] 3.092052 2.958659 - [219,] 2.998395 3.223931 - [220,] 2.944750 3.087999 - [221,] 3.005842 2.931047 - [222,] 2.962604 2.896828 - [223,] 3.317444 3.057952 - [224,] 2.845610 2.754436 - [225,] 3.225702 2.744288 - [226,] 3.031570 2.977023 - [227,] 2.319461 3.258938 - [228,] 2.640832 3.030314 - [229,] 2.790743 2.920766 - [230,] 3.216756 2.849626 - [231,] 3.275704 2.899668 - [232,] 3.056353 3.038278 - [233,] 2.823318 3.209892 - [234,] 3.093511 3.365951 - [235,] 2.984639 2.641312 - [236,] 3.088752 2.631305 - [237,] 2.909319 3.435168 - [238,] 3.215438 2.633716 - [239,] 2.821890 3.101262 - [240,] 3.090493 2.793258 - [241,] 3.075982 2.809946 - [242,] 3.356094 3.112909 - [243,] 3.174470 3.110115 - [244,] 3.063974 2.802827 - [245,] 2.956059 2.772665 - [246,] 2.939415 2.873114 - [247,] 3.099757 2.911835 - [248,] 2.981226 3.021396 - [249,] 3.021821 2.719713 - [250,] 2.949820 2.803165 - [251,] 3.032174 2.860706 - [252,] 2.921450 2.831697 - [253,] 2.871542 3.198628 - [254,] 3.457403 2.910343 - [255,] 2.622457 2.970789 - [256,] 2.732344 2.796246 - [257,] 2.755039 2.684639 - [258,] 3.177546 2.874004 - [259,] 2.917044 2.845009 - [260,] 2.652548 3.108171 - [261,] 2.954681 3.330169 - [262,] 3.475695 2.808017 - [263,] 2.673799 2.793513 - [264,] 2.685875 3.241943 - [265,] 3.371118 3.115829 - [266,] 2.897266 3.056222 - [267,] 2.971807 3.163098 - [268,] 2.983366 3.076143 - [269,] 3.141226 3.052438 - [270,] 2.779441 2.829590 - [271,] 2.959404 2.740409 - [272,] 3.122082 2.817324 - [273,] 3.180337 2.621223 - [274,] 3.097191 2.684313 - [275,] 2.907623 2.417001 - [276,] 3.044365 2.941535 - [277,] 2.907730 2.839779 - [278,] 2.824132 2.850704 - [279,] 3.032214 2.902176 - [280,] 2.997555 3.078273 - [281,] 2.935306 2.956583 - [282,] 2.980398 3.052259 - [283,] 2.624956 3.053245 - [284,] 2.949816 3.189120 - [285,] 3.034996 3.211667 - [286,] 2.923807 3.437305 - [287,] 2.950324 3.104878 - [288,] 3.017221 3.161632 - [289,] 2.847935 3.078584 - [290,] 3.418551 2.788055 - [291,] 3.137329 2.956750 - [292,] 2.749247 2.838892 - [293,] 2.876079 2.837033 - [294,] 2.770918 2.940584 - [295,] 2.977653 3.005454 - [296,] 2.988277 2.973165 - [297,] 2.975209 2.937586 - [298,] 2.926338 3.057107 - [299,] 3.207598 3.018623 - [300,] 2.737759 2.958645 - - , , parameters = lp__ - - chains - iterations chain:1 chain:2 - [1,] -743.2801 -2488.7849 - [2,] -743.2801 -2488.7849 - [3,] -743.2801 -2488.7849 - [4,] -743.2801 -2488.7849 - [5,] -527.4071 -601.5346 - [6,] -394.8411 -339.8975 - [7,] -299.5402 -325.5746 - [8,] -265.0409 -323.2175 - [9,] -265.0409 -321.1350 - [10,] -225.4752 -319.8802 - [11,] -197.9704 -311.2151 - [12,] -159.2210 -293.0449 - [13,] -157.5327 -187.1929 - [14,] -152.3802 -161.5488 - [15,] -152.3802 -158.2674 - [16,] -143.8853 -148.5864 - [17,] -144.5270 -136.0577 - [18,] -141.0412 -134.3923 - [19,] -135.0137 -134.4668 - [20,] -131.9658 -133.9766 - [21,] -132.3748 -134.4092 - [22,] -132.4422 -134.0129 - [23,] -134.2144 -134.0129 - [24,] -133.0770 -135.2081 - [25,] -132.3637 -134.0929 - [26,] -133.6160 -132.4603 - [27,] -133.8395 -132.2677 - [28,] -133.0552 -133.4295 - [29,] -132.7538 -132.1662 - [30,] -132.3326 -131.6847 - [31,] -130.8442 -132.2553 - [32,] -130.8533 -132.2553 - [33,] -130.8048 -131.7822 - [34,] -130.8048 -131.2992 - [35,] -131.0112 -131.0026 - [36,] -131.1676 -131.2562 - [37,] -131.4742 -133.0943 - [38,] -132.1360 -132.3802 - [39,] -131.6040 -132.3802 - [40,] -131.2690 -131.5517 - [41,] -130.8927 -132.5069 - [42,] -132.9756 -134.2816 - [43,] -133.3254 -131.7650 - [44,] -132.9660 -131.4663 - [45,] -132.9660 -131.4663 - [46,] -132.7499 -131.4815 - [47,] -132.1738 -132.2929 - [48,] -131.4649 -132.3371 - [49,] -131.8896 -131.9475 - [50,] -131.7045 -131.9475 - [51,] -135.0347 -131.9109 - [52,] -133.9287 -131.3978 - [53,] -135.0904 -130.7675 - [54,] -133.5139 -130.8987 - [55,] -132.4913 -130.7568 - [56,] -131.8737 -133.2213 - [57,] -132.1853 -132.7046 - [58,] -132.0369 -133.0235 - [59,] -132.3363 -132.7234 - [60,] -131.9071 -133.4516 - [61,] -131.9071 -133.1721 - [62,] -131.1659 -133.0249 - [63,] -131.6120 -130.9920 - [64,] -131.8081 -132.6942 - [65,] -131.0230 -131.8779 - [66,] -131.0230 -131.9821 - [67,] -131.5843 -130.9805 - [68,] -131.8916 -130.9805 - [69,] -130.9531 -132.6249 - [70,] -130.7576 -132.0185 - [71,] -131.9412 -131.0846 - [72,] -131.0995 -131.1948 - [73,] -132.3505 -132.7981 - [74,] -131.6374 -132.7981 - [75,] -131.4591 -133.2745 - [76,] -132.2171 -132.4603 - [77,] -131.7234 -134.7511 - [78,] -131.2101 -135.1428 - [79,] -131.9131 -137.4080 - [80,] -131.5657 -137.3102 - [81,] -131.7432 -132.4700 - [82,] -131.3066 -133.5594 - [83,] -131.2849 -133.1160 - [84,] -131.2849 -131.5971 - [85,] -131.9074 -131.5971 - [86,] -131.2426 -132.3505 - [87,] -130.7211 -131.8987 - [88,] -130.7211 -131.6233 - [89,] -131.5285 -133.3994 - [90,] -131.2945 -131.4915 - [91,] -130.7068 -131.9090 - [92,] -131.0051 -131.5060 - [93,] -131.8173 -131.2939 - [94,] -131.8229 -131.5812 - [95,] -132.5942 -134.6712 - [96,] -131.7799 -134.6712 - [97,] -131.7979 -133.4329 - [98,] -132.2477 -133.3044 - [99,] -132.8164 -132.0743 - [100,] -131.4997 -133.0385 - [101,] -132.9237 -133.0385 - [102,] -132.9237 -133.0385 - [103,] -133.2688 -131.9523 - [104,] -131.9380 -131.7142 - [105,] -131.4210 -130.7064 - [106,] -131.4210 -131.1323 - [107,] -131.9897 -131.3373 - [108,] -133.3860 -131.3373 - [109,] -131.6962 -130.9167 - [110,] -132.3068 -131.2627 - [111,] -134.6598 -132.1185 - [112,] -131.2022 -131.7238 - [113,] -133.2687 -131.0844 - [114,] -133.6664 -131.0844 - [115,] -132.0108 -132.1938 - [116,] -131.2840 -131.1691 - [117,] -131.6439 -131.1691 - [118,] -131.0159 -130.9807 - [119,] -131.0159 -130.8161 - [120,] -130.8101 -132.9012 - [121,] -131.6947 -132.1574 - [122,] -131.2908 -132.2695 - [123,] -132.2789 -132.4903 - [124,] -131.4318 -131.8767 - [125,] -131.3766 -131.5787 - [126,] -131.3766 -131.5787 - [127,] -131.2243 -131.3633 - [128,] -131.0921 -131.4963 - [129,] -131.3291 -130.8325 - [130,] -132.5657 -131.2487 - [131,] -131.1740 -131.2487 - [132,] -132.1947 -131.9020 - [133,] -132.8445 -131.6862 - [134,] -132.7188 -130.9309 - [135,] -134.3205 -130.7746 - [136,] -132.9854 -130.7746 - [137,] -132.9854 -130.9862 - [138,] -134.7663 -131.2728 - [139,] -133.6152 -136.9228 - [140,] -131.9770 -133.4350 - [141,] -132.2414 -132.1105 - [142,] -132.2414 -132.1105 - [143,] -131.1656 -132.5887 - [144,] -131.5197 -131.8846 - [145,] -132.7673 -132.9505 - [146,] -130.9141 -132.8721 - [147,] -130.9141 -134.7537 - [148,] -131.3166 -134.6020 - [149,] -131.5360 -133.3143 - [150,] -131.3803 -133.3143 - [151,] -130.9480 -132.3143 - [152,] -131.3770 -131.6141 - [153,] -131.0819 -131.1334 - [154,] -131.9842 -131.9893 - [155,] -131.3279 -133.8598 - [156,] -131.4321 -132.5670 - [157,] -131.6770 -131.1559 - [158,] -130.9215 -130.8418 - [159,] -131.4687 -135.3523 - [160,] -131.5420 -136.7421 - [161,] -133.9481 -134.1794 - [162,] -131.1364 -134.2612 - [163,] -131.3877 -132.3890 - [164,] -134.6131 -130.8209 - [165,] -134.1269 -130.9546 - [166,] -134.6068 -131.0960 - [167,] -132.7456 -132.8686 - [168,] -133.8296 -132.5689 - [169,] -132.6875 -131.8167 - [170,] -132.4285 -131.2561 - [171,] -132.5813 -131.3205 - [172,] -132.7327 -130.9690 - [173,] -131.6482 -131.6085 - [174,] -132.0031 -131.8076 - [175,] -132.9988 -131.3161 - [176,] -132.9456 -132.6162 - [177,] -133.3854 -131.9949 - [178,] -132.4744 -134.1734 - [179,] -132.5206 -131.8036 - [180,] -132.9129 -131.8755 - [181,] -132.3795 -131.6812 - [182,] -132.2494 -131.4205 - [183,] -133.9072 -136.2476 - [184,] -131.1200 -135.6322 - [185,] -131.4059 -134.8258 - [186,] -135.4102 -133.4310 - [187,] -132.9148 -132.0469 - [188,] -132.5551 -132.4925 - [189,] -131.1396 -131.7204 - [190,] -133.4899 -132.9150 - [191,] -136.7552 -133.5216 - [192,] -133.8707 -132.8585 - [193,] -130.9648 -133.3967 - [194,] -131.6361 -131.0915 - [195,] -132.0475 -130.8742 - [196,] -131.5624 -132.8652 - [197,] -132.1314 -134.9106 - [198,] -131.7582 -133.7574 - [199,] -132.1230 -131.9154 - [200,] -131.1705 -132.0891 - [201,] -131.8664 -131.5129 - [202,] -131.3095 -131.0654 - [203,] -132.7517 -131.2750 - [204,] -131.4382 -131.1106 - [205,] -130.9520 -130.9119 - [206,] -132.0317 -130.9175 - [207,] -131.9088 -131.0485 - [208,] -132.8727 -132.0183 - [209,] -132.7376 -132.5033 - [210,] -133.1271 -131.3535 - [211,] -131.1373 -130.7559 - [212,] -132.2570 -132.0070 - [213,] -130.9251 -132.0434 - [214,] -131.8918 -131.1704 - [215,] -133.6581 -131.6638 - [216,] -132.5306 -131.8595 - [217,] -132.2072 -132.3849 - [218,] -131.5562 -133.6370 - [219,] -131.2336 -131.5580 - [220,] -132.9703 -131.7871 - [221,] -131.8349 -131.0750 - [222,] -133.4104 -131.5623 - [223,] -133.3680 -131.7709 - [224,] -132.5513 -131.3721 - [225,] -131.4359 -131.1314 - [226,] -130.9690 -130.8890 - [227,] -136.3459 -131.6816 - [228,] -132.2521 -130.8835 - [229,] -131.5603 -131.4110 - [230,] -131.4648 -131.5526 - [231,] -132.9554 -132.0330 - [232,] -130.9645 -131.7919 - [233,] -131.1694 -132.0847 - [234,] -131.8787 -132.2522 - [235,] -130.9725 -132.4589 - [236,] -131.9113 -132.6991 - [237,] -133.3490 -132.9755 - [238,] -133.4509 -132.8302 - [239,] -131.4506 -132.4073 - [240,] -131.0071 -131.2473 - [241,] -130.9697 -132.2752 - [242,] -132.4738 -132.9437 - [243,] -131.5503 -133.2296 - [244,] -130.9203 -134.1297 - [245,] -131.8391 -133.4012 - [246,] -131.0946 -133.1165 - [247,] -131.9656 -132.0938 - [248,] -132.7887 -134.4651 - [249,] -130.8155 -135.8392 - [250,] -131.3125 -132.0819 - [251,] -133.7617 -131.0283 - [252,] -130.8594 -132.3337 - [253,] -132.4530 -132.8057 - [254,] -132.8772 -131.8437 - [255,] -133.6690 -131.5327 - [256,] -132.3561 -131.2341 - [257,] -132.0540 -131.6539 - [258,] -131.3737 -131.4623 - [259,] -131.5092 -131.9690 - [260,] -131.8299 -131.0583 - [261,] -130.8497 -132.0017 - [262,] -133.3744 -131.4379 - [263,] -131.5743 -131.7412 - [264,] -131.4235 -131.6846 - [265,] -135.6487 -131.0174 - [266,] -134.0447 -130.8608 - [267,] -132.3104 -131.6627 - [268,] -131.4937 -132.4746 - [269,] -132.1904 -131.7272 - [270,] -133.2231 -131.7019 - [271,] -135.4232 -131.2461 - [272,] -132.3702 -130.8582 - [273,] -132.6355 -131.9435 - [274,] -133.2769 -132.0818 - [275,] -131.2706 -137.1655 - [276,] -130.8263 -133.5572 - [277,] -132.0401 -132.0178 - [278,] -131.0649 -131.0361 - [279,] -130.9698 -130.9351 - [280,] -132.2183 -131.3926 - [281,] -130.9926 -130.9497 - [282,] -131.4955 -131.2803 - [283,] -133.7377 -130.9903 - [284,] -131.6260 -131.4761 - [285,] -134.8487 -131.6483 - [286,] -132.4667 -132.6127 - [287,] -132.2145 -131.0853 - [288,] -131.1595 -131.2032 - [289,] -131.9923 -131.3069 - [290,] -132.8106 -131.5033 - [291,] -131.2946 -131.1310 - [292,] -131.0869 -131.6357 - [293,] -130.8911 -131.4271 - [294,] -131.3916 -130.9938 - [295,] -130.7877 -130.8850 - [296,] -131.6616 -130.8594 - [297,] -132.1440 -131.2231 - [298,] -130.9577 -131.0051 - [299,] -132.6994 -131.0769 - [300,] -131.8671 -130.8533 +# Execution and output: Constant single individual + + Code + samps_const_single_ind_summary$summary + Output + mean se_mean sd 2.5% 25% + ind_y_0 7.358804 0.2328756 2.386354 2.315122 5.8741147 + ind_beta 1.923820 0.1680025 2.026449 0.219740 0.6265187 + global_error_sigma 5.958811 0.1562542 1.922463 3.566097 4.5866965 + y_hat[1] 7.358804 0.2328756 2.386354 2.315122 5.8741147 + y_hat[2] 7.358804 0.2328756 2.386354 2.315122 5.8741147 + y_hat[3] 7.358804 0.2328756 2.386354 2.315122 5.8741147 + y_hat[4] 7.358804 0.2328756 2.386354 2.315122 5.8741147 + y_hat[5] 7.358804 0.2328756 2.386354 2.315122 5.8741147 + y_hat[6] 7.358804 0.2328756 2.386354 2.315122 5.8741147 + y_hat[7] 7.358804 0.2328756 2.386354 2.315122 5.8741147 + Delta_hat[1] 1.923820 0.1680025 2.026449 0.219740 0.6265187 + Delta_hat[2] 1.923820 0.1680025 2.026449 0.219740 0.6265187 + Delta_hat[3] 1.923820 0.1680025 2.026449 0.219740 0.6265187 + Delta_hat[4] 1.923820 0.1680025 2.026449 0.219740 0.6265187 + Delta_hat[5] 1.923820 0.1680025 2.026449 0.219740 0.6265187 + Delta_hat[6] 1.923820 0.1680025 2.026449 0.219740 0.6265187 + Delta_hat[7] 1.923820 0.1680025 2.026449 0.219740 0.6265187 + lp__ -19.797551 0.2132444 1.583059 -24.284682 -20.3650430 + 50% 75% 97.5% n_eff Rhat + ind_y_0 7.254472 9.024677 12.339784 105.00786 1.008202 + ind_beta 1.195820 2.507095 7.538531 145.49221 1.014566 + global_error_sigma 5.633287 6.794960 10.799515 151.37444 1.014957 + y_hat[1] 7.254472 9.024677 12.339784 105.00786 1.008202 + y_hat[2] 7.254472 9.024677 12.339784 105.00786 1.008202 + y_hat[3] 7.254472 9.024677 12.339784 105.00786 1.008202 + y_hat[4] 7.254472 9.024677 12.339784 105.00786 1.008202 + y_hat[5] 7.254472 9.024677 12.339784 105.00786 1.008202 + y_hat[6] 7.254472 9.024677 12.339784 105.00786 1.008202 + y_hat[7] 7.254472 9.024677 12.339784 105.00786 1.008202 + Delta_hat[1] 1.195820 2.507095 7.538531 145.49221 1.014566 + Delta_hat[2] 1.195820 2.507095 7.538531 145.49221 1.014566 + Delta_hat[3] 1.195820 2.507095 7.538531 145.49221 1.014566 + Delta_hat[4] 1.195820 2.507095 7.538531 145.49221 1.014566 + Delta_hat[5] 1.195820 2.507095 7.538531 145.49221 1.014566 + Delta_hat[6] 1.195820 2.507095 7.538531 145.49221 1.014566 + Delta_hat[7] 1.195820 2.507095 7.538531 145.49221 1.014566 + lp__ -19.340527 -18.711489 -18.078017 55.11108 1.047058 + +# Execution and output: Constant multiple individuals + + Code + samps_const_multi_ind_summary$summary + Output + mean se_mean sd 2.5% 25% + ind_y_0[1] 7.7866284 0.1596536 1.7642617 4.726875679 6.5471290 + ind_y_0[2] 7.3870989 0.2086682 1.9121981 4.157656797 6.1136647 + ind_beta[1] 14.3002702 10.5869338 127.5840040 0.050458630 0.5134200 + ind_beta[2] 30.8936054 24.2100069 358.6346730 0.007117891 0.5264034 + species_beta_mu 0.1859889 0.1448038 0.9564117 -1.874353900 -0.3954730 + species_beta_sigma 1.3221873 0.2144064 1.7844307 0.106573188 0.3253848 + global_error_sigma 5.3963422 0.1036388 1.1810112 3.824229718 4.5954115 + y_hat[1] 7.7866284 0.1596536 1.7642617 4.726875679 6.5471290 + y_hat[2] 7.7866284 0.1596536 1.7642617 4.726875679 6.5471290 + y_hat[3] 7.7866284 0.1596536 1.7642617 4.726875679 6.5471290 + y_hat[4] 7.7866284 0.1596536 1.7642617 4.726875679 6.5471290 + y_hat[5] 7.7866284 0.1596536 1.7642617 4.726875679 6.5471290 + y_hat[6] 7.7866284 0.1596536 1.7642617 4.726875679 6.5471290 + y_hat[7] 7.7866284 0.1596536 1.7642617 4.726875679 6.5471290 + y_hat[8] 7.3870989 0.2086682 1.9121981 4.157656797 6.1136647 + y_hat[9] 7.3870989 0.2086682 1.9121981 4.157656797 6.1136647 + y_hat[10] 7.3870989 0.2086682 1.9121981 4.157656797 6.1136647 + y_hat[11] 7.3870989 0.2086682 1.9121981 4.157656797 6.1136647 + y_hat[12] 7.3870989 0.2086682 1.9121981 4.157656797 6.1136647 + y_hat[13] 7.3870989 0.2086682 1.9121981 4.157656797 6.1136647 + y_hat[14] 7.3870989 0.2086682 1.9121981 4.157656797 6.1136647 + Delta_hat[1] 14.3002702 10.5869338 127.5840040 0.050458630 0.5134200 + Delta_hat[2] 14.3002702 10.5869338 127.5840040 0.050458630 0.5134200 + Delta_hat[3] 14.3002702 10.5869338 127.5840040 0.050458630 0.5134200 + Delta_hat[4] 14.3002702 10.5869338 127.5840040 0.050458630 0.5134200 + Delta_hat[5] 14.3002702 10.5869338 127.5840040 0.050458630 0.5134200 + Delta_hat[6] 14.3002702 10.5869338 127.5840040 0.050458630 0.5134200 + Delta_hat[7] 14.3002702 10.5869338 127.5840040 0.050458630 0.5134200 + Delta_hat[8] 30.8936054 24.2100069 358.6346730 0.007117891 0.5264034 + Delta_hat[9] 30.8936054 24.2100069 358.6346730 0.007117891 0.5264034 + Delta_hat[10] 30.8936054 24.2100069 358.6346730 0.007117891 0.5264034 + Delta_hat[11] 30.8936054 24.2100069 358.6346730 0.007117891 0.5264034 + Delta_hat[12] 30.8936054 24.2100069 358.6346730 0.007117891 0.5264034 + Delta_hat[13] 30.8936054 24.2100069 358.6346730 0.007117891 0.5264034 + Delta_hat[14] 30.8936054 24.2100069 358.6346730 0.007117891 0.5264034 + lp__ -36.5153202 0.4448961 2.7712183 -42.985148154 -38.1528988 + 50% 75% 97.5% n_eff Rhat + ind_y_0[1] 7.7218801 8.8116127 11.144262 122.11486 1.0177559 + ind_y_0[2] 7.3182034 8.6692967 11.591169 83.97566 1.0196933 + ind_beta[1] 1.3054505 2.5461624 33.683409 145.22857 1.0099968 + ind_beta[2] 1.3815216 3.1115172 25.882844 219.43946 1.0028366 + species_beta_mu 0.2806223 0.8070635 1.720115 43.62443 1.0784740 + species_beta_sigma 0.7914482 1.5508883 5.989298 69.26662 1.0148568 + global_error_sigma 5.1643894 5.9933941 8.417869 129.85633 0.9979336 + y_hat[1] 7.7218801 8.8116127 11.144262 122.11486 1.0177559 + y_hat[2] 7.7218801 8.8116127 11.144262 122.11486 1.0177559 + y_hat[3] 7.7218801 8.8116127 11.144262 122.11486 1.0177559 + y_hat[4] 7.7218801 8.8116127 11.144262 122.11486 1.0177559 + y_hat[5] 7.7218801 8.8116127 11.144262 122.11486 1.0177559 + y_hat[6] 7.7218801 8.8116127 11.144262 122.11486 1.0177559 + y_hat[7] 7.7218801 8.8116127 11.144262 122.11486 1.0177559 + y_hat[8] 7.3182034 8.6692967 11.591169 83.97566 1.0196933 + y_hat[9] 7.3182034 8.6692967 11.591169 83.97566 1.0196933 + y_hat[10] 7.3182034 8.6692967 11.591169 83.97566 1.0196933 + y_hat[11] 7.3182034 8.6692967 11.591169 83.97566 1.0196933 + y_hat[12] 7.3182034 8.6692967 11.591169 83.97566 1.0196933 + y_hat[13] 7.3182034 8.6692967 11.591169 83.97566 1.0196933 + y_hat[14] 7.3182034 8.6692967 11.591169 83.97566 1.0196933 + Delta_hat[1] 1.3054505 2.5461624 33.683409 145.22857 1.0099968 + Delta_hat[2] 1.3054505 2.5461624 33.683409 145.22857 1.0099968 + Delta_hat[3] 1.3054505 2.5461624 33.683409 145.22857 1.0099968 + Delta_hat[4] 1.3054505 2.5461624 33.683409 145.22857 1.0099968 + Delta_hat[5] 1.3054505 2.5461624 33.683409 145.22857 1.0099968 + Delta_hat[6] 1.3054505 2.5461624 33.683409 145.22857 1.0099968 + Delta_hat[7] 1.3054505 2.5461624 33.683409 145.22857 1.0099968 + Delta_hat[8] 1.3815216 3.1115172 25.882844 219.43946 1.0028366 + Delta_hat[9] 1.3815216 3.1115172 25.882844 219.43946 1.0028366 + Delta_hat[10] 1.3815216 3.1115172 25.882844 219.43946 1.0028366 + Delta_hat[11] 1.3815216 3.1115172 25.882844 219.43946 1.0028366 + Delta_hat[12] 1.3815216 3.1115172 25.882844 219.43946 1.0028366 + Delta_hat[13] 1.3815216 3.1115172 25.882844 219.43946 1.0028366 + Delta_hat[14] 1.3815216 3.1115172 25.882844 219.43946 1.0028366 + lp__ -36.1349743 -34.5239782 -31.903170 38.79934 1.0297805 + diff --git a/tests/testthat/test-rmot_models.R b/tests/testthat/test-rmot_models.R index 79627a5..9de8f3f 100644 --- a/tests/testthat/test-rmot_models.R +++ b/tests/testthat/test-rmot_models.R @@ -25,8 +25,8 @@ test_that("Execution and output: Linear", { rmot_run(chains = 2, iter = 300, verbose = FALSE, show_messages = FALSE) ) - samps_linear <- rstan::extract(lm_test, permuted=FALSE, inc_warmup=TRUE) - expect_snapshot(samps_linear) + samps_linear_summary <- rstan::summary(lm_test) + expect_snapshot(samps_linear_summary) expect_visible(lm_test) expect_s4_class(lm_test, "stanfit") }) @@ -34,8 +34,6 @@ test_that("Execution and output: Linear", { test_that("Execution and output: Constant single individual", { # Test constant single individual set.seed(2024) - true_single <- seq(from=1, by=2.5, length.out=7) - y_single <- true_single + true_single*rnorm(n=7, 0, 0.02) + rnorm(n=7, 0, 0.2) suppressWarnings( #Suppresses stan warnings constant_single_ind_test <- rmot_model("constant_single_ind") |> @@ -48,9 +46,8 @@ test_that("Execution and output: Constant single individual", { rmot_run(chains = 2, iter = 300, verbose = FALSE, show_messages = FALSE) ) - samps_const_single_ind <- rstan::extract(constant_single_ind_test, - permuted=FALSE, inc_warmup=TRUE) - expect_snapshot(samps_const_single_ind) + samps_const_single_ind_summary <- rstan::summary(constant_single_ind_test) + expect_snapshot(samps_const_single_ind_summary$summary) expect_visible(constant_single_ind_test) expect_s4_class(constant_single_ind_test, "stanfit") @@ -59,9 +56,6 @@ test_that("Execution and output: Constant single individual", { test_that("Execution and output: Constant multiple individuals", { # Test constant multi-individual set.seed(2024) - true_multi <- c(seq(from=1, by=2.5, length.out=7), - seq(from=2, by=2, length.out=7)) - y_multi <- true_multi + true_multi*rnorm(n=14, 0, 0.02) + rnorm(n=14, 0, 0.2) suppressWarnings( #Suppresses stan warnings constant_multi_ind_test <- rmot_model("constant_multi_ind") |> @@ -76,9 +70,8 @@ test_that("Execution and output: Constant multiple individuals", { rmot_run(chains = 2, iter = 300, verbose = FALSE, show_messages = FALSE) ) - samps_const_multi_ind <- rstan::extract(constant_multi_ind_test, - permuted=FALSE, inc_warmup=TRUE) - expect_snapshot(samps_const_multi_ind) + samps_const_multi_ind_summary <- rstan::summary(constant_multi_ind_test) + expect_snapshot(samps_const_multi_ind_summary$summary) expect_visible(constant_multi_ind_test) expect_s4_class(constant_multi_ind_test, "stanfit") })