// Code generated by Stan version 2.21.0

#include <stan/model/model_header.hpp>

namespace model38fc550b12d5_55224dc507bf960ddf26a5f40c493659_namespace {

using std::istream;
using std::string;
using std::stringstream;
using std::vector;
using stan::io::dump;
using stan::math::lgamma;
using stan::model::prob_grad;
using namespace stan::math;

static int current_statement_begin__;

stan::io::program_reader prog_reader__() {
    stan::io::program_reader reader;
    reader.add_event(0, 0, "start", "model38fc550b12d5_55224dc507bf960ddf26a5f40c493659");
    reader.add_event(101, 99, "end", "model38fc550b12d5_55224dc507bf960ddf26a5f40c493659");
    return reader;
}

class model38fc550b12d5_55224dc507bf960ddf26a5f40c493659
  : public stan::model::model_base_crtp<model38fc550b12d5_55224dc507bf960ddf26a5f40c493659> {
private:
        int N;
        int N_mpg;
        vector_d Y_mpg;
        int K_mpg;
        matrix_d X_mpg;
        int K_sigma_mpg;
        matrix_d X_sigma_mpg;
        int N_wt;
        vector_d Y_wt;
        int K_wt;
        matrix_d X_wt;
        int K_sigma_wt;
        matrix_d X_sigma_wt;
        int prior_only;
        int Kc_mpg;
        matrix_d Xc_mpg;
        vector_d means_X_mpg;
        int Kc_sigma_mpg;
        matrix_d Xc_sigma_mpg;
        vector_d means_X_sigma_mpg;
        int Kc_wt;
        matrix_d Xc_wt;
        vector_d means_X_wt;
        int Kc_sigma_wt;
        matrix_d Xc_sigma_wt;
        vector_d means_X_sigma_wt;
public:
    model38fc550b12d5_55224dc507bf960ddf26a5f40c493659(stan::io::var_context& context__,
        std::ostream* pstream__ = 0)
        : model_base_crtp(0) {
        ctor_body(context__, 0, pstream__);
    }

    model38fc550b12d5_55224dc507bf960ddf26a5f40c493659(stan::io::var_context& context__,
        unsigned int random_seed__,
        std::ostream* pstream__ = 0)
        : model_base_crtp(0) {
        ctor_body(context__, random_seed__, pstream__);
    }

    void ctor_body(stan::io::var_context& context__,
                   unsigned int random_seed__,
                   std::ostream* pstream__) {
        typedef double local_scalar_t__;

        boost::ecuyer1988 base_rng__ =
          stan::services::util::create_rng(random_seed__, 0);
        (void) base_rng__;  // suppress unused var warning

        current_statement_begin__ = -1;

        static const char* function__ = "model38fc550b12d5_55224dc507bf960ddf26a5f40c493659_namespace::model38fc550b12d5_55224dc507bf960ddf26a5f40c493659";
        (void) function__;  // dummy to suppress unused var warning
        size_t pos__;
        (void) pos__;  // dummy to suppress unused var warning
        std::vector<int> vals_i__;
        std::vector<double> vals_r__;
        local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
        (void) DUMMY_VAR__;  // suppress unused var warning

        try {
            // initialize data block variables from context__
            current_statement_begin__ = 5;
            context__.validate_dims("data initialization", "N", "int", context__.to_vec());
            N = int(0);
            vals_i__ = context__.vals_i("N");
            pos__ = 0;
            N = vals_i__[pos__++];
            check_greater_or_equal(function__, "N", N, 1);

            current_statement_begin__ = 6;
            context__.validate_dims("data initialization", "N_mpg", "int", context__.to_vec());
            N_mpg = int(0);
            vals_i__ = context__.vals_i("N_mpg");
            pos__ = 0;
            N_mpg = vals_i__[pos__++];
            check_greater_or_equal(function__, "N_mpg", N_mpg, 1);

            current_statement_begin__ = 7;
            validate_non_negative_index("Y_mpg", "N_mpg", N_mpg);
            context__.validate_dims("data initialization", "Y_mpg", "vector_d", context__.to_vec(N_mpg));
            Y_mpg = Eigen::Matrix<double, Eigen::Dynamic, 1>(N_mpg);
            vals_r__ = context__.vals_r("Y_mpg");
            pos__ = 0;
            size_t Y_mpg_j_1_max__ = N_mpg;
            for (size_t j_1__ = 0; j_1__ < Y_mpg_j_1_max__; ++j_1__) {
                Y_mpg(j_1__) = vals_r__[pos__++];
            }

            current_statement_begin__ = 8;
            context__.validate_dims("data initialization", "K_mpg", "int", context__.to_vec());
            K_mpg = int(0);
            vals_i__ = context__.vals_i("K_mpg");
            pos__ = 0;
            K_mpg = vals_i__[pos__++];
            check_greater_or_equal(function__, "K_mpg", K_mpg, 1);

            current_statement_begin__ = 9;
            validate_non_negative_index("X_mpg", "N_mpg", N_mpg);
            validate_non_negative_index("X_mpg", "K_mpg", K_mpg);
            context__.validate_dims("data initialization", "X_mpg", "matrix_d", context__.to_vec(N_mpg,K_mpg));
            X_mpg = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>(N_mpg, K_mpg);
            vals_r__ = context__.vals_r("X_mpg");
            pos__ = 0;
            size_t X_mpg_j_2_max__ = K_mpg;
            size_t X_mpg_j_1_max__ = N_mpg;
            for (size_t j_2__ = 0; j_2__ < X_mpg_j_2_max__; ++j_2__) {
                for (size_t j_1__ = 0; j_1__ < X_mpg_j_1_max__; ++j_1__) {
                    X_mpg(j_1__, j_2__) = vals_r__[pos__++];
                }
            }

            current_statement_begin__ = 10;
            context__.validate_dims("data initialization", "K_sigma_mpg", "int", context__.to_vec());
            K_sigma_mpg = int(0);
            vals_i__ = context__.vals_i("K_sigma_mpg");
            pos__ = 0;
            K_sigma_mpg = vals_i__[pos__++];
            check_greater_or_equal(function__, "K_sigma_mpg", K_sigma_mpg, 1);

            current_statement_begin__ = 11;
            validate_non_negative_index("X_sigma_mpg", "N_mpg", N_mpg);
            validate_non_negative_index("X_sigma_mpg", "K_sigma_mpg", K_sigma_mpg);
            context__.validate_dims("data initialization", "X_sigma_mpg", "matrix_d", context__.to_vec(N_mpg,K_sigma_mpg));
            X_sigma_mpg = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>(N_mpg, K_sigma_mpg);
            vals_r__ = context__.vals_r("X_sigma_mpg");
            pos__ = 0;
            size_t X_sigma_mpg_j_2_max__ = K_sigma_mpg;
            size_t X_sigma_mpg_j_1_max__ = N_mpg;
            for (size_t j_2__ = 0; j_2__ < X_sigma_mpg_j_2_max__; ++j_2__) {
                for (size_t j_1__ = 0; j_1__ < X_sigma_mpg_j_1_max__; ++j_1__) {
                    X_sigma_mpg(j_1__, j_2__) = vals_r__[pos__++];
                }
            }

            current_statement_begin__ = 12;
            context__.validate_dims("data initialization", "N_wt", "int", context__.to_vec());
            N_wt = int(0);
            vals_i__ = context__.vals_i("N_wt");
            pos__ = 0;
            N_wt = vals_i__[pos__++];
            check_greater_or_equal(function__, "N_wt", N_wt, 1);

            current_statement_begin__ = 13;
            validate_non_negative_index("Y_wt", "N_wt", N_wt);
            context__.validate_dims("data initialization", "Y_wt", "vector_d", context__.to_vec(N_wt));
            Y_wt = Eigen::Matrix<double, Eigen::Dynamic, 1>(N_wt);
            vals_r__ = context__.vals_r("Y_wt");
            pos__ = 0;
            size_t Y_wt_j_1_max__ = N_wt;
            for (size_t j_1__ = 0; j_1__ < Y_wt_j_1_max__; ++j_1__) {
                Y_wt(j_1__) = vals_r__[pos__++];
            }

            current_statement_begin__ = 14;
            context__.validate_dims("data initialization", "K_wt", "int", context__.to_vec());
            K_wt = int(0);
            vals_i__ = context__.vals_i("K_wt");
            pos__ = 0;
            K_wt = vals_i__[pos__++];
            check_greater_or_equal(function__, "K_wt", K_wt, 1);

            current_statement_begin__ = 15;
            validate_non_negative_index("X_wt", "N_wt", N_wt);
            validate_non_negative_index("X_wt", "K_wt", K_wt);
            context__.validate_dims("data initialization", "X_wt", "matrix_d", context__.to_vec(N_wt,K_wt));
            X_wt = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>(N_wt, K_wt);
            vals_r__ = context__.vals_r("X_wt");
            pos__ = 0;
            size_t X_wt_j_2_max__ = K_wt;
            size_t X_wt_j_1_max__ = N_wt;
            for (size_t j_2__ = 0; j_2__ < X_wt_j_2_max__; ++j_2__) {
                for (size_t j_1__ = 0; j_1__ < X_wt_j_1_max__; ++j_1__) {
                    X_wt(j_1__, j_2__) = vals_r__[pos__++];
                }
            }

            current_statement_begin__ = 16;
            context__.validate_dims("data initialization", "K_sigma_wt", "int", context__.to_vec());
            K_sigma_wt = int(0);
            vals_i__ = context__.vals_i("K_sigma_wt");
            pos__ = 0;
            K_sigma_wt = vals_i__[pos__++];
            check_greater_or_equal(function__, "K_sigma_wt", K_sigma_wt, 1);

            current_statement_begin__ = 17;
            validate_non_negative_index("X_sigma_wt", "N_wt", N_wt);
            validate_non_negative_index("X_sigma_wt", "K_sigma_wt", K_sigma_wt);
            context__.validate_dims("data initialization", "X_sigma_wt", "matrix_d", context__.to_vec(N_wt,K_sigma_wt));
            X_sigma_wt = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>(N_wt, K_sigma_wt);
            vals_r__ = context__.vals_r("X_sigma_wt");
            pos__ = 0;
            size_t X_sigma_wt_j_2_max__ = K_sigma_wt;
            size_t X_sigma_wt_j_1_max__ = N_wt;
            for (size_t j_2__ = 0; j_2__ < X_sigma_wt_j_2_max__; ++j_2__) {
                for (size_t j_1__ = 0; j_1__ < X_sigma_wt_j_1_max__; ++j_1__) {
                    X_sigma_wt(j_1__, j_2__) = vals_r__[pos__++];
                }
            }

            current_statement_begin__ = 18;
            context__.validate_dims("data initialization", "prior_only", "int", context__.to_vec());
            prior_only = int(0);
            vals_i__ = context__.vals_i("prior_only");
            pos__ = 0;
            prior_only = vals_i__[pos__++];


            // initialize transformed data variables
            current_statement_begin__ = 21;
            Kc_mpg = int(0);
            stan::math::fill(Kc_mpg, std::numeric_limits<int>::min());
            stan::math::assign(Kc_mpg,(K_mpg - 1));

            current_statement_begin__ = 22;
            validate_non_negative_index("Xc_mpg", "N_mpg", N_mpg);
            validate_non_negative_index("Xc_mpg", "Kc_mpg", Kc_mpg);
            Xc_mpg = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>(N_mpg, Kc_mpg);
            stan::math::fill(Xc_mpg, DUMMY_VAR__);

            current_statement_begin__ = 23;
            validate_non_negative_index("means_X_mpg", "Kc_mpg", Kc_mpg);
            means_X_mpg = Eigen::Matrix<double, Eigen::Dynamic, 1>(Kc_mpg);
            stan::math::fill(means_X_mpg, DUMMY_VAR__);

            current_statement_begin__ = 24;
            Kc_sigma_mpg = int(0);
            stan::math::fill(Kc_sigma_mpg, std::numeric_limits<int>::min());
            stan::math::assign(Kc_sigma_mpg,(K_sigma_mpg - 1));

            current_statement_begin__ = 25;
            validate_non_negative_index("Xc_sigma_mpg", "N_mpg", N_mpg);
            validate_non_negative_index("Xc_sigma_mpg", "Kc_sigma_mpg", Kc_sigma_mpg);
            Xc_sigma_mpg = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>(N_mpg, Kc_sigma_mpg);
            stan::math::fill(Xc_sigma_mpg, DUMMY_VAR__);

            current_statement_begin__ = 26;
            validate_non_negative_index("means_X_sigma_mpg", "Kc_sigma_mpg", Kc_sigma_mpg);
            means_X_sigma_mpg = Eigen::Matrix<double, Eigen::Dynamic, 1>(Kc_sigma_mpg);
            stan::math::fill(means_X_sigma_mpg, DUMMY_VAR__);

            current_statement_begin__ = 27;
            Kc_wt = int(0);
            stan::math::fill(Kc_wt, std::numeric_limits<int>::min());
            stan::math::assign(Kc_wt,(K_wt - 1));

            current_statement_begin__ = 28;
            validate_non_negative_index("Xc_wt", "N_wt", N_wt);
            validate_non_negative_index("Xc_wt", "Kc_wt", Kc_wt);
            Xc_wt = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>(N_wt, Kc_wt);
            stan::math::fill(Xc_wt, DUMMY_VAR__);

            current_statement_begin__ = 29;
            validate_non_negative_index("means_X_wt", "Kc_wt", Kc_wt);
            means_X_wt = Eigen::Matrix<double, Eigen::Dynamic, 1>(Kc_wt);
            stan::math::fill(means_X_wt, DUMMY_VAR__);

            current_statement_begin__ = 30;
            Kc_sigma_wt = int(0);
            stan::math::fill(Kc_sigma_wt, std::numeric_limits<int>::min());
            stan::math::assign(Kc_sigma_wt,(K_sigma_wt - 1));

            current_statement_begin__ = 31;
            validate_non_negative_index("Xc_sigma_wt", "N_wt", N_wt);
            validate_non_negative_index("Xc_sigma_wt", "Kc_sigma_wt", Kc_sigma_wt);
            Xc_sigma_wt = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>(N_wt, Kc_sigma_wt);
            stan::math::fill(Xc_sigma_wt, DUMMY_VAR__);

            current_statement_begin__ = 32;
            validate_non_negative_index("means_X_sigma_wt", "Kc_sigma_wt", Kc_sigma_wt);
            means_X_sigma_wt = Eigen::Matrix<double, Eigen::Dynamic, 1>(Kc_sigma_wt);
            stan::math::fill(means_X_sigma_wt, DUMMY_VAR__);

            // execute transformed data statements
            current_statement_begin__ = 33;
            for (int i = 2; i <= K_mpg; ++i) {

                current_statement_begin__ = 34;
                stan::model::assign(means_X_mpg, 
                            stan::model::cons_list(stan::model::index_uni((i - 1)), stan::model::nil_index_list()), 
                            mean(stan::model::rvalue(X_mpg, stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni(i), stan::model::nil_index_list())), "X_mpg")), 
                            "assigning variable means_X_mpg");
                current_statement_begin__ = 35;
                stan::model::assign(Xc_mpg, 
                            stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni((i - 1)), stan::model::nil_index_list())), 
                            subtract(stan::model::rvalue(X_mpg, stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni(i), stan::model::nil_index_list())), "X_mpg"), get_base1(means_X_mpg, (i - 1), "means_X_mpg", 1)), 
                            "assigning variable Xc_mpg");
            }
            current_statement_begin__ = 37;
            for (int i = 2; i <= K_sigma_mpg; ++i) {

                current_statement_begin__ = 38;
                stan::model::assign(means_X_sigma_mpg, 
                            stan::model::cons_list(stan::model::index_uni((i - 1)), stan::model::nil_index_list()), 
                            mean(stan::model::rvalue(X_sigma_mpg, stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni(i), stan::model::nil_index_list())), "X_sigma_mpg")), 
                            "assigning variable means_X_sigma_mpg");
                current_statement_begin__ = 39;
                stan::model::assign(Xc_sigma_mpg, 
                            stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni((i - 1)), stan::model::nil_index_list())), 
                            subtract(stan::model::rvalue(X_sigma_mpg, stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni(i), stan::model::nil_index_list())), "X_sigma_mpg"), get_base1(means_X_sigma_mpg, (i - 1), "means_X_sigma_mpg", 1)), 
                            "assigning variable Xc_sigma_mpg");
            }
            current_statement_begin__ = 41;
            for (int i = 2; i <= K_wt; ++i) {

                current_statement_begin__ = 42;
                stan::model::assign(means_X_wt, 
                            stan::model::cons_list(stan::model::index_uni((i - 1)), stan::model::nil_index_list()), 
                            mean(stan::model::rvalue(X_wt, stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni(i), stan::model::nil_index_list())), "X_wt")), 
                            "assigning variable means_X_wt");
                current_statement_begin__ = 43;
                stan::model::assign(Xc_wt, 
                            stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni((i - 1)), stan::model::nil_index_list())), 
                            subtract(stan::model::rvalue(X_wt, stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni(i), stan::model::nil_index_list())), "X_wt"), get_base1(means_X_wt, (i - 1), "means_X_wt", 1)), 
                            "assigning variable Xc_wt");
            }
            current_statement_begin__ = 45;
            for (int i = 2; i <= K_sigma_wt; ++i) {

                current_statement_begin__ = 46;
                stan::model::assign(means_X_sigma_wt, 
                            stan::model::cons_list(stan::model::index_uni((i - 1)), stan::model::nil_index_list()), 
                            mean(stan::model::rvalue(X_sigma_wt, stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni(i), stan::model::nil_index_list())), "X_sigma_wt")), 
                            "assigning variable means_X_sigma_wt");
                current_statement_begin__ = 47;
                stan::model::assign(Xc_sigma_wt, 
                            stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni((i - 1)), stan::model::nil_index_list())), 
                            subtract(stan::model::rvalue(X_sigma_wt, stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_uni(i), stan::model::nil_index_list())), "X_sigma_wt"), get_base1(means_X_sigma_wt, (i - 1), "means_X_sigma_wt", 1)), 
                            "assigning variable Xc_sigma_wt");
            }

            // validate transformed data

            // validate, set parameter ranges
            num_params_r__ = 0U;
            param_ranges_i__.clear();
            current_statement_begin__ = 51;
            validate_non_negative_index("b_mpg", "Kc_mpg", Kc_mpg);
            num_params_r__ += Kc_mpg;
            current_statement_begin__ = 52;
            num_params_r__ += 1;
            current_statement_begin__ = 53;
            validate_non_negative_index("b_sigma_mpg", "Kc_sigma_mpg", Kc_sigma_mpg);
            num_params_r__ += Kc_sigma_mpg;
            current_statement_begin__ = 54;
            num_params_r__ += 1;
            current_statement_begin__ = 55;
            validate_non_negative_index("b_wt", "Kc_wt", Kc_wt);
            num_params_r__ += Kc_wt;
            current_statement_begin__ = 56;
            num_params_r__ += 1;
            current_statement_begin__ = 57;
            validate_non_negative_index("b_sigma_wt", "Kc_sigma_wt", Kc_sigma_wt);
            num_params_r__ += Kc_sigma_wt;
            current_statement_begin__ = 58;
            num_params_r__ += 1;
        } catch (const std::exception& e) {
            stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
            // Next line prevents compiler griping about no return
            throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
        }
    }

    ~model38fc550b12d5_55224dc507bf960ddf26a5f40c493659() { }


    void transform_inits(const stan::io::var_context& context__,
                         std::vector<int>& params_i__,
                         std::vector<double>& params_r__,
                         std::ostream* pstream__) const {
        typedef double local_scalar_t__;
        stan::io::writer<double> writer__(params_r__, params_i__);
        size_t pos__;
        (void) pos__; // dummy call to supress warning
        std::vector<double> vals_r__;
        std::vector<int> vals_i__;

        current_statement_begin__ = 51;
        if (!(context__.contains_r("b_mpg")))
            stan::lang::rethrow_located(std::runtime_error(std::string("Variable b_mpg missing")), current_statement_begin__, prog_reader__());
        vals_r__ = context__.vals_r("b_mpg");
        pos__ = 0U;
        validate_non_negative_index("b_mpg", "Kc_mpg", Kc_mpg);
        context__.validate_dims("parameter initialization", "b_mpg", "vector_d", context__.to_vec(Kc_mpg));
        Eigen::Matrix<double, Eigen::Dynamic, 1> b_mpg(Kc_mpg);
        size_t b_mpg_j_1_max__ = Kc_mpg;
        for (size_t j_1__ = 0; j_1__ < b_mpg_j_1_max__; ++j_1__) {
            b_mpg(j_1__) = vals_r__[pos__++];
        }
        try {
            writer__.vector_unconstrain(b_mpg);
        } catch (const std::exception& e) {
            stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable b_mpg: ") + e.what()), current_statement_begin__, prog_reader__());
        }

        current_statement_begin__ = 52;
        if (!(context__.contains_r("Intercept_mpg")))
            stan::lang::rethrow_located(std::runtime_error(std::string("Variable Intercept_mpg missing")), current_statement_begin__, prog_reader__());
        vals_r__ = context__.vals_r("Intercept_mpg");
        pos__ = 0U;
        context__.validate_dims("parameter initialization", "Intercept_mpg", "double", context__.to_vec());
        double Intercept_mpg(0);
        Intercept_mpg = vals_r__[pos__++];
        try {
            writer__.scalar_unconstrain(Intercept_mpg);
        } catch (const std::exception& e) {
            stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable Intercept_mpg: ") + e.what()), current_statement_begin__, prog_reader__());
        }

        current_statement_begin__ = 53;
        if (!(context__.contains_r("b_sigma_mpg")))
            stan::lang::rethrow_located(std::runtime_error(std::string("Variable b_sigma_mpg missing")), current_statement_begin__, prog_reader__());
        vals_r__ = context__.vals_r("b_sigma_mpg");
        pos__ = 0U;
        validate_non_negative_index("b_sigma_mpg", "Kc_sigma_mpg", Kc_sigma_mpg);
        context__.validate_dims("parameter initialization", "b_sigma_mpg", "vector_d", context__.to_vec(Kc_sigma_mpg));
        Eigen::Matrix<double, Eigen::Dynamic, 1> b_sigma_mpg(Kc_sigma_mpg);
        size_t b_sigma_mpg_j_1_max__ = Kc_sigma_mpg;
        for (size_t j_1__ = 0; j_1__ < b_sigma_mpg_j_1_max__; ++j_1__) {
            b_sigma_mpg(j_1__) = vals_r__[pos__++];
        }
        try {
            writer__.vector_unconstrain(b_sigma_mpg);
        } catch (const std::exception& e) {
            stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable b_sigma_mpg: ") + e.what()), current_statement_begin__, prog_reader__());
        }

        current_statement_begin__ = 54;
        if (!(context__.contains_r("Intercept_sigma_mpg")))
            stan::lang::rethrow_located(std::runtime_error(std::string("Variable Intercept_sigma_mpg missing")), current_statement_begin__, prog_reader__());
        vals_r__ = context__.vals_r("Intercept_sigma_mpg");
        pos__ = 0U;
        context__.validate_dims("parameter initialization", "Intercept_sigma_mpg", "double", context__.to_vec());
        double Intercept_sigma_mpg(0);
        Intercept_sigma_mpg = vals_r__[pos__++];
        try {
            writer__.scalar_unconstrain(Intercept_sigma_mpg);
        } catch (const std::exception& e) {
            stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable Intercept_sigma_mpg: ") + e.what()), current_statement_begin__, prog_reader__());
        }

        current_statement_begin__ = 55;
        if (!(context__.contains_r("b_wt")))
            stan::lang::rethrow_located(std::runtime_error(std::string("Variable b_wt missing")), current_statement_begin__, prog_reader__());
        vals_r__ = context__.vals_r("b_wt");
        pos__ = 0U;
        validate_non_negative_index("b_wt", "Kc_wt", Kc_wt);
        context__.validate_dims("parameter initialization", "b_wt", "vector_d", context__.to_vec(Kc_wt));
        Eigen::Matrix<double, Eigen::Dynamic, 1> b_wt(Kc_wt);
        size_t b_wt_j_1_max__ = Kc_wt;
        for (size_t j_1__ = 0; j_1__ < b_wt_j_1_max__; ++j_1__) {
            b_wt(j_1__) = vals_r__[pos__++];
        }
        try {
            writer__.vector_unconstrain(b_wt);
        } catch (const std::exception& e) {
            stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable b_wt: ") + e.what()), current_statement_begin__, prog_reader__());
        }

        current_statement_begin__ = 56;
        if (!(context__.contains_r("Intercept_wt")))
            stan::lang::rethrow_located(std::runtime_error(std::string("Variable Intercept_wt missing")), current_statement_begin__, prog_reader__());
        vals_r__ = context__.vals_r("Intercept_wt");
        pos__ = 0U;
        context__.validate_dims("parameter initialization", "Intercept_wt", "double", context__.to_vec());
        double Intercept_wt(0);
        Intercept_wt = vals_r__[pos__++];
        try {
            writer__.scalar_unconstrain(Intercept_wt);
        } catch (const std::exception& e) {
            stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable Intercept_wt: ") + e.what()), current_statement_begin__, prog_reader__());
        }

        current_statement_begin__ = 57;
        if (!(context__.contains_r("b_sigma_wt")))
            stan::lang::rethrow_located(std::runtime_error(std::string("Variable b_sigma_wt missing")), current_statement_begin__, prog_reader__());
        vals_r__ = context__.vals_r("b_sigma_wt");
        pos__ = 0U;
        validate_non_negative_index("b_sigma_wt", "Kc_sigma_wt", Kc_sigma_wt);
        context__.validate_dims("parameter initialization", "b_sigma_wt", "vector_d", context__.to_vec(Kc_sigma_wt));
        Eigen::Matrix<double, Eigen::Dynamic, 1> b_sigma_wt(Kc_sigma_wt);
        size_t b_sigma_wt_j_1_max__ = Kc_sigma_wt;
        for (size_t j_1__ = 0; j_1__ < b_sigma_wt_j_1_max__; ++j_1__) {
            b_sigma_wt(j_1__) = vals_r__[pos__++];
        }
        try {
            writer__.vector_unconstrain(b_sigma_wt);
        } catch (const std::exception& e) {
            stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable b_sigma_wt: ") + e.what()), current_statement_begin__, prog_reader__());
        }

        current_statement_begin__ = 58;
        if (!(context__.contains_r("Intercept_sigma_wt")))
            stan::lang::rethrow_located(std::runtime_error(std::string("Variable Intercept_sigma_wt missing")), current_statement_begin__, prog_reader__());
        vals_r__ = context__.vals_r("Intercept_sigma_wt");
        pos__ = 0U;
        context__.validate_dims("parameter initialization", "Intercept_sigma_wt", "double", context__.to_vec());
        double Intercept_sigma_wt(0);
        Intercept_sigma_wt = vals_r__[pos__++];
        try {
            writer__.scalar_unconstrain(Intercept_sigma_wt);
        } catch (const std::exception& e) {
            stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable Intercept_sigma_wt: ") + e.what()), current_statement_begin__, prog_reader__());
        }

        params_r__ = writer__.data_r();
        params_i__ = writer__.data_i();
    }

    void transform_inits(const stan::io::var_context& context,
                         Eigen::Matrix<double, Eigen::Dynamic, 1>& params_r,
                         std::ostream* pstream__) const {
      std::vector<double> params_r_vec;
      std::vector<int> params_i_vec;
      transform_inits(context, params_i_vec, params_r_vec, pstream__);
      params_r.resize(params_r_vec.size());
      for (int i = 0; i < params_r.size(); ++i)
        params_r(i) = params_r_vec[i];
    }


    template <bool propto__, bool jacobian__, typename T__>
    T__ log_prob(std::vector<T__>& params_r__,
                 std::vector<int>& params_i__,
                 std::ostream* pstream__ = 0) const {

        typedef T__ local_scalar_t__;

        local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
        (void) DUMMY_VAR__;  // dummy to suppress unused var warning

        T__ lp__(0.0);
        stan::math::accumulator<T__> lp_accum__;
        try {
            stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);

            // model parameters
            current_statement_begin__ = 51;
            Eigen::Matrix<local_scalar_t__, Eigen::Dynamic, 1> b_mpg;
            (void) b_mpg;  // dummy to suppress unused var warning
            if (jacobian__)
                b_mpg = in__.vector_constrain(Kc_mpg, lp__);
            else
                b_mpg = in__.vector_constrain(Kc_mpg);

            current_statement_begin__ = 52;
            local_scalar_t__ Intercept_mpg;
            (void) Intercept_mpg;  // dummy to suppress unused var warning
            if (jacobian__)
                Intercept_mpg = in__.scalar_constrain(lp__);
            else
                Intercept_mpg = in__.scalar_constrain();

            current_statement_begin__ = 53;
            Eigen::Matrix<local_scalar_t__, Eigen::Dynamic, 1> b_sigma_mpg;
            (void) b_sigma_mpg;  // dummy to suppress unused var warning
            if (jacobian__)
                b_sigma_mpg = in__.vector_constrain(Kc_sigma_mpg, lp__);
            else
                b_sigma_mpg = in__.vector_constrain(Kc_sigma_mpg);

            current_statement_begin__ = 54;
            local_scalar_t__ Intercept_sigma_mpg;
            (void) Intercept_sigma_mpg;  // dummy to suppress unused var warning
            if (jacobian__)
                Intercept_sigma_mpg = in__.scalar_constrain(lp__);
            else
                Intercept_sigma_mpg = in__.scalar_constrain();

            current_statement_begin__ = 55;
            Eigen::Matrix<local_scalar_t__, Eigen::Dynamic, 1> b_wt;
            (void) b_wt;  // dummy to suppress unused var warning
            if (jacobian__)
                b_wt = in__.vector_constrain(Kc_wt, lp__);
            else
                b_wt = in__.vector_constrain(Kc_wt);

            current_statement_begin__ = 56;
            local_scalar_t__ Intercept_wt;
            (void) Intercept_wt;  // dummy to suppress unused var warning
            if (jacobian__)
                Intercept_wt = in__.scalar_constrain(lp__);
            else
                Intercept_wt = in__.scalar_constrain();

            current_statement_begin__ = 57;
            Eigen::Matrix<local_scalar_t__, Eigen::Dynamic, 1> b_sigma_wt;
            (void) b_sigma_wt;  // dummy to suppress unused var warning
            if (jacobian__)
                b_sigma_wt = in__.vector_constrain(Kc_sigma_wt, lp__);
            else
                b_sigma_wt = in__.vector_constrain(Kc_sigma_wt);

            current_statement_begin__ = 58;
            local_scalar_t__ Intercept_sigma_wt;
            (void) Intercept_sigma_wt;  // dummy to suppress unused var warning
            if (jacobian__)
                Intercept_sigma_wt = in__.scalar_constrain(lp__);
            else
                Intercept_sigma_wt = in__.scalar_constrain();

            // model body
            {
            current_statement_begin__ = 64;
            validate_non_negative_index("mu_mpg", "N_mpg", N_mpg);
            Eigen::Matrix<local_scalar_t__, Eigen::Dynamic, 1> mu_mpg(N_mpg);
            stan::math::initialize(mu_mpg, DUMMY_VAR__);
            stan::math::fill(mu_mpg, DUMMY_VAR__);
            stan::math::assign(mu_mpg,add(Intercept_mpg, multiply(Xc_mpg, b_mpg)));

            current_statement_begin__ = 66;
            validate_non_negative_index("sigma_mpg", "N_mpg", N_mpg);
            Eigen::Matrix<local_scalar_t__, Eigen::Dynamic, 1> sigma_mpg(N_mpg);
            stan::math::initialize(sigma_mpg, DUMMY_VAR__);
            stan::math::fill(sigma_mpg, DUMMY_VAR__);
            stan::math::assign(sigma_mpg,add(Intercept_sigma_mpg, multiply(Xc_sigma_mpg, b_sigma_mpg)));

            current_statement_begin__ = 68;
            validate_non_negative_index("mu_wt", "N_wt", N_wt);
            Eigen::Matrix<local_scalar_t__, Eigen::Dynamic, 1> mu_wt(N_wt);
            stan::math::initialize(mu_wt, DUMMY_VAR__);
            stan::math::fill(mu_wt, DUMMY_VAR__);
            stan::math::assign(mu_wt,add(Intercept_wt, multiply(Xc_wt, b_wt)));

            current_statement_begin__ = 70;
            validate_non_negative_index("sigma_wt", "N_wt", N_wt);
            Eigen::Matrix<local_scalar_t__, Eigen::Dynamic, 1> sigma_wt(N_wt);
            stan::math::initialize(sigma_wt, DUMMY_VAR__);
            stan::math::fill(sigma_wt, DUMMY_VAR__);
            stan::math::assign(sigma_wt,add(Intercept_sigma_wt, multiply(Xc_sigma_wt, b_sigma_wt)));


            current_statement_begin__ = 71;
            for (int n = 1; n <= N_mpg; ++n) {

                current_statement_begin__ = 73;
                stan::model::assign(sigma_mpg, 
                            stan::model::cons_list(stan::model::index_uni(n), stan::model::nil_index_list()), 
                            stan::math::exp(get_base1(sigma_mpg, n, "sigma_mpg", 1)), 
                            "assigning variable sigma_mpg");
            }
            current_statement_begin__ = 75;
            for (int n = 1; n <= N_wt; ++n) {

                current_statement_begin__ = 77;
                stan::model::assign(sigma_wt, 
                            stan::model::cons_list(stan::model::index_uni(n), stan::model::nil_index_list()), 
                            stan::math::exp(get_base1(sigma_wt, n, "sigma_wt", 1)), 
                            "assigning variable sigma_wt");
            }
            current_statement_begin__ = 80;
            lp_accum__.add(student_t_log(Intercept_mpg, 3, 19, 10));
            current_statement_begin__ = 81;
            lp_accum__.add(student_t_log(Intercept_sigma_mpg, 3, 0, 10));
            current_statement_begin__ = 82;
            lp_accum__.add(student_t_log(Intercept_wt, 3, 3, 10));
            current_statement_begin__ = 83;
            lp_accum__.add(student_t_log(Intercept_sigma_wt, 3, 0, 10));
            current_statement_begin__ = 85;
            if (as_bool(logical_negation(prior_only))) {

                current_statement_begin__ = 86;
                lp_accum__.add(normal_log(Y_mpg, mu_mpg, sigma_mpg));
                current_statement_begin__ = 87;
                lp_accum__.add(normal_log(Y_wt, mu_wt, sigma_wt));
            }
            }

        } catch (const std::exception& e) {
            stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
            // 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()

    template <bool propto, bool jacobian, typename T_>
    T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r,
               std::ostream* pstream = 0) const {
      std::vector<T_> vec_params_r;
      vec_params_r.reserve(params_r.size());
      for (int i = 0; i < params_r.size(); ++i)
        vec_params_r.push_back(params_r(i));
      std::vector<int> vec_params_i;
      return log_prob<propto,jacobian,T_>(vec_params_r, vec_params_i, pstream);
    }


    void get_param_names(std::vector<std::string>& names__) const {
        names__.resize(0);
        names__.push_back("b_mpg");
        names__.push_back("Intercept_mpg");
        names__.push_back("b_sigma_mpg");
        names__.push_back("Intercept_sigma_mpg");
        names__.push_back("b_wt");
        names__.push_back("Intercept_wt");
        names__.push_back("b_sigma_wt");
        names__.push_back("Intercept_sigma_wt");
        names__.push_back("b_mpg_Intercept");
        names__.push_back("b_sigma_mpg_Intercept");
        names__.push_back("b_wt_Intercept");
        names__.push_back("b_sigma_wt_Intercept");
    }


    void get_dims(std::vector<std::vector<size_t> >& dimss__) const {
        dimss__.resize(0);
        std::vector<size_t> dims__;
        dims__.resize(0);
        dims__.push_back(Kc_mpg);
        dimss__.push_back(dims__);
        dims__.resize(0);
        dimss__.push_back(dims__);
        dims__.resize(0);
        dims__.push_back(Kc_sigma_mpg);
        dimss__.push_back(dims__);
        dims__.resize(0);
        dimss__.push_back(dims__);
        dims__.resize(0);
        dims__.push_back(Kc_wt);
        dimss__.push_back(dims__);
        dims__.resize(0);
        dimss__.push_back(dims__);
        dims__.resize(0);
        dims__.push_back(Kc_sigma_wt);
        dimss__.push_back(dims__);
        dims__.resize(0);
        dimss__.push_back(dims__);
        dims__.resize(0);
        dimss__.push_back(dims__);
        dims__.resize(0);
        dimss__.push_back(dims__);
        dims__.resize(0);
        dimss__.push_back(dims__);
        dims__.resize(0);
        dimss__.push_back(dims__);
    }

    template <typename RNG>
    void write_array(RNG& base_rng__,
                     std::vector<double>& params_r__,
                     std::vector<int>& params_i__,
                     std::vector<double>& vars__,
                     bool include_tparams__ = true,
                     bool include_gqs__ = true,
                     std::ostream* pstream__ = 0) const {
        typedef double local_scalar_t__;

        vars__.resize(0);
        stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);
        static const char* function__ = "model38fc550b12d5_55224dc507bf960ddf26a5f40c493659_namespace::write_array";
        (void) function__;  // dummy to suppress unused var warning

        // read-transform, write parameters
        Eigen::Matrix<double, Eigen::Dynamic, 1> b_mpg = in__.vector_constrain(Kc_mpg);
        size_t b_mpg_j_1_max__ = Kc_mpg;
        for (size_t j_1__ = 0; j_1__ < b_mpg_j_1_max__; ++j_1__) {
            vars__.push_back(b_mpg(j_1__));
        }

        double Intercept_mpg = in__.scalar_constrain();
        vars__.push_back(Intercept_mpg);

        Eigen::Matrix<double, Eigen::Dynamic, 1> b_sigma_mpg = in__.vector_constrain(Kc_sigma_mpg);
        size_t b_sigma_mpg_j_1_max__ = Kc_sigma_mpg;
        for (size_t j_1__ = 0; j_1__ < b_sigma_mpg_j_1_max__; ++j_1__) {
            vars__.push_back(b_sigma_mpg(j_1__));
        }

        double Intercept_sigma_mpg = in__.scalar_constrain();
        vars__.push_back(Intercept_sigma_mpg);

        Eigen::Matrix<double, Eigen::Dynamic, 1> b_wt = in__.vector_constrain(Kc_wt);
        size_t b_wt_j_1_max__ = Kc_wt;
        for (size_t j_1__ = 0; j_1__ < b_wt_j_1_max__; ++j_1__) {
            vars__.push_back(b_wt(j_1__));
        }

        double Intercept_wt = in__.scalar_constrain();
        vars__.push_back(Intercept_wt);

        Eigen::Matrix<double, Eigen::Dynamic, 1> b_sigma_wt = in__.vector_constrain(Kc_sigma_wt);
        size_t b_sigma_wt_j_1_max__ = Kc_sigma_wt;
        for (size_t j_1__ = 0; j_1__ < b_sigma_wt_j_1_max__; ++j_1__) {
            vars__.push_back(b_sigma_wt(j_1__));
        }

        double Intercept_sigma_wt = in__.scalar_constrain();
        vars__.push_back(Intercept_sigma_wt);

        double lp__ = 0.0;
        (void) lp__;  // dummy to suppress unused var warning
        stan::math::accumulator<double> lp_accum__;

        local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
        (void) DUMMY_VAR__;  // suppress unused var warning

        if (!include_tparams__ && !include_gqs__) return;

        try {
            if (!include_gqs__ && !include_tparams__) return;
            if (!include_gqs__) return;
            // declare and define generated quantities
            current_statement_begin__ = 92;
            double b_mpg_Intercept;
            (void) b_mpg_Intercept;  // dummy to suppress unused var warning
            stan::math::initialize(b_mpg_Intercept, DUMMY_VAR__);
            stan::math::fill(b_mpg_Intercept, DUMMY_VAR__);
            stan::math::assign(b_mpg_Intercept,(Intercept_mpg - dot_product(means_X_mpg, b_mpg)));

            current_statement_begin__ = 94;
            double b_sigma_mpg_Intercept;
            (void) b_sigma_mpg_Intercept;  // dummy to suppress unused var warning
            stan::math::initialize(b_sigma_mpg_Intercept, DUMMY_VAR__);
            stan::math::fill(b_sigma_mpg_Intercept, DUMMY_VAR__);
            stan::math::assign(b_sigma_mpg_Intercept,(Intercept_sigma_mpg - dot_product(means_X_sigma_mpg, b_sigma_mpg)));

            current_statement_begin__ = 96;
            double b_wt_Intercept;
            (void) b_wt_Intercept;  // dummy to suppress unused var warning
            stan::math::initialize(b_wt_Intercept, DUMMY_VAR__);
            stan::math::fill(b_wt_Intercept, DUMMY_VAR__);
            stan::math::assign(b_wt_Intercept,(Intercept_wt - dot_product(means_X_wt, b_wt)));

            current_statement_begin__ = 98;
            double b_sigma_wt_Intercept;
            (void) b_sigma_wt_Intercept;  // dummy to suppress unused var warning
            stan::math::initialize(b_sigma_wt_Intercept, DUMMY_VAR__);
            stan::math::fill(b_sigma_wt_Intercept, DUMMY_VAR__);
            stan::math::assign(b_sigma_wt_Intercept,(Intercept_sigma_wt - dot_product(means_X_sigma_wt, b_sigma_wt)));

            // validate, write generated quantities
            current_statement_begin__ = 92;
            vars__.push_back(b_mpg_Intercept);

            current_statement_begin__ = 94;
            vars__.push_back(b_sigma_mpg_Intercept);

            current_statement_begin__ = 96;
            vars__.push_back(b_wt_Intercept);

            current_statement_begin__ = 98;
            vars__.push_back(b_sigma_wt_Intercept);

        } catch (const std::exception& e) {
            stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
            // Next line prevents compiler griping about no return
            throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
        }
    }

    template <typename RNG>
    void write_array(RNG& base_rng,
                     Eigen::Matrix<double,Eigen::Dynamic,1>& params_r,
                     Eigen::Matrix<double,Eigen::Dynamic,1>& vars,
                     bool include_tparams = true,
                     bool include_gqs = true,
                     std::ostream* pstream = 0) const {
      std::vector<double> params_r_vec(params_r.size());
      for (int i = 0; i < params_r.size(); ++i)
        params_r_vec[i] = params_r(i);
      std::vector<double> vars_vec;
      std::vector<int> params_i_vec;
      write_array(base_rng, params_r_vec, params_i_vec, vars_vec, include_tparams, include_gqs, pstream);
      vars.resize(vars_vec.size());
      for (int i = 0; i < vars.size(); ++i)
        vars(i) = vars_vec[i];
    }

    std::string model_name() const {
        return "model38fc550b12d5_55224dc507bf960ddf26a5f40c493659";
    }


    void constrained_param_names(std::vector<std::string>& param_names__,
                                 bool include_tparams__ = true,
                                 bool include_gqs__ = true) const {
        std::stringstream param_name_stream__;
        size_t b_mpg_j_1_max__ = Kc_mpg;
        for (size_t j_1__ = 0; j_1__ < b_mpg_j_1_max__; ++j_1__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "b_mpg" << '.' << j_1__ + 1;
            param_names__.push_back(param_name_stream__.str());
        }
        param_name_stream__.str(std::string());
        param_name_stream__ << "Intercept_mpg";
        param_names__.push_back(param_name_stream__.str());
        size_t b_sigma_mpg_j_1_max__ = Kc_sigma_mpg;
        for (size_t j_1__ = 0; j_1__ < b_sigma_mpg_j_1_max__; ++j_1__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "b_sigma_mpg" << '.' << j_1__ + 1;
            param_names__.push_back(param_name_stream__.str());
        }
        param_name_stream__.str(std::string());
        param_name_stream__ << "Intercept_sigma_mpg";
        param_names__.push_back(param_name_stream__.str());
        size_t b_wt_j_1_max__ = Kc_wt;
        for (size_t j_1__ = 0; j_1__ < b_wt_j_1_max__; ++j_1__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "b_wt" << '.' << j_1__ + 1;
            param_names__.push_back(param_name_stream__.str());
        }
        param_name_stream__.str(std::string());
        param_name_stream__ << "Intercept_wt";
        param_names__.push_back(param_name_stream__.str());
        size_t b_sigma_wt_j_1_max__ = Kc_sigma_wt;
        for (size_t j_1__ = 0; j_1__ < b_sigma_wt_j_1_max__; ++j_1__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "b_sigma_wt" << '.' << j_1__ + 1;
            param_names__.push_back(param_name_stream__.str());
        }
        param_name_stream__.str(std::string());
        param_name_stream__ << "Intercept_sigma_wt";
        param_names__.push_back(param_name_stream__.str());

        if (!include_gqs__ && !include_tparams__) return;

        if (include_tparams__) {
        }

        if (!include_gqs__) return;
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_mpg_Intercept";
        param_names__.push_back(param_name_stream__.str());
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_sigma_mpg_Intercept";
        param_names__.push_back(param_name_stream__.str());
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_wt_Intercept";
        param_names__.push_back(param_name_stream__.str());
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_sigma_wt_Intercept";
        param_names__.push_back(param_name_stream__.str());
    }


    void unconstrained_param_names(std::vector<std::string>& param_names__,
                                   bool include_tparams__ = true,
                                   bool include_gqs__ = true) const {
        std::stringstream param_name_stream__;
        size_t b_mpg_j_1_max__ = Kc_mpg;
        for (size_t j_1__ = 0; j_1__ < b_mpg_j_1_max__; ++j_1__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "b_mpg" << '.' << j_1__ + 1;
            param_names__.push_back(param_name_stream__.str());
        }
        param_name_stream__.str(std::string());
        param_name_stream__ << "Intercept_mpg";
        param_names__.push_back(param_name_stream__.str());
        size_t b_sigma_mpg_j_1_max__ = Kc_sigma_mpg;
        for (size_t j_1__ = 0; j_1__ < b_sigma_mpg_j_1_max__; ++j_1__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "b_sigma_mpg" << '.' << j_1__ + 1;
            param_names__.push_back(param_name_stream__.str());
        }
        param_name_stream__.str(std::string());
        param_name_stream__ << "Intercept_sigma_mpg";
        param_names__.push_back(param_name_stream__.str());
        size_t b_wt_j_1_max__ = Kc_wt;
        for (size_t j_1__ = 0; j_1__ < b_wt_j_1_max__; ++j_1__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "b_wt" << '.' << j_1__ + 1;
            param_names__.push_back(param_name_stream__.str());
        }
        param_name_stream__.str(std::string());
        param_name_stream__ << "Intercept_wt";
        param_names__.push_back(param_name_stream__.str());
        size_t b_sigma_wt_j_1_max__ = Kc_sigma_wt;
        for (size_t j_1__ = 0; j_1__ < b_sigma_wt_j_1_max__; ++j_1__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "b_sigma_wt" << '.' << j_1__ + 1;
            param_names__.push_back(param_name_stream__.str());
        }
        param_name_stream__.str(std::string());
        param_name_stream__ << "Intercept_sigma_wt";
        param_names__.push_back(param_name_stream__.str());

        if (!include_gqs__ && !include_tparams__) return;

        if (include_tparams__) {
        }

        if (!include_gqs__) return;
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_mpg_Intercept";
        param_names__.push_back(param_name_stream__.str());
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_sigma_mpg_Intercept";
        param_names__.push_back(param_name_stream__.str());
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_wt_Intercept";
        param_names__.push_back(param_name_stream__.str());
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_sigma_wt_Intercept";
        param_names__.push_back(param_name_stream__.str());
    }

}; // model

}  // namespace

typedef model38fc550b12d5_55224dc507bf960ddf26a5f40c493659_namespace::model38fc550b12d5_55224dc507bf960ddf26a5f40c493659 stan_model;

#ifndef USING_R

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;
}

#endif