// Code generated by Stan version 2.21.0

#include <stan/model/model_header.hpp>

namespace model2470278f2f7b_stan_glm_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", "model2470278f2f7b_stan_glm");
    reader.add_event(82, 80, "end", "model2470278f2f7b_stan_glm");
    return reader;
}

class model2470278f2f7b_stan_glm
  : public stan::model::model_base_crtp<model2470278f2f7b_stan_glm> {
private:
        int N;
        std::vector<int> y;
        std::vector<double> roach1;
        std::vector<double> treatment;
        std::vector<double> senior;
        std::vector<double> exposure2;
        int N_y_pred;
        matrix_d predictdata;
        std::vector<double> offset;
public:
    model2470278f2f7b_stan_glm(rstan::io::rlist_ref_var_context& context__,
        std::ostream* pstream__ = 0)
        : model_base_crtp(0) {
        ctor_body(context__, 0, pstream__);
    }

    model2470278f2f7b_stan_glm(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__ = "model2470278f2f7b_stan_glm_namespace::model2470278f2f7b_stan_glm";
        (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__ = 3;
            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__++];

            current_statement_begin__ = 4;
            validate_non_negative_index("y", "N", N);
            context__.validate_dims("data initialization", "y", "int", context__.to_vec(N));
            y = std::vector<int>(N, int(0));
            vals_i__ = context__.vals_i("y");
            pos__ = 0;
            size_t y_k_0_max__ = N;
            for (size_t k_0__ = 0; k_0__ < y_k_0_max__; ++k_0__) {
                y[k_0__] = vals_i__[pos__++];
            }

            current_statement_begin__ = 5;
            validate_non_negative_index("roach1", "N", N);
            context__.validate_dims("data initialization", "roach1", "double", context__.to_vec(N));
            roach1 = std::vector<double>(N, double(0));
            vals_r__ = context__.vals_r("roach1");
            pos__ = 0;
            size_t roach1_k_0_max__ = N;
            for (size_t k_0__ = 0; k_0__ < roach1_k_0_max__; ++k_0__) {
                roach1[k_0__] = vals_r__[pos__++];
            }

            current_statement_begin__ = 6;
            validate_non_negative_index("treatment", "N", N);
            context__.validate_dims("data initialization", "treatment", "double", context__.to_vec(N));
            treatment = std::vector<double>(N, double(0));
            vals_r__ = context__.vals_r("treatment");
            pos__ = 0;
            size_t treatment_k_0_max__ = N;
            for (size_t k_0__ = 0; k_0__ < treatment_k_0_max__; ++k_0__) {
                treatment[k_0__] = vals_r__[pos__++];
            }

            current_statement_begin__ = 7;
            validate_non_negative_index("senior", "N", N);
            context__.validate_dims("data initialization", "senior", "double", context__.to_vec(N));
            senior = std::vector<double>(N, double(0));
            vals_r__ = context__.vals_r("senior");
            pos__ = 0;
            size_t senior_k_0_max__ = N;
            for (size_t k_0__ = 0; k_0__ < senior_k_0_max__; ++k_0__) {
                senior[k_0__] = vals_r__[pos__++];
            }

            current_statement_begin__ = 8;
            validate_non_negative_index("exposure2", "N", N);
            context__.validate_dims("data initialization", "exposure2", "double", context__.to_vec(N));
            exposure2 = std::vector<double>(N, double(0));
            vals_r__ = context__.vals_r("exposure2");
            pos__ = 0;
            size_t exposure2_k_0_max__ = N;
            for (size_t k_0__ = 0; k_0__ < exposure2_k_0_max__; ++k_0__) {
                exposure2[k_0__] = vals_r__[pos__++];
            }

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

            current_statement_begin__ = 11;
            validate_non_negative_index("predictdata", "N_y_pred", N_y_pred);
            validate_non_negative_index("predictdata", "5", 5);
            context__.validate_dims("data initialization", "predictdata", "matrix_d", context__.to_vec(N_y_pred,5));
            predictdata = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>(N_y_pred, 5);
            vals_r__ = context__.vals_r("predictdata");
            pos__ = 0;
            size_t predictdata_j_2_max__ = 5;
            size_t predictdata_j_1_max__ = N_y_pred;
            for (size_t j_2__ = 0; j_2__ < predictdata_j_2_max__; ++j_2__) {
                for (size_t j_1__ = 0; j_1__ < predictdata_j_1_max__; ++j_1__) {
                    predictdata(j_1__, j_2__) = vals_r__[pos__++];
                }
            }


            // initialize transformed data variables
            current_statement_begin__ = 17;
            validate_non_negative_index("offset", "N", N);
            offset = std::vector<double>(N, double(0));
            stan::math::fill(offset, DUMMY_VAR__);

            // execute transformed data statements
            current_statement_begin__ = 19;
            for (int i = 1; i <= N; ++i) {

                current_statement_begin__ = 20;
                stan::model::assign(offset, 
                            stan::model::cons_list(stan::model::index_uni(i), stan::model::nil_index_list()), 
                            stan::math::log(get_base1(exposure2, i, "exposure2", 1)), 
                            "assigning variable offset");
            }

            // validate transformed data

            // validate, set parameter ranges
            num_params_r__ = 0U;
            param_ranges_i__.clear();
            current_statement_begin__ = 27;
            num_params_r__ += 1;
            current_statement_begin__ = 28;
            num_params_r__ += 1;
            current_statement_begin__ = 29;
            num_params_r__ += 1;
            current_statement_begin__ = 30;
            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 ***");
        }
    }

    ~model2470278f2f7b_stan_glm() { }


    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__ = 27;
        if (!(context__.contains_r("b0")))
            stan::lang::rethrow_located(std::runtime_error(std::string("Variable b0 missing")), current_statement_begin__, prog_reader__());
        vals_r__ = context__.vals_r("b0");
        pos__ = 0U;
        context__.validate_dims("parameter initialization", "b0", "double", context__.to_vec());
        double b0(0);
        b0 = vals_r__[pos__++];
        try {
            writer__.scalar_unconstrain(b0);
        } catch (const std::exception& e) {
            stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable b0: ") + e.what()), current_statement_begin__, prog_reader__());
        }

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

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

        current_statement_begin__ = 30;
        if (!(context__.contains_r("b_senior")))
            stan::lang::rethrow_located(std::runtime_error(std::string("Variable b_senior missing")), current_statement_begin__, prog_reader__());
        vals_r__ = context__.vals_r("b_senior");
        pos__ = 0U;
        context__.validate_dims("parameter initialization", "b_senior", "double", context__.to_vec());
        double b_senior(0);
        b_senior = vals_r__[pos__++];
        try {
            writer__.scalar_unconstrain(b_senior);
        } catch (const std::exception& e) {
            stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable b_senior: ") + 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__ = 27;
            local_scalar_t__ b0;
            (void) b0;  // dummy to suppress unused var warning
            if (jacobian__)
                b0 = in__.scalar_constrain(lp__);
            else
                b0 = in__.scalar_constrain();

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

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

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

            // model body
            {
            current_statement_begin__ = 35;
            validate_non_negative_index("loglambda", "N", N);
            std::vector<local_scalar_t__  > loglambda(N, local_scalar_t__(DUMMY_VAR__));
            stan::math::initialize(loglambda, DUMMY_VAR__);
            stan::math::fill(loglambda, DUMMY_VAR__);


            current_statement_begin__ = 37;
            for (int i = 1; i <= N; ++i) {

                current_statement_begin__ = 38;
                stan::model::assign(loglambda, 
                            stan::model::cons_list(stan::model::index_uni(i), stan::model::nil_index_list()), 
                            ((((b0 + (b_roach1 * get_base1(roach1, i, "roach1", 1))) + (b_treatment * get_base1(treatment, i, "treatment", 1))) + (b_senior * get_base1(senior, i, "senior", 1))) + get_base1(offset, i, "offset", 1)), 
                            "assigning variable loglambda");
                current_statement_begin__ = 40;
                lp_accum__.add(poisson_log_log<propto__>(get_base1(y, i, "y", 1), get_base1(loglambda, i, "loglambda", 1)));
            }
            current_statement_begin__ = 43;
            lp_accum__.add(normal_log<propto__>(b0, 0, 1e6));
            current_statement_begin__ = 44;
            lp_accum__.add(normal_log<propto__>(b_roach1, 0, 1e6));
            current_statement_begin__ = 45;
            lp_accum__.add(normal_log<propto__>(b_treatment, 0, 1e6));
            current_statement_begin__ = 46;
            lp_accum__.add(normal_log<propto__>(b_senior, 0, 1e6));
            }

        } 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("b0");
        names__.push_back("b_roach1");
        names__.push_back("b_treatment");
        names__.push_back("b_senior");
        names__.push_back("beta");
        names__.push_back("y_pred");
        names__.push_back("pred_loglambda");
    }


    void get_dims(std::vector<std::vector<size_t> >& dimss__) const {
        dimss__.resize(0);
        std::vector<size_t> 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);
        dims__.push_back(5);
        dimss__.push_back(dims__);
        dims__.resize(0);
        dims__.push_back(N_y_pred);
        dimss__.push_back(dims__);
        dims__.resize(0);
        dims__.push_back(N_y_pred);
        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__ = "model2470278f2f7b_stan_glm_namespace::write_array";
        (void) function__;  // dummy to suppress unused var warning

        // read-transform, write parameters
        double b0 = in__.scalar_constrain();
        vars__.push_back(b0);

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

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

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

        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__ = 52;
            validate_non_negative_index("beta", "5", 5);
            Eigen::Matrix<double, Eigen::Dynamic, 1> beta(5);
            stan::math::initialize(beta, DUMMY_VAR__);
            stan::math::fill(beta, DUMMY_VAR__);

            current_statement_begin__ = 64;
            validate_non_negative_index("y_pred", "N_y_pred", N_y_pred);
            std::vector<double> y_pred(N_y_pred, double(0));
            stan::math::initialize(y_pred, DUMMY_VAR__);
            stan::math::fill(y_pred, DUMMY_VAR__);

            current_statement_begin__ = 66;
            validate_non_negative_index("pred_loglambda", "N_y_pred", N_y_pred);
            Eigen::Matrix<double, Eigen::Dynamic, 1> pred_loglambda(N_y_pred);
            stan::math::initialize(pred_loglambda, DUMMY_VAR__);
            stan::math::fill(pred_loglambda, DUMMY_VAR__);

            // generated quantities statements
            current_statement_begin__ = 68;
            stan::model::assign(beta, 
                        stan::model::cons_list(stan::model::index_uni(1), stan::model::nil_index_list()), 
                        b0, 
                        "assigning variable beta");
            current_statement_begin__ = 69;
            stan::model::assign(beta, 
                        stan::model::cons_list(stan::model::index_uni(2), stan::model::nil_index_list()), 
                        b_roach1, 
                        "assigning variable beta");
            current_statement_begin__ = 70;
            stan::model::assign(beta, 
                        stan::model::cons_list(stan::model::index_uni(3), stan::model::nil_index_list()), 
                        b_treatment, 
                        "assigning variable beta");
            current_statement_begin__ = 71;
            stan::model::assign(beta, 
                        stan::model::cons_list(stan::model::index_uni(4), stan::model::nil_index_list()), 
                        b_senior, 
                        "assigning variable beta");
            current_statement_begin__ = 72;
            stan::model::assign(beta, 
                        stan::model::cons_list(stan::model::index_uni(5), stan::model::nil_index_list()), 
                        1, 
                        "assigning variable beta");
            current_statement_begin__ = 74;
            stan::math::assign(pred_loglambda, multiply(predictdata, beta));
            current_statement_begin__ = 76;
            for (int i = 1; i <= N_y_pred; ++i) {

                current_statement_begin__ = 77;
                stan::model::assign(y_pred, 
                            stan::model::cons_list(stan::model::index_uni(i), stan::model::nil_index_list()), 
                            poisson_rng(stan::math::exp(get_base1(pred_loglambda, i, "pred_loglambda", 1)), base_rng__), 
                            "assigning variable y_pred");
            }

            // validate, write generated quantities
            current_statement_begin__ = 52;
            size_t beta_j_1_max__ = 5;
            for (size_t j_1__ = 0; j_1__ < beta_j_1_max__; ++j_1__) {
                vars__.push_back(beta(j_1__));
            }

            current_statement_begin__ = 64;
            size_t y_pred_k_0_max__ = N_y_pred;
            for (size_t k_0__ = 0; k_0__ < y_pred_k_0_max__; ++k_0__) {
                vars__.push_back(y_pred[k_0__]);
            }

            current_statement_begin__ = 66;
            size_t pred_loglambda_j_1_max__ = N_y_pred;
            for (size_t j_1__ = 0; j_1__ < pred_loglambda_j_1_max__; ++j_1__) {
                vars__.push_back(pred_loglambda(j_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 ***");
        }
    }

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


    void constrained_param_names(std::vector<std::string>& param_names__,
                                 bool include_tparams__ = true,
                                 bool include_gqs__ = true) const {
        std::stringstream param_name_stream__;
        param_name_stream__.str(std::string());
        param_name_stream__ << "b0";
        param_names__.push_back(param_name_stream__.str());
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_roach1";
        param_names__.push_back(param_name_stream__.str());
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_treatment";
        param_names__.push_back(param_name_stream__.str());
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_senior";
        param_names__.push_back(param_name_stream__.str());

        if (!include_gqs__ && !include_tparams__) return;

        if (include_tparams__) {
        }

        if (!include_gqs__) return;
        size_t beta_j_1_max__ = 5;
        for (size_t j_1__ = 0; j_1__ < beta_j_1_max__; ++j_1__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "beta" << '.' << j_1__ + 1;
            param_names__.push_back(param_name_stream__.str());
        }
        size_t y_pred_k_0_max__ = N_y_pred;
        for (size_t k_0__ = 0; k_0__ < y_pred_k_0_max__; ++k_0__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "y_pred" << '.' << k_0__ + 1;
            param_names__.push_back(param_name_stream__.str());
        }
        size_t pred_loglambda_j_1_max__ = N_y_pred;
        for (size_t j_1__ = 0; j_1__ < pred_loglambda_j_1_max__; ++j_1__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "pred_loglambda" << '.' << j_1__ + 1;
            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__;
        param_name_stream__.str(std::string());
        param_name_stream__ << "b0";
        param_names__.push_back(param_name_stream__.str());
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_roach1";
        param_names__.push_back(param_name_stream__.str());
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_treatment";
        param_names__.push_back(param_name_stream__.str());
        param_name_stream__.str(std::string());
        param_name_stream__ << "b_senior";
        param_names__.push_back(param_name_stream__.str());

        if (!include_gqs__ && !include_tparams__) return;

        if (include_tparams__) {
        }

        if (!include_gqs__) return;
        size_t beta_j_1_max__ = 5;
        for (size_t j_1__ = 0; j_1__ < beta_j_1_max__; ++j_1__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "beta" << '.' << j_1__ + 1;
            param_names__.push_back(param_name_stream__.str());
        }
        size_t y_pred_k_0_max__ = N_y_pred;
        for (size_t k_0__ = 0; k_0__ < y_pred_k_0_max__; ++k_0__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "y_pred" << '.' << k_0__ + 1;
            param_names__.push_back(param_name_stream__.str());
        }
        size_t pred_loglambda_j_1_max__ = N_y_pred;
        for (size_t j_1__ = 0; j_1__ < pred_loglambda_j_1_max__; ++j_1__) {
            param_name_stream__.str(std::string());
            param_name_stream__ << "pred_loglambda" << '.' << j_1__ + 1;
            param_names__.push_back(param_name_stream__.str());
        }
    }

}; // model

}  // namespace

typedef model2470278f2f7b_stan_glm_namespace::model2470278f2f7b_stan_glm 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