// Code generated by stanc v2.36.0
#include <stan/model/model_header.hpp>
namespace mdcev_model_namespace {
using stan::model::model_base_crtp;
using namespace stan::math;
stan::math::profile_map profiles__;
static constexpr std::array<const char*, 306> locations_array__ =
  {" (found before start of program)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 30, column 1 to column 27)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 31, column 1 to column 27)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 32, column 1 to column 40)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 33, column 1 to column 44)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 34, column 1 to column 26)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 35, column 3 to column 26)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 39, column 1 to column 20)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 131, column 1 to column 51)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 132, column 1 to column 32)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 41, column 7 to column 8)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 41, column 17 to column 18)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 41, column 1 to column 34)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 43, column 9 to column 10)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 43, column 12 to column 13)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 43, column 2 to column 60)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 44, column 9 to column 10)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 44, column 12 to column 13)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 44, column 2 to column 20)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 45, column 9 to column 10)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 45, column 2 to column 57)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 46, column 2 to column 70)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 47, column 9 to column 13)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 47, column 2 to column 30)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 60, column 7 to column 34)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 58, column 7 to column 52)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 57, column 3 to line 60, column 34)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 56, column 27 to line 61, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 56, column 9 to line 61, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 54, column 4 to column 59)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 53, column 10 to line 55, column 4)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 51, column 4 to column 59)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 52, column 4 to column 71)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 50, column 19 to line 53, column 4)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 50, column 3 to line 55, column 4)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 49, column 20 to line 56, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 49, column 2 to line 61, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 76, column 10 to column 11)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 76, column 13 to column 14)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 76, column 3 to column 23)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 80, column 7 to column 36)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 79, column 8 to line 80, column 36)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 78, column 7 to column 60)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 77, column 3 to line 80, column 36)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 87, column 3 to line 89, column 59)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 86, column 20 to line 90, column 4)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 86, column 10 to line 90, column 4)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 83, column 3 to line 85, column 59)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 82, column 14 to line 86, column 4)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 82, column 3 to line 90, column 4)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 75, column 28 to line 91, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 75, column 9 to line 91, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 64, column 10 to column 11)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 64, column 13 to column 14)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 64, column 3 to column 64)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 71, column 3 to line 73, column 31)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 70, column 20 to line 74, column 4)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 70, column 10 to line 74, column 4)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 67, column 3 to line 69, column 31)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 66, column 14 to line 70, column 4)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 66, column 3 to line 74, column 4)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 63, column 19 to line 75, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 63, column 2 to line 91, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 42, column 15 to line 92, column 2)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 42, column 1 to line 92, column 2)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 95, column 9 to column 10)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 95, column 12 to column 15)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 95, column 2 to column 50)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 97, column 10 to column 11)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 97, column 3 to column 65)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 98, column 10 to column 11)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 98, column 3 to column 57)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 99, column 3 to column 34)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 96, column 15 to line 100, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 96, column 2 to line 100, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 94, column 11 to line 101, column 2)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 94, column 1 to line 101, column 2)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 40, column 1 to line 102, column 2)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 135, column 9 to column 10)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 135, column 12 to column 15)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 135, column 2 to column 50)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 137, column 5 to column 56)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 136, column 2 to line 137, column 56)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 134, column 11 to line 138, column 2)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 134, column 1 to line 138, column 2)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 108, column 1 to column 35)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 117, column 2 to column 47)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 119, column 3 to column 47)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 120, column 3 to column 47)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 121, column 3 to column 51)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 122, column 3 to column 68)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 118, column 16 to line 123, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 118, column 2 to line 123, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 116, column 18 to line 124, column 2)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 116, column 8 to line 124, column 2)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 111, column 3 to column 36)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 112, column 3 to column 36)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 113, column 3 to column 40)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 114, column 3 to column 57)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 110, column 13 to line 116, column 2)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 110, column 3 to line 124, column 2)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 107, column 22 to line 125, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 107, column 2 to line 125, column 3)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 127, column 0 to column 41)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 2, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 3, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 4, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 5, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 6, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 7, column 8, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 7, column 34, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 7, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 8, column 8, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 8, column 37, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 8, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 9, column 7, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 9, column 10, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 9, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 10, column 7, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 10, column 10, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 10, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 11, column 7, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 11, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 12, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 13, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 14, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 15, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 16, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 17, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 18, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 19, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 20, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 21, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 22, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 23, column 7, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_data.stan', line 23, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 11, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 12, column 31 to column 7)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 15, column 1 to column 7)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 17, column 8 to column 9)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 17, column 11 to column 12)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 17, column 1 to column 25)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 18, column 1 to column 36)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 19, column 1 to column 21)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 2, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 3, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 4, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 5, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 6, column 7, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 6, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 7, column 7, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 7, column 10, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 7, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 8, column 7, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 8, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 9, column 7, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 9, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 11, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 15, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 14, column 14, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 14, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 17, column 3, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 13, column 13, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 13, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 20, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 26, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 25, column 25, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 25, column 7, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 24, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 23, column 18, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 23, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 36, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 37, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 35, column 26, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 35, column 7, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 33, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 34, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 32, column 26, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 32, column 7, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 30, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 31, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 29, column 55, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 29, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 41, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 40, column 38, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 40, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 47, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 46, column 5, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 45, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_tdata.stan', line 44, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 23, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 26, column 1 to column 7)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 24, column 32 to line 26, column 7)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 30, column 7 to column 8)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 30, column 17 to column 21)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 31, column 7 to column 8)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 31, column 17 to column 21)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 32, column 7 to column 8)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 32, column 27 to column 32)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 33, column 7 to column 8)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 33, column 35 to column 36)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 34, column 17 to column 18)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 35, column 10 to column 15)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 35, column 17 to column 18)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 39, column 8 to column 9)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 132, column 8 to column 21)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 132, column 23 to column 24)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 4, column 8, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 4, column 11, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 4, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 11, column 3, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 10, column 6, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 9, column 3, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 8, column 6, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 7, column 3, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 6, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 13, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 2, column 55, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 18, column 8, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 18, column 11, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 18, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 25, column 3, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 24, column 6, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 23, column 3, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 22, column 6, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 21, column 3, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 20, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 27, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 16, column 61, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 32, column 8, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 32, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 37, column 3, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 35, column 3, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 34, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 39, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 30, column 54, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 47, column 8, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 47, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 48, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 49, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 50, column 8, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 50, column 11, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 50, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 51, column 8, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 51, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 52, column 8, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 52, column 11, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 52, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 53, column 8, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 53, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 54, column 8, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 54, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 56, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 61, column 9, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 61, column 12, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 61, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 62, column 9, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 62, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 64, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 66, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 60, column 21, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 60, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 69, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 45, column 51, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 75, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 76, column 9, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 76, column 12, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 76, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 77, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 78, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 80, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 73, column 40, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 87, column 11, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 87, column 4, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 88, column 11, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 88, column 4, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 89, column 4, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 90, column 4, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 91, column 11, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 91, column 14, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 91, column 4, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 92, column 11, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 92, column 14, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 92, column 4, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 93, column 11, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 93, column 4, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 94, column 11, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 94, column 4, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 103, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 102, column 42, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 102, column 8, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 98, column 9, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 98, column 2, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 99, column 9, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 97, column 16, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 97, column 3, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 96, column 35, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 96, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 107, column 3, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 110, column 3, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 114, column 10, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 114, column 3, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 117, column 6, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 119, column 6, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 113, column 20, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 113, column 1, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 122, column 0, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)",
  " (in 'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/common/mdcev_ll.stan', line 85, column 85, included from\n'C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan/mdcev.stan', line 4, column 0)"};
template <typename T0__, typename T1__, typename T2__, typename T3__,
          stan::require_all_t<stan::is_col_vector<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              std::is_integral<T1__>, std::is_integral<T2__>,
                              std::is_integral<T3__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T0__>>,-1,-1>
gamma_ll(const T0__& gamma_arg__, const T1__& I, const T2__& J, const T3__&
         Gamma, std::ostream* pstream__);
template <typename T0__, typename T1__, typename T2__, typename T3__,
          stan::require_all_t<stan::is_col_vector<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              std::is_integral<T1__>, std::is_integral<T2__>,
                              std::is_integral<T3__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T0__>>,-1,-1>
alpha_j_ll(const T0__& alpha_arg__, const T1__& I, const T2__& J, const T3__&
           model_num, std::ostream* pstream__);
template <typename T0__, typename T1__, typename T2__,
          stan::require_all_t<stan::is_col_vector<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              std::is_integral<T1__>, std::is_integral<T2__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T0__>>,-1,1>
alpha_1_ll(const T0__& alpha_arg__, const T1__& I, const T2__& model_num,
           std::ostream* pstream__);
template <typename T0__, typename T1__, typename T2__, typename T3__,
          typename T4__, typename T5__, typename T6__, typename T7__,
          typename T8__, typename T9__, typename T10__, typename T11__,
          typename T12__, typename T13__, typename T14__,
          stan::require_all_t<stan::is_eigen_matrix_dynamic<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              stan::is_eigen_matrix_dynamic<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T4__>,
                              stan::is_vt_not_complex<T4__>,
                              stan::is_col_vector<T5__>,
                              stan::is_vt_not_complex<T5__>,
                              stan::is_eigen_matrix_dynamic<T6__>,
                              stan::is_vt_not_complex<T6__>,
                              stan::is_eigen_matrix_dynamic<T7__>,
                              stan::is_vt_not_complex<T7__>,
                              stan::is_col_vector<T8__>,
                              stan::is_vt_not_complex<T8__>,
                              stan::is_eigen_matrix_dynamic<T9__>,
                              stan::is_vt_not_complex<T9__>,
                              stan::math::disjunction<stan::is_autodiff<T10__>,
                                                      std::is_floating_point<T10__>>,
                              std::is_integral<T11__>,
                              std::is_integral<T12__>,
                              stan::is_eigen_matrix_dynamic<T13__>,
                              stan::is_vt_not_complex<T13__>,
                              std::is_integral<T14__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T0__>,
                stan::base_type_t<T1__>, stan::base_type_t<T2__>,
                stan::base_type_t<T3__>, stan::base_type_t<T4__>,
                stan::promote_args_t<stan::base_type_t<T5__>,
                  stan::base_type_t<T6__>, stan::base_type_t<T7__>,
                  stan::base_type_t<T8__>, stan::base_type_t<T9__>,
                  stan::promote_args_t<T10__, stan::base_type_t<T13__>>>>,-1,1>
mdcev_ll(const T0__& quant_j_arg__, const T1__& price_j_arg__, const T2__&
         log_num_arg__, const T3__& income_arg__, const T4__& M_arg__,
         const T5__& log_M_fact_arg__, const T6__& lpsi_arg__, const T7__&
         gamma_j_arg__, const T8__& alpha1_arg__, const T9__& alpha_j_arg__,
         const T10__& scale_full, const T11__& I, const T12__& J,
         const T13__& nonzero_arg__, const T14__& trunc_data, std::ostream*
         pstream__);
template <typename T0__, typename T1__, typename T2__, typename T3__,
          typename T4__,
          stan::require_all_t<stan::is_col_vector<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              stan::math::disjunction<stan::is_autodiff<T1__>,
                                                      std::is_floating_point<T1__>>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              std::is_integral<T4__>>* = nullptr>
stan::promote_args_t<stan::base_type_t<T0__>, T1__, stan::base_type_t<T2__>,
  stan::base_type_t<T3__>>
DeterminJacob(const T0__& phi_quant_term_arg__, const T1__& alpha,
              const T2__& price_j_num_arg__, const T3__& nonzero_arg__,
              const T4__& J, std::ostream* pstream__);
template <typename T0__, typename T1__, typename T2__, typename T3__,
          typename T4__, typename T5__, typename T6__, typename T7__,
          typename T8__, typename T9__, typename T10__, typename T11__,
          typename T12__, typename T13__,
          stan::require_all_t<stan::is_eigen_matrix_dynamic<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              stan::is_eigen_matrix_dynamic<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_eigen_matrix_dynamic<T4__>,
                              stan::is_vt_not_complex<T4__>,
                              stan::is_eigen_matrix_dynamic<T5__>,
                              stan::is_vt_not_complex<T5__>,
                              stan::is_eigen_matrix_dynamic<T6__>,
                              stan::is_vt_not_complex<T6__>,
                              stan::is_col_vector<T7__>,
                              stan::is_vt_not_complex<T7__>,
                              stan::math::disjunction<stan::is_autodiff<T8__>,
                                                      std::is_floating_point<T8__>>,
                              std::is_integral<T9__>,
                              std::is_integral<T10__>,
                              stan::is_eigen_matrix_dynamic<T11__>,
                              stan::is_vt_not_complex<T11__>,
                              std::is_integral<T12__>,
                              std::is_integral<T13__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T0__>,
                stan::base_type_t<T1__>, stan::base_type_t<T2__>,
                stan::base_type_t<T3__>, stan::base_type_t<T4__>,
                stan::promote_args_t<stan::base_type_t<T5__>,
                  stan::base_type_t<T6__>, stan::base_type_t<T7__>, T8__,
                  stan::base_type_t<T11__>>>,-1,1>
kt_ll(const T0__& quant_j_arg__, const T1__& price_j_arg__, const T2__&
      log_num_arg__, const T3__& income_arg__, const T4__& lpsi_arg__,
      const T5__& phi_ij_arg__, const T6__& gamma_arg__, const T7__&
      alpha_arg__, const T8__& scale_full, const T9__& I, const T10__& J,
      const T11__& nonzero_arg__, const T12__& trunc_data, const T13__&
      jacobian_analytical_grad, std::ostream* pstream__);
// matrix gamma_ll(vector, int, int, int)
template <typename T0__, typename T1__, typename T2__, typename T3__,
          stan::require_all_t<stan::is_col_vector<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              std::is_integral<T1__>, std::is_integral<T2__>,
                              std::is_integral<T3__>>*>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T0__>>,-1,-1>
gamma_ll(const T0__& gamma_arg__, const T1__& I, const T2__& J, const T3__&
         Gamma, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T0__>>;
  int current_statement__ = 0;
  // suppress unused var warning
  (void) current_statement__;
  const auto& gamma = stan::math::to_ref(gamma_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    current_statement__ = 205;
    stan::math::validate_non_negative_index("gamma_j", "I", I);
    current_statement__ = 206;
    stan::math::validate_non_negative_index("gamma_j", "J", J);
    Eigen::Matrix<local_scalar_t__,-1,-1> gamma_j =
      Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J, DUMMY_VAR__);
    current_statement__ = 213;
    if (stan::math::logical_eq(Gamma, 0)) {
      current_statement__ = 212;
      stan::model::assign(gamma_j, stan::math::rep_matrix(1, I, J),
        "assigning variable gamma_j");
    } else {
      current_statement__ = 211;
      if (stan::math::logical_eq(Gamma, J)) {
        current_statement__ = 210;
        stan::model::assign(gamma_j,
          stan::math::rep_matrix(stan::math::transpose(gamma), I),
          "assigning variable gamma_j");
      } else {
        current_statement__ = 209;
        if (stan::math::logical_eq(Gamma, 1)) {
          current_statement__ = 208;
          stan::model::assign(gamma_j,
            stan::math::rep_matrix(
              stan::model::rvalue(gamma, "gamma", stan::model::index_uni(1)),
              I, J), "assigning variable gamma_j");
        }
      }
    }
    current_statement__ = 214;
    return gamma_j;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
// matrix alpha_j_ll(vector, int, int, int)
template <typename T0__, typename T1__, typename T2__, typename T3__,
          stan::require_all_t<stan::is_col_vector<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              std::is_integral<T1__>, std::is_integral<T2__>,
                              std::is_integral<T3__>>*>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T0__>>,-1,-1>
alpha_j_ll(const T0__& alpha_arg__, const T1__& I, const T2__& J, const T3__&
           model_num, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T0__>>;
  int current_statement__ = 0;
  // suppress unused var warning
  (void) current_statement__;
  const auto& alpha = stan::math::to_ref(alpha_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    current_statement__ = 216;
    stan::math::validate_non_negative_index("alpha_j", "I", I);
    current_statement__ = 217;
    stan::math::validate_non_negative_index("alpha_j", "J", J);
    Eigen::Matrix<local_scalar_t__,-1,-1> alpha_j =
      Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J, DUMMY_VAR__);
    current_statement__ = 224;
    if ((stan::math::primitive_value(
           (stan::math::primitive_value(stan::math::logical_eq(model_num, 1))
           ||
           stan::math::primitive_value(stan::math::logical_eq(model_num, 4))))
        || stan::math::primitive_value(stan::math::logical_eq(model_num, 5)))) {
      current_statement__ = 223;
      stan::model::assign(alpha_j, stan::math::rep_matrix(0, I, J),
        "assigning variable alpha_j");
    } else {
      current_statement__ = 222;
      if (stan::math::logical_eq(model_num, 2)) {
        current_statement__ = 221;
        stan::model::assign(alpha_j,
          stan::math::rep_matrix(
            stan::math::transpose(
              stan::model::rvalue(alpha, "alpha",
                stan::model::index_min_max(2, (J + 1)))), I),
          "assigning variable alpha_j");
      } else {
        current_statement__ = 220;
        if (stan::math::logical_eq(model_num, 3)) {
          current_statement__ = 219;
          stan::model::assign(alpha_j,
            stan::math::rep_matrix(
              stan::model::rvalue(alpha, "alpha", stan::model::index_uni(1)),
              I, J), "assigning variable alpha_j");
        }
      }
    }
    current_statement__ = 225;
    return alpha_j;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
// vector alpha_1_ll(vector, int, int)
template <typename T0__, typename T1__, typename T2__,
          stan::require_all_t<stan::is_col_vector<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              std::is_integral<T1__>, std::is_integral<T2__>>*>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T0__>>,-1,1>
alpha_1_ll(const T0__& alpha_arg__, const T1__& I, const T2__& model_num,
           std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T0__>>;
  int current_statement__ = 0;
  // suppress unused var warning
  (void) current_statement__;
  const auto& alpha = stan::math::to_ref(alpha_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    current_statement__ = 227;
    stan::math::validate_non_negative_index("alpha_1", "I", I);
    Eigen::Matrix<local_scalar_t__,-1,1> alpha_1 =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
    current_statement__ = 231;
    if (stan::math::logical_eq(model_num, 4)) {
      current_statement__ = 230;
      stan::model::assign(alpha_1, stan::math::rep_vector(0, I),
        "assigning variable alpha_1");
    } else {
      current_statement__ = 229;
      stan::model::assign(alpha_1,
        stan::math::rep_vector(
          stan::model::rvalue(alpha, "alpha", stan::model::index_uni(1)), I),
        "assigning variable alpha_1");
    }
    current_statement__ = 232;
    return alpha_1;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
/* vector
   mdcev_ll(matrix, matrix, vector, vector, vector, vector, matrix, matrix,
            vector, matrix, real, int, int, matrix, int)
 */
template <typename T0__, typename T1__, typename T2__, typename T3__,
          typename T4__, typename T5__, typename T6__, typename T7__,
          typename T8__, typename T9__, typename T10__, typename T11__,
          typename T12__, typename T13__, typename T14__,
          stan::require_all_t<stan::is_eigen_matrix_dynamic<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              stan::is_eigen_matrix_dynamic<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T4__>,
                              stan::is_vt_not_complex<T4__>,
                              stan::is_col_vector<T5__>,
                              stan::is_vt_not_complex<T5__>,
                              stan::is_eigen_matrix_dynamic<T6__>,
                              stan::is_vt_not_complex<T6__>,
                              stan::is_eigen_matrix_dynamic<T7__>,
                              stan::is_vt_not_complex<T7__>,
                              stan::is_col_vector<T8__>,
                              stan::is_vt_not_complex<T8__>,
                              stan::is_eigen_matrix_dynamic<T9__>,
                              stan::is_vt_not_complex<T9__>,
                              stan::math::disjunction<stan::is_autodiff<T10__>,
                                                      std::is_floating_point<T10__>>,
                              std::is_integral<T11__>,
                              std::is_integral<T12__>,
                              stan::is_eigen_matrix_dynamic<T13__>,
                              stan::is_vt_not_complex<T13__>,
                              std::is_integral<T14__>>*>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T0__>,
                stan::base_type_t<T1__>, stan::base_type_t<T2__>,
                stan::base_type_t<T3__>, stan::base_type_t<T4__>,
                stan::promote_args_t<stan::base_type_t<T5__>,
                  stan::base_type_t<T6__>, stan::base_type_t<T7__>,
                  stan::base_type_t<T8__>, stan::base_type_t<T9__>,
                  stan::promote_args_t<T10__, stan::base_type_t<T13__>>>>,-1,1>
mdcev_ll(const T0__& quant_j_arg__, const T1__& price_j_arg__, const T2__&
         log_num_arg__, const T3__& income_arg__, const T4__& M_arg__,
         const T5__& log_M_fact_arg__, const T6__& lpsi_arg__, const T7__&
         gamma_j_arg__, const T8__& alpha1_arg__, const T9__& alpha_j_arg__,
         const T10__& scale_full, const T11__& I, const T12__& J,
         const T13__& nonzero_arg__, const T14__& trunc_data, std::ostream*
         pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T0__>,
                             stan::base_type_t<T1__>,
                             stan::base_type_t<T2__>,
                             stan::base_type_t<T3__>,
                             stan::base_type_t<T4__>,
                             stan::promote_args_t<stan::base_type_t<T5__>,
                               stan::base_type_t<T6__>,
                               stan::base_type_t<T7__>,
                               stan::base_type_t<T8__>,
                               stan::base_type_t<T9__>,
                               stan::promote_args_t<T10__,
                                 stan::base_type_t<T13__>>>>;
  int current_statement__ = 0;
  // suppress unused var warning
  (void) current_statement__;
  const auto& quant_j = stan::math::to_ref(quant_j_arg__);
  const auto& price_j = stan::math::to_ref(price_j_arg__);
  const auto& log_num = stan::math::to_ref(log_num_arg__);
  const auto& income = stan::math::to_ref(income_arg__);
  const auto& M = stan::math::to_ref(M_arg__);
  const auto& log_M_fact = stan::math::to_ref(log_M_fact_arg__);
  const auto& lpsi = stan::math::to_ref(lpsi_arg__);
  const auto& gamma_j = stan::math::to_ref(gamma_j_arg__);
  const auto& alpha1 = stan::math::to_ref(alpha1_arg__);
  const auto& alpha_j = stan::math::to_ref(alpha_j_arg__);
  const auto& nonzero = stan::math::to_ref(nonzero_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    current_statement__ = 234;
    stan::math::validate_non_negative_index("log_like", "I", I);
    Eigen::Matrix<local_scalar_t__,-1,1> log_like =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
    local_scalar_t__ inv_scale = DUMMY_VAR__;
    current_statement__ = 236;
    inv_scale = stan::math::inv(scale_full);
    local_scalar_t__ log_scale = DUMMY_VAR__;
    current_statement__ = 237;
    log_scale = stan::math::log(scale_full);
    current_statement__ = 238;
    stan::math::validate_non_negative_index("v_j", "I", I);
    current_statement__ = 239;
    stan::math::validate_non_negative_index("v_j", "J", J);
    Eigen::Matrix<local_scalar_t__,-1,-1> v_j =
      Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J, DUMMY_VAR__);
    current_statement__ = 240;
    stan::model::assign(v_j,
      stan::math::multiply(
        stan::math::subtract(
          stan::math::add(lpsi,
            stan::math::elt_multiply(stan::math::subtract(alpha_j, 1),
              stan::math::log(
                stan::math::add(stan::math::elt_divide(quant_j, gamma_j), 1)))),
          stan::math::log(price_j)), inv_scale), "assigning variable v_j");
    current_statement__ = 241;
    stan::math::validate_non_negative_index("v1", "I", I);
    Eigen::Matrix<local_scalar_t__,-1,1> v1 =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
    current_statement__ = 242;
    stan::model::assign(v1,
      stan::math::multiply(
        stan::math::elt_multiply(stan::math::subtract(alpha1, 1), log_num),
        inv_scale), "assigning variable v1");
    current_statement__ = 243;
    stan::math::validate_non_negative_index("logf", "I", I);
    current_statement__ = 244;
    stan::math::validate_non_negative_index("logf", "J", J);
    Eigen::Matrix<local_scalar_t__,-1,-1> logf =
      Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J, DUMMY_VAR__);
    current_statement__ = 245;
    stan::model::assign(logf,
      stan::math::subtract(stan::math::log1m(alpha_j),
        stan::math::log(stan::math::add(quant_j, gamma_j))),
      "assigning variable logf");
    current_statement__ = 246;
    stan::math::validate_non_negative_index("logf1", "I", I);
    Eigen::Matrix<local_scalar_t__,-1,1> logf1 =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
    current_statement__ = 247;
    stan::model::assign(logf1,
      stan::math::subtract(stan::math::log1m(alpha1), log_num),
      "assigning variable logf1");
    current_statement__ = 248;
    stan::math::validate_non_negative_index("sum_v_j", "I", I);
    Eigen::Matrix<local_scalar_t__,-1,1> sum_v_j =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
    current_statement__ = 249;
    stan::model::assign(sum_v_j,
      stan::math::multiply(stan::math::exp(v_j), stan::math::rep_vector(1, J)),
      "assigning variable sum_v_j");
    current_statement__ = 250;
    stan::model::assign(log_like,
      stan::math::add(
        stan::math::subtract(
          stan::math::add(
            stan::math::add(
              stan::math::add(
                stan::math::add(
                  stan::math::multiply(stan::math::subtract(1, M), log_scale),
                  logf1), v1),
              stan::math::rows_dot_product(nonzero,
                stan::math::add(logf, v_j))),
            stan::math::log(
              stan::math::add(stan::math::inv(stan::math::exp(logf1)),
                stan::math::rows_dot_product(nonzero,
                  stan::math::elt_divide(price_j, stan::math::exp(logf)))))),
          stan::math::elt_multiply(M,
            stan::math::log(stan::math::add(stan::math::exp(v1), sum_v_j)))),
        log_M_fact), "assigning variable log_like");
    current_statement__ = 259;
    if (stan::math::logical_eq(trunc_data, 1)) {
      current_statement__ = 251;
      stan::math::validate_non_negative_index("v_1", "I", I);
      current_statement__ = 252;
      stan::math::validate_non_negative_index("v_1", "J + 1", (J + 1));
      Eigen::Matrix<local_scalar_t__,-1,-1> v_1 =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, (J + 1),
          DUMMY_VAR__);
      current_statement__ = 253;
      stan::model::assign(v_1,
        stan::math::exp(
          stan::math::multiply(
            stan::math::append_col(
              stan::math::elt_multiply(stan::math::subtract(alpha1, 1),
                stan::math::log(income)),
              stan::math::subtract(lpsi, stan::math::log(price_j))),
            inv_scale)), "assigning variable v_1");
      current_statement__ = 254;
      stan::math::validate_non_negative_index("like_trunc", "I", I);
      Eigen::Matrix<local_scalar_t__,-1,1> like_trunc =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
      current_statement__ = 255;
      stan::model::assign(like_trunc,
        stan::math::elt_divide(stan::math::col(v_1, 1),
          stan::math::multiply(v_1, stan::math::rep_vector(1, (J + 1)))),
        "assigning variable like_trunc");
      current_statement__ = 256;
      stan::model::assign(like_trunc,
        stan::math::fmin(stan::model::deep_copy(like_trunc), 1),
        "assigning variable like_trunc");
      current_statement__ = 257;
      stan::model::assign(log_like,
        stan::math::subtract(stan::model::deep_copy(log_like),
          stan::math::log1m(like_trunc)), "assigning variable log_like");
    }
    current_statement__ = 260;
    return log_like;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
// real DeterminJacob(vector, real, vector, vector, int)
template <typename T0__, typename T1__, typename T2__, typename T3__,
          typename T4__,
          stan::require_all_t<stan::is_col_vector<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              stan::math::disjunction<stan::is_autodiff<T1__>,
                                                      std::is_floating_point<T1__>>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              std::is_integral<T4__>>*>
stan::promote_args_t<stan::base_type_t<T0__>, T1__, stan::base_type_t<T2__>,
  stan::base_type_t<T3__>>
DeterminJacob(const T0__& phi_quant_term_arg__, const T1__& alpha,
              const T2__& price_j_num_arg__, const T3__& nonzero_arg__,
              const T4__& J, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T0__>,
                             T1__, stan::base_type_t<T2__>,
                             stan::base_type_t<T3__>>;
  int current_statement__ = 0;
  // suppress unused var warning
  (void) current_statement__;
  const auto& phi_quant_term = stan::math::to_ref(phi_quant_term_arg__);
  const auto& price_j_num = stan::math::to_ref(price_j_num_arg__);
  const auto& nonzero = stan::math::to_ref(nonzero_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    local_scalar_t__ log_j_det = DUMMY_VAR__;
    current_statement__ = 263;
    stan::math::validate_non_negative_index("jac_mat", "J", J);
    current_statement__ = 264;
    stan::math::validate_non_negative_index("jac_mat", "J", J);
    Eigen::Matrix<local_scalar_t__,-1,-1> jac_mat =
      Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(J, J, DUMMY_VAR__);
    current_statement__ = 265;
    stan::model::assign(jac_mat,
      stan::math::add_diag(
        stan::math::rep_matrix(
          stan::math::multiply((1 - alpha), price_j_num), J),
        stan::math::inv(phi_quant_term)), "assigning variable jac_mat");
    current_statement__ = 266;
    stan::model::assign(jac_mat,
      stan::math::add_diag(
        stan::math::diag_post_multiply(stan::model::deep_copy(jac_mat),
          nonzero), stan::math::subtract(1, nonzero)),
      "assigning variable jac_mat");
    current_statement__ = 267;
    log_j_det = stan::math::log_determinant(jac_mat);
    current_statement__ = 268;
    return log_j_det;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
/* vector
   kt_ll(matrix, matrix, vector, vector, matrix, matrix, matrix, vector, 
         real, int, int, matrix, int, int)
 */
template <typename T0__, typename T1__, typename T2__, typename T3__,
          typename T4__, typename T5__, typename T6__, typename T7__,
          typename T8__, typename T9__, typename T10__, typename T11__,
          typename T12__, typename T13__,
          stan::require_all_t<stan::is_eigen_matrix_dynamic<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              stan::is_eigen_matrix_dynamic<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_eigen_matrix_dynamic<T4__>,
                              stan::is_vt_not_complex<T4__>,
                              stan::is_eigen_matrix_dynamic<T5__>,
                              stan::is_vt_not_complex<T5__>,
                              stan::is_eigen_matrix_dynamic<T6__>,
                              stan::is_vt_not_complex<T6__>,
                              stan::is_col_vector<T7__>,
                              stan::is_vt_not_complex<T7__>,
                              stan::math::disjunction<stan::is_autodiff<T8__>,
                                                      std::is_floating_point<T8__>>,
                              std::is_integral<T9__>,
                              std::is_integral<T10__>,
                              stan::is_eigen_matrix_dynamic<T11__>,
                              stan::is_vt_not_complex<T11__>,
                              std::is_integral<T12__>,
                              std::is_integral<T13__>>*>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T0__>,
                stan::base_type_t<T1__>, stan::base_type_t<T2__>,
                stan::base_type_t<T3__>, stan::base_type_t<T4__>,
                stan::promote_args_t<stan::base_type_t<T5__>,
                  stan::base_type_t<T6__>, stan::base_type_t<T7__>, T8__,
                  stan::base_type_t<T11__>>>,-1,1>
kt_ll(const T0__& quant_j_arg__, const T1__& price_j_arg__, const T2__&
      log_num_arg__, const T3__& income_arg__, const T4__& lpsi_arg__,
      const T5__& phi_ij_arg__, const T6__& gamma_arg__, const T7__&
      alpha_arg__, const T8__& scale_full, const T9__& I, const T10__& J,
      const T11__& nonzero_arg__, const T12__& trunc_data, const T13__&
      jacobian_analytical_grad, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T0__>,
                             stan::base_type_t<T1__>,
                             stan::base_type_t<T2__>,
                             stan::base_type_t<T3__>,
                             stan::base_type_t<T4__>,
                             stan::promote_args_t<stan::base_type_t<T5__>,
                               stan::base_type_t<T6__>,
                               stan::base_type_t<T7__>, T8__,
                               stan::base_type_t<T11__>>>;
  int current_statement__ = 0;
  // suppress unused var warning
  (void) current_statement__;
  const auto& quant_j = stan::math::to_ref(quant_j_arg__);
  const auto& price_j = stan::math::to_ref(price_j_arg__);
  const auto& log_num = stan::math::to_ref(log_num_arg__);
  const auto& income = stan::math::to_ref(income_arg__);
  const auto& lpsi = stan::math::to_ref(lpsi_arg__);
  const auto& phi_ij = stan::math::to_ref(phi_ij_arg__);
  const auto& gamma = stan::math::to_ref(gamma_arg__);
  const auto& alpha = stan::math::to_ref(alpha_arg__);
  const auto& nonzero = stan::math::to_ref(nonzero_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    current_statement__ = 270;
    stan::math::validate_non_negative_index("log_like", "I", I);
    Eigen::Matrix<local_scalar_t__,-1,1> log_like =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
    current_statement__ = 272;
    stan::math::validate_non_negative_index("ones_j", "J", J);
    Eigen::Matrix<local_scalar_t__,-1,1> ones_j =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(J, DUMMY_VAR__);
    current_statement__ = 273;
    stan::model::assign(ones_j, stan::math::rep_vector(1, J),
      "assigning variable ones_j");
    local_scalar_t__ inv_scale = DUMMY_VAR__;
    current_statement__ = 274;
    inv_scale = stan::math::inv(scale_full);
    local_scalar_t__ log_scale = DUMMY_VAR__;
    current_statement__ = 275;
    log_scale = stan::math::log(scale_full);
    current_statement__ = 276;
    stan::math::validate_non_negative_index("g", "I", I);
    current_statement__ = 277;
    stan::math::validate_non_negative_index("g", "J", J);
    Eigen::Matrix<local_scalar_t__,-1,-1> g =
      Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J, DUMMY_VAR__);
    current_statement__ = 279;
    stan::math::validate_non_negative_index("phi_quant_term", "I", I);
    current_statement__ = 280;
    stan::math::validate_non_negative_index("phi_quant_term", "J", J);
    Eigen::Matrix<local_scalar_t__,-1,-1> phi_quant_term =
      Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J, DUMMY_VAR__);
    current_statement__ = 281;
    stan::model::assign(phi_quant_term,
      stan::math::elt_divide(
        stan::math::add(stan::math::elt_multiply(phi_ij, quant_j), gamma),
        phi_ij), "assigning variable phi_quant_term");
    current_statement__ = 282;
    stan::math::validate_non_negative_index("log_j_det", "I", I);
    Eigen::Matrix<local_scalar_t__,-1,1> log_j_det =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
    current_statement__ = 284;
    stan::math::validate_non_negative_index("alpha_comp", "I", I);
    Eigen::Matrix<local_scalar_t__,-1,1> alpha_comp =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
    current_statement__ = 285;
    stan::model::assign(alpha_comp, stan::math::subtract(1, alpha),
      "assigning variable alpha_comp");
    current_statement__ = 295;
    if (stan::math::logical_eq(jacobian_analytical_grad, 0)) {
      current_statement__ = 293;
      for (int i = 1; i <= I; ++i) {
        current_statement__ = 289;
        stan::math::validate_non_negative_index("price_j_num", "J", J);
        Eigen::Matrix<local_scalar_t__,-1,1> price_j_num =
          Eigen::Matrix<local_scalar_t__,-1,1>::Constant(J, DUMMY_VAR__);
        current_statement__ = 290;
        stan::model::assign(price_j_num,
          stan::math::elt_divide(
            stan::math::transpose(
              stan::model::rvalue(price_j, "price_j",
                stan::model::index_uni(i))),
            stan::math::exp(
              stan::model::rvalue(log_num, "log_num",
                stan::model::index_uni(i)))),
          "assigning variable price_j_num");
        current_statement__ = 291;
        stan::model::assign(log_j_det,
          DeterminJacob(
            stan::math::transpose(
              stan::model::rvalue(phi_quant_term, "phi_quant_term",
                stan::model::index_uni(i))),
            stan::model::rvalue(alpha, "alpha", stan::model::index_uni(i)),
            price_j_num,
            stan::math::transpose(
              stan::model::rvalue(nonzero, "nonzero",
                stan::model::index_uni(i))), J, pstream__),
          "assigning variable log_j_det", stan::model::index_uni(i));
      }
    } else {
      current_statement__ = 288;
      if (stan::math::logical_eq(jacobian_analytical_grad, 1)) {
        current_statement__ = 286;
        stan::model::assign(log_j_det,
          stan::math::add(
            stan::math::add(
              stan::math::subtract(stan::math::log(alpha_comp), log_num),
              stan::math::rows_dot_product(nonzero,
                stan::math::log(stan::math::inv(phi_quant_term)))),
            stan::math::log(
              stan::math::add(
                stan::math::elt_divide(stan::math::exp(log_num), alpha_comp),
                stan::math::rows_dot_product(nonzero,
                  stan::math::elt_multiply(phi_quant_term, price_j))))),
          "assigning variable log_j_det");
      }
    }
    current_statement__ = 296;
    stan::model::assign(g,
      stan::math::multiply(
        stan::math::subtract(
          stan::math::add(stan::math::minus(lpsi),
            stan::math::log(stan::math::elt_multiply(phi_quant_term, price_j))),
          stan::math::rep_matrix(
            stan::math::elt_multiply(alpha_comp, log_num), J)), inv_scale),
      "assigning variable g");
    current_statement__ = 297;
    stan::model::assign(log_like,
      stan::math::add(log_j_det,
        stan::math::multiply(
          stan::math::add(
            stan::math::elt_multiply(nonzero,
              stan::math::subtract(stan::math::minus(g), log_scale)),
            stan::math::minus(stan::math::exp(stan::math::minus(g)))), ones_j)),
      "assigning variable log_like");
    current_statement__ = 303;
    if (stan::math::logical_eq(trunc_data, 1)) {
      current_statement__ = 298;
      stan::math::validate_non_negative_index("like_trunc", "I", I);
      Eigen::Matrix<local_scalar_t__,-1,1> like_trunc =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
      current_statement__ = 299;
      stan::model::assign(like_trunc,
        stan::math::exp(
          stan::math::multiply(
            stan::math::minus(
              stan::math::exp(
                stan::math::multiply(
                  stan::math::minus(
                    stan::math::subtract(
                      stan::math::add(
                        stan::math::subtract(
                          stan::math::add(stan::math::minus(lpsi),
                            stan::math::log(price_j)),
                          stan::math::log(phi_ij)), stan::math::log(gamma)),
                      stan::math::rep_matrix(
                        stan::math::elt_multiply(alpha_comp,
                          stan::math::log(income)), J))), inv_scale))),
            ones_j)), "assigning variable like_trunc");
      current_statement__ = 300;
      stan::model::assign(like_trunc,
        stan::math::fmin(stan::model::deep_copy(like_trunc), 1),
        "assigning variable like_trunc");
      current_statement__ = 301;
      stan::model::assign(log_like,
        stan::math::subtract(stan::model::deep_copy(log_like),
          stan::math::log1m(like_trunc)), "assigning variable log_like");
    }
    current_statement__ = 304;
    return log_like;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
class mdcev_model final : public model_base_crtp<mdcev_model> {
 private:
  int I;
  int J;
  int NPsi_ij;
  int NPhi;
  int model_num;
  Eigen::Matrix<double,-1,-1> dat_psi_data__;
  Eigen::Matrix<double,-1,-1> dat_phi_data__;
  Eigen::Matrix<double,-1,-1> price_j_data__;
  Eigen::Matrix<double,-1,-1> quant_j_data__;
  Eigen::Matrix<double,-1,1> income_data__;
  int flat_priors;
  double prior_psi_sd;
  double prior_phi_sd;
  double prior_gamma_sd;
  double prior_alpha_shape;
  double prior_scale_sd;
  int fixed_scale1;
  int trunc_data;
  int jacobian_analytical_grad;
  int gamma_ascs;
  int psi_ascs;
  Eigen::Matrix<double,-1,1> weights_data__;
  int K;
  int L;
  Eigen::Matrix<double,-1,-1> data_class_data__;
  int single_scale;
  double prior_delta_sd;
  int A;
  int Gamma;
  int NPsi;
  int S;
  Eigen::Matrix<double,-1,1> log_num_data__;
  Eigen::Matrix<double,-1,-1> nonzero_data__;
  Eigen::Matrix<double,-1,1> M_data__;
  Eigen::Matrix<double,-1,1> log_M_fact_data__;
  int delta_1dim__;
  int theta_1dim__;
  Eigen::Map<Eigen::Matrix<double,-1,-1>> dat_psi{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> dat_phi{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> price_j{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> quant_j{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> income{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> weights{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> data_class{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> log_num{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> nonzero{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> M{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> log_M_fact{nullptr, 0};
 public:
  ~mdcev_model() {}
  mdcev_model(stan::io::var_context& context__, unsigned int
              random_seed__ = 0, std::ostream* pstream__ = nullptr)
      : model_base_crtp(0) {
    int current_statement__ = 0;
    // suppress unused var warning
    (void) current_statement__;
    using local_scalar_t__ = double;
    auto base_rng__ = stan::services::util::create_rng(random_seed__, 0);
    // suppress unused var warning
    (void) base_rng__;
    static constexpr const char* function__ =
      "mdcev_model_namespace::mdcev_model";
    // suppress unused var warning
    (void) function__;
    local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
    // suppress unused var warning
    (void) DUMMY_VAR__;
    try {
      int pos__ = std::numeric_limits<int>::min();
      pos__ = 1;
      current_statement__ = 104;
      context__.validate_dims("data initialization", "I", "int",
        std::vector<size_t>{});
      I = std::numeric_limits<int>::min();
      current_statement__ = 104;
      I = context__.vals_i("I")[(1 - 1)];
      current_statement__ = 105;
      context__.validate_dims("data initialization", "J", "int",
        std::vector<size_t>{});
      J = std::numeric_limits<int>::min();
      current_statement__ = 105;
      J = context__.vals_i("J")[(1 - 1)];
      current_statement__ = 106;
      context__.validate_dims("data initialization", "NPsi_ij", "int",
        std::vector<size_t>{});
      NPsi_ij = std::numeric_limits<int>::min();
      current_statement__ = 106;
      NPsi_ij = context__.vals_i("NPsi_ij")[(1 - 1)];
      current_statement__ = 107;
      context__.validate_dims("data initialization", "NPhi", "int",
        std::vector<size_t>{});
      NPhi = std::numeric_limits<int>::min();
      current_statement__ = 107;
      NPhi = context__.vals_i("NPhi")[(1 - 1)];
      current_statement__ = 108;
      context__.validate_dims("data initialization", "model_num", "int",
        std::vector<size_t>{});
      model_num = std::numeric_limits<int>::min();
      current_statement__ = 108;
      model_num = context__.vals_i("model_num")[(1 - 1)];
      current_statement__ = 108;
      stan::math::check_greater_or_equal(function__, "model_num", model_num,
        1);
      current_statement__ = 108;
      stan::math::check_less_or_equal(function__, "model_num", model_num, 5);
      current_statement__ = 109;
      stan::math::validate_non_negative_index("dat_psi",
        "(NPsi_ij > 0 ? I * J : 0)", (stan::math::logical_gt(NPsi_ij, 0) ? (I
        * J) : 0));
      current_statement__ = 110;
      stan::math::validate_non_negative_index("dat_psi", "NPsi_ij", NPsi_ij);
      current_statement__ = 111;
      context__.validate_dims("data initialization", "dat_psi", "double",
        std::vector<size_t>{static_cast<size_t>(
                              (stan::math::logical_gt(NPsi_ij, 0) ? (I *
                              J) : 0)), static_cast<size_t>(NPsi_ij)});
      dat_psi_data__ = Eigen::Matrix<double,-1,-1>::Constant((stan::math::logical_gt(
                                                                NPsi_ij, 0) ? (I
                         * J) : 0), NPsi_ij,
                         std::numeric_limits<double>::quiet_NaN());
      new (&dat_psi)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(dat_psi_data__.data(),
        (stan::math::logical_gt(NPsi_ij, 0) ? (I * J) : 0), NPsi_ij);
      {
        std::vector<local_scalar_t__> dat_psi_flat__;
        current_statement__ = 111;
        dat_psi_flat__ = context__.vals_r("dat_psi");
        pos__ = 1;
        for (int sym1__ = 1; sym1__ <= NPsi_ij; ++sym1__) {
          for (int sym2__ = 1; sym2__ <=
               (stan::math::logical_gt(NPsi_ij, 0) ? (I * J) : 0); ++sym2__) {
            stan::model::assign(dat_psi, dat_psi_flat__[(pos__ - 1)],
              "assigning variable dat_psi", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            pos__ = (pos__ + 1);
          }
        }
      }
      current_statement__ = 112;
      stan::math::validate_non_negative_index("dat_phi",
        "(model_num == 5 ? I * J : 0)",
        (stan::math::logical_eq(model_num, 5) ? (I * J) : 0));
      current_statement__ = 113;
      stan::math::validate_non_negative_index("dat_phi", "NPhi", NPhi);
      current_statement__ = 114;
      context__.validate_dims("data initialization", "dat_phi", "double",
        std::vector<size_t>{static_cast<size_t>(
                              (stan::math::logical_eq(model_num, 5) ? (I *
                              J) : 0)), static_cast<size_t>(NPhi)});
      dat_phi_data__ = Eigen::Matrix<double,-1,-1>::Constant((stan::math::logical_eq(
                                                                model_num, 5) ? (I
                         * J) : 0), NPhi,
                         std::numeric_limits<double>::quiet_NaN());
      new (&dat_phi)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(dat_phi_data__.data(),
        (stan::math::logical_eq(model_num, 5) ? (I * J) : 0), NPhi);
      {
        std::vector<local_scalar_t__> dat_phi_flat__;
        current_statement__ = 114;
        dat_phi_flat__ = context__.vals_r("dat_phi");
        pos__ = 1;
        for (int sym1__ = 1; sym1__ <= NPhi; ++sym1__) {
          for (int sym2__ = 1; sym2__ <=
               (stan::math::logical_eq(model_num, 5) ? (I * J) : 0); ++sym2__) {
            stan::model::assign(dat_phi, dat_phi_flat__[(pos__ - 1)],
              "assigning variable dat_phi", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            pos__ = (pos__ + 1);
          }
        }
      }
      current_statement__ = 115;
      stan::math::validate_non_negative_index("price_j", "I", I);
      current_statement__ = 116;
      stan::math::validate_non_negative_index("price_j", "J", J);
      current_statement__ = 117;
      context__.validate_dims("data initialization", "price_j", "double",
        std::vector<size_t>{static_cast<size_t>(I), static_cast<size_t>(J)});
      price_j_data__ = Eigen::Matrix<double,-1,-1>::Constant(I, J,
                         std::numeric_limits<double>::quiet_NaN());
      new (&price_j)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(price_j_data__.data(), I, J);
      {
        std::vector<local_scalar_t__> price_j_flat__;
        current_statement__ = 117;
        price_j_flat__ = context__.vals_r("price_j");
        pos__ = 1;
        for (int sym1__ = 1; sym1__ <= J; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= I; ++sym2__) {
            stan::model::assign(price_j, price_j_flat__[(pos__ - 1)],
              "assigning variable price_j", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            pos__ = (pos__ + 1);
          }
        }
      }
      current_statement__ = 118;
      stan::math::validate_non_negative_index("quant_j", "I", I);
      current_statement__ = 119;
      stan::math::validate_non_negative_index("quant_j", "J", J);
      current_statement__ = 120;
      context__.validate_dims("data initialization", "quant_j", "double",
        std::vector<size_t>{static_cast<size_t>(I), static_cast<size_t>(J)});
      quant_j_data__ = Eigen::Matrix<double,-1,-1>::Constant(I, J,
                         std::numeric_limits<double>::quiet_NaN());
      new (&quant_j)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(quant_j_data__.data(), I, J);
      {
        std::vector<local_scalar_t__> quant_j_flat__;
        current_statement__ = 120;
        quant_j_flat__ = context__.vals_r("quant_j");
        pos__ = 1;
        for (int sym1__ = 1; sym1__ <= J; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= I; ++sym2__) {
            stan::model::assign(quant_j, quant_j_flat__[(pos__ - 1)],
              "assigning variable quant_j", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            pos__ = (pos__ + 1);
          }
        }
      }
      current_statement__ = 121;
      stan::math::validate_non_negative_index("income", "I", I);
      current_statement__ = 122;
      context__.validate_dims("data initialization", "income", "double",
        std::vector<size_t>{static_cast<size_t>(I)});
      income_data__ = Eigen::Matrix<double,-1,1>::Constant(I,
                        std::numeric_limits<double>::quiet_NaN());
      new (&income)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(income_data__.data(), I);
      {
        std::vector<local_scalar_t__> income_flat__;
        current_statement__ = 122;
        income_flat__ = context__.vals_r("income");
        pos__ = 1;
        for (int sym1__ = 1; sym1__ <= I; ++sym1__) {
          stan::model::assign(income, income_flat__[(pos__ - 1)],
            "assigning variable income", stan::model::index_uni(sym1__));
          pos__ = (pos__ + 1);
        }
      }
      current_statement__ = 123;
      context__.validate_dims("data initialization", "flat_priors", "int",
        std::vector<size_t>{});
      flat_priors = std::numeric_limits<int>::min();
      current_statement__ = 123;
      flat_priors = context__.vals_i("flat_priors")[(1 - 1)];
      current_statement__ = 123;
      stan::math::check_greater_or_equal(function__, "flat_priors",
        flat_priors, 0);
      current_statement__ = 123;
      stan::math::check_less_or_equal(function__, "flat_priors", flat_priors,
        1);
      current_statement__ = 124;
      context__.validate_dims("data initialization", "prior_psi_sd",
        "double", std::vector<size_t>{});
      prior_psi_sd = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 124;
      prior_psi_sd = context__.vals_r("prior_psi_sd")[(1 - 1)];
      current_statement__ = 125;
      context__.validate_dims("data initialization", "prior_phi_sd",
        "double", std::vector<size_t>{});
      prior_phi_sd = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 125;
      prior_phi_sd = context__.vals_r("prior_phi_sd")[(1 - 1)];
      current_statement__ = 126;
      context__.validate_dims("data initialization", "prior_gamma_sd",
        "double", std::vector<size_t>{});
      prior_gamma_sd = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 126;
      prior_gamma_sd = context__.vals_r("prior_gamma_sd")[(1 - 1)];
      current_statement__ = 127;
      context__.validate_dims("data initialization", "prior_alpha_shape",
        "double", std::vector<size_t>{});
      prior_alpha_shape = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 127;
      prior_alpha_shape = context__.vals_r("prior_alpha_shape")[(1 - 1)];
      current_statement__ = 128;
      context__.validate_dims("data initialization", "prior_scale_sd",
        "double", std::vector<size_t>{});
      prior_scale_sd = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 128;
      prior_scale_sd = context__.vals_r("prior_scale_sd")[(1 - 1)];
      current_statement__ = 129;
      context__.validate_dims("data initialization", "fixed_scale1", "int",
        std::vector<size_t>{});
      fixed_scale1 = std::numeric_limits<int>::min();
      current_statement__ = 129;
      fixed_scale1 = context__.vals_i("fixed_scale1")[(1 - 1)];
      current_statement__ = 129;
      stan::math::check_greater_or_equal(function__, "fixed_scale1",
        fixed_scale1, 0);
      current_statement__ = 129;
      stan::math::check_less_or_equal(function__, "fixed_scale1",
        fixed_scale1, 1);
      current_statement__ = 130;
      context__.validate_dims("data initialization", "trunc_data", "int",
        std::vector<size_t>{});
      trunc_data = std::numeric_limits<int>::min();
      current_statement__ = 130;
      trunc_data = context__.vals_i("trunc_data")[(1 - 1)];
      current_statement__ = 130;
      stan::math::check_greater_or_equal(function__, "trunc_data",
        trunc_data, 0);
      current_statement__ = 130;
      stan::math::check_less_or_equal(function__, "trunc_data", trunc_data, 1);
      current_statement__ = 131;
      context__.validate_dims("data initialization",
        "jacobian_analytical_grad", "int", std::vector<size_t>{});
      jacobian_analytical_grad = std::numeric_limits<int>::min();
      current_statement__ = 131;
      jacobian_analytical_grad = context__.vals_i("jacobian_analytical_grad")[(1
        - 1)];
      current_statement__ = 131;
      stan::math::check_greater_or_equal(function__,
        "jacobian_analytical_grad", jacobian_analytical_grad, 0);
      current_statement__ = 131;
      stan::math::check_less_or_equal(function__, "jacobian_analytical_grad",
        jacobian_analytical_grad, 1);
      current_statement__ = 132;
      context__.validate_dims("data initialization", "gamma_ascs", "int",
        std::vector<size_t>{});
      gamma_ascs = std::numeric_limits<int>::min();
      current_statement__ = 132;
      gamma_ascs = context__.vals_i("gamma_ascs")[(1 - 1)];
      current_statement__ = 132;
      stan::math::check_greater_or_equal(function__, "gamma_ascs",
        gamma_ascs, 0);
      current_statement__ = 132;
      stan::math::check_less_or_equal(function__, "gamma_ascs", gamma_ascs, 1);
      current_statement__ = 133;
      context__.validate_dims("data initialization", "psi_ascs", "int",
        std::vector<size_t>{});
      psi_ascs = std::numeric_limits<int>::min();
      current_statement__ = 133;
      psi_ascs = context__.vals_i("psi_ascs")[(1 - 1)];
      current_statement__ = 133;
      stan::math::check_greater_or_equal(function__, "psi_ascs", psi_ascs, 0);
      current_statement__ = 133;
      stan::math::check_less_or_equal(function__, "psi_ascs", psi_ascs, 1);
      current_statement__ = 134;
      stan::math::validate_non_negative_index("weights", "I", I);
      current_statement__ = 135;
      context__.validate_dims("data initialization", "weights", "double",
        std::vector<size_t>{static_cast<size_t>(I)});
      weights_data__ = Eigen::Matrix<double,-1,1>::Constant(I,
                         std::numeric_limits<double>::quiet_NaN());
      new (&weights)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(weights_data__.data(), I);
      {
        std::vector<local_scalar_t__> weights_flat__;
        current_statement__ = 135;
        weights_flat__ = context__.vals_r("weights");
        pos__ = 1;
        for (int sym1__ = 1; sym1__ <= I; ++sym1__) {
          stan::model::assign(weights, weights_flat__[(pos__ - 1)],
            "assigning variable weights", stan::model::index_uni(sym1__));
          pos__ = (pos__ + 1);
        }
      }
      current_statement__ = 136;
      context__.validate_dims("data initialization", "K", "int",
        std::vector<size_t>{});
      K = std::numeric_limits<int>::min();
      current_statement__ = 136;
      K = context__.vals_i("K")[(1 - 1)];
      current_statement__ = 137;
      context__.validate_dims("data initialization", "L", "int",
        std::vector<size_t>{});
      L = std::numeric_limits<int>::min();
      current_statement__ = 137;
      L = context__.vals_i("L")[(1 - 1)];
      current_statement__ = 138;
      stan::math::validate_non_negative_index("data_class", "I", I);
      current_statement__ = 139;
      stan::math::validate_non_negative_index("data_class", "L", L);
      current_statement__ = 140;
      context__.validate_dims("data initialization", "data_class", "double",
        std::vector<size_t>{static_cast<size_t>(I), static_cast<size_t>(L)});
      data_class_data__ = Eigen::Matrix<double,-1,-1>::Constant(I, L,
                            std::numeric_limits<double>::quiet_NaN());
      new (&data_class)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(data_class_data__.data(), I,
        L);
      {
        std::vector<local_scalar_t__> data_class_flat__;
        current_statement__ = 140;
        data_class_flat__ = context__.vals_r("data_class");
        pos__ = 1;
        for (int sym1__ = 1; sym1__ <= L; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= I; ++sym2__) {
            stan::model::assign(data_class, data_class_flat__[(pos__ - 1)],
              "assigning variable data_class",
              stan::model::index_uni(sym2__), stan::model::index_uni(sym1__));
            pos__ = (pos__ + 1);
          }
        }
      }
      current_statement__ = 141;
      context__.validate_dims("data initialization", "single_scale", "int",
        std::vector<size_t>{});
      single_scale = std::numeric_limits<int>::min();
      current_statement__ = 141;
      single_scale = context__.vals_i("single_scale")[(1 - 1)];
      current_statement__ = 141;
      stan::math::check_greater_or_equal(function__, "single_scale",
        single_scale, 0);
      current_statement__ = 141;
      stan::math::check_less_or_equal(function__, "single_scale",
        single_scale, 1);
      current_statement__ = 142;
      context__.validate_dims("data initialization", "prior_delta_sd",
        "double", std::vector<size_t>{});
      prior_delta_sd = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 142;
      prior_delta_sd = context__.vals_r("prior_delta_sd")[(1 - 1)];
      current_statement__ = 143;
      A = std::numeric_limits<int>::min();
      current_statement__ = 144;
      Gamma = std::numeric_limits<int>::min();
      current_statement__ = 145;
      NPsi = std::numeric_limits<int>::min();
      current_statement__ = 146;
      S = std::numeric_limits<int>::min();
      current_statement__ = 147;
      stan::math::validate_non_negative_index("log_num", "I", I);
      current_statement__ = 148;
      log_num_data__ = Eigen::Matrix<double,-1,1>::Constant(I,
                         std::numeric_limits<double>::quiet_NaN());
      new (&log_num)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(log_num_data__.data(), I);
      current_statement__ = 149;
      stan::math::validate_non_negative_index("nonzero", "I", I);
      current_statement__ = 150;
      stan::math::validate_non_negative_index("nonzero", "J", J);
      current_statement__ = 151;
      nonzero_data__ = Eigen::Matrix<double,-1,-1>::Constant(I, J,
                         std::numeric_limits<double>::quiet_NaN());
      new (&nonzero)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(nonzero_data__.data(), I, J);
      current_statement__ = 152;
      stan::math::validate_non_negative_index("M", "I", I);
      current_statement__ = 153;
      M_data__ = Eigen::Matrix<double,-1,1>::Constant(I,
                   std::numeric_limits<double>::quiet_NaN());
      new (&M) Eigen::Map<Eigen::Matrix<double,-1,1>>(M_data__.data(), I);
      current_statement__ = 154;
      stan::math::validate_non_negative_index("log_M_fact", "I", I);
      current_statement__ = 155;
      log_M_fact_data__ = Eigen::Matrix<double,-1,1>::Constant(I,
                            std::numeric_limits<double>::quiet_NaN());
      new (&log_M_fact)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(log_M_fact_data__.data(), I);
      current_statement__ = 156;
      stan::model::assign(log_num,
        stan::math::log(
          stan::math::subtract(income,
            stan::math::rows_dot_product(price_j, quant_j))),
        "assigning variable log_num");
      current_statement__ = 162;
      for (int i = 1; i <= I; ++i) {
        current_statement__ = 159;
        for (int j = 1; j <= J; ++j) {
          current_statement__ = 157;
          stan::model::assign(nonzero,
            (stan::math::logical_gt(
               stan::model::rvalue(quant_j, "quant_j",
                 stan::model::index_uni(i), stan::model::index_uni(j)), 0) ? 1 : 0),
            "assigning variable nonzero", stan::model::index_uni(i),
            stan::model::index_uni(j));
        }
        current_statement__ = 160;
        stan::model::assign(M,
          (stan::math::sum(
             stan::model::rvalue(nonzero, "nonzero",
               stan::model::index_uni(i))) + 1), "assigning variable M",
          stan::model::index_uni(i));
      }
      current_statement__ = 163;
      stan::model::assign(log_M_fact, stan::math::lgamma(M),
        "assigning variable log_M_fact");
      current_statement__ = 169;
      if (stan::math::logical_eq(psi_ascs, 1)) {
        current_statement__ = 167;
        NPsi = ((J - 1) + NPsi_ij);
      } else {
        current_statement__ = 166;
        if (stan::math::logical_eq(psi_ascs, 0)) {
          current_statement__ = 164;
          NPsi = NPsi_ij;
        }
      }
      current_statement__ = 181;
      if ((stan::math::primitive_value(
             (stan::math::primitive_value(
                stan::math::logical_eq(model_num, 1)) ||
             stan::math::primitive_value(stan::math::logical_eq(model_num, 3))))
          ||
          stan::math::primitive_value(stan::math::logical_eq(model_num, 5)))) {
        current_statement__ = 178;
        A = 1;
        current_statement__ = 179;
        Gamma = J;
      } else {
        current_statement__ = 177;
        if (stan::math::logical_eq(model_num, 2)) {
          current_statement__ = 174;
          A = (J + 1);
          current_statement__ = 175;
          Gamma = 0;
        } else {
          current_statement__ = 173;
          if (stan::math::logical_eq(model_num, 4)) {
            current_statement__ = 170;
            A = 0;
            current_statement__ = 171;
            Gamma = J;
          }
        }
      }
      current_statement__ = 184;
      if ((stan::math::primitive_value(stan::math::logical_neq(model_num, 2))
          &&
          stan::math::primitive_value(stan::math::logical_eq(gamma_ascs, 0)))) {
        current_statement__ = 182;
        Gamma = 1;
      }
      current_statement__ = 188;
      if (stan::math::logical_eq(fixed_scale1, 0)) {
        current_statement__ = 187;
        S = 1;
      } else {
        current_statement__ = 186;
        if (stan::math::logical_eq(fixed_scale1, 1)) {
          current_statement__ = 185;
          S = 0;
        }
      }
      current_statement__ = 190;
      if ((stan::math::primitive_value(
             stan::math::logical_eq(single_scale, 0))
          &&
          stan::math::primitive_value(stan::math::logical_eq(fixed_scale1, 0)))) {
        current_statement__ = 189;
        S = K;
      }
      current_statement__ = 191;
      stan::math::validate_non_negative_index("psi", "K", K);
      current_statement__ = 192;
      stan::math::validate_non_negative_index("psi", "NPsi", NPsi);
      current_statement__ = 193;
      stan::math::validate_non_negative_index("phi", "K", K);
      current_statement__ = 194;
      stan::math::validate_non_negative_index("phi", "NPhi", NPhi);
      current_statement__ = 195;
      stan::math::validate_non_negative_index("gamma", "K", K);
      current_statement__ = 196;
      stan::math::validate_non_negative_index("gamma", "Gamma", Gamma);
      current_statement__ = 197;
      stan::math::validate_non_negative_index("alpha", "K", K);
      current_statement__ = 198;
      stan::math::validate_non_negative_index("alpha", "A", A);
      current_statement__ = 199;
      stan::math::validate_non_negative_index("scale", "S", S);
      current_statement__ = 200;
      delta_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 200;
      delta_1dim__ = (K - 1);
      current_statement__ = 200;
      stan::math::validate_non_negative_index("delta", "K - 1", delta_1dim__);
      current_statement__ = 201;
      stan::math::validate_non_negative_index("delta", "L", L);
      current_statement__ = 202;
      stan::math::validate_non_negative_index("log_like", "I", I);
      current_statement__ = 203;
      theta_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 203;
      theta_1dim__ = (stan::math::logical_gt(K, 1) ? I : 0);
      current_statement__ = 203;
      stan::math::validate_non_negative_index("theta", "K > 1 ? I : 0",
        theta_1dim__);
      current_statement__ = 204;
      stan::math::validate_non_negative_index("theta", "K", K);
    } catch (const std::exception& e) {
      stan::lang::rethrow_located(e, locations_array__[current_statement__]);
    }
    num_params_r__ = (K * NPsi) + (K * NPhi) + (K * Gamma) + (K * A) + S +
      (delta_1dim__ * L);
  }
  inline std::string model_name() const final {
    return "mdcev_model";
  }
  inline std::vector<std::string> model_compile_info() const noexcept {
    return std::vector<std::string>{"stanc_version = stanc3 v2.36.0",
             "stancflags = --include-paths=C:/Users/plloy/Dropbox/1 PROJECT/rmdcev/inst/stan"};
  }
  // Base log prob
  template <bool propto__, bool jacobian__, typename VecR, typename VecI,
            stan::require_vector_like_t<VecR>* = nullptr,
            stan::require_vector_like_vt<std::is_integral, VecI>* = nullptr,
            stan::require_not_st_var<VecR>* = nullptr>
  inline stan::scalar_type_t<VecR>
  log_prob_impl(VecR& params_r__, VecI& params_i__, std::ostream*
                pstream__ = nullptr) const {
    using T__ = stan::scalar_type_t<VecR>;
    using local_scalar_t__ = T__;
    T__ lp__(0.0);
    stan::math::accumulator<T__> lp_accum__;
    stan::io::deserializer<local_scalar_t__> in__(params_r__, params_i__);
    int current_statement__ = 0;
    // suppress unused var warning
    (void) current_statement__;
    local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
    // suppress unused var warning
    (void) DUMMY_VAR__;
    static constexpr const char* function__ =
      "mdcev_model_namespace::log_prob";
    // suppress unused var warning
    (void) function__;
    try {
      current_statement__ = 1;
      auto psi =
        in__.template read<
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>>(K, NPsi);
      current_statement__ = 2;
      auto phi =
        in__.template read<
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>>(K, NPhi);
      current_statement__ = 3;
      auto gamma =
        in__.template read_constrain_lb<
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>, jacobian__>(0,
          lp__, K, Gamma);
      current_statement__ = 4;
      auto alpha =
        in__.template read_constrain_lub<
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>, jacobian__>(0,
          1, lp__, K, A);
      current_statement__ = 5;
      auto scale =
        in__.template read_constrain_lb<Eigen::Matrix<local_scalar_t__,-1,1>,
          jacobian__>(0, lp__, S);
      current_statement__ = 6;
      auto delta =
        in__.template read<
          Eigen::Matrix<local_scalar_t__,-1,-1>>(delta_1dim__, L);
      Eigen::Matrix<local_scalar_t__,-1,1> log_like =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
      {
        current_statement__ = 10;
        stan::math::validate_non_negative_index("log_like_util", "K", K);
        current_statement__ = 11;
        stan::math::validate_non_negative_index("log_like_util", "I", I);
        std::vector<Eigen::Matrix<local_scalar_t__,-1,1>> log_like_util =
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>(K,
            Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__));
        current_statement__ = 64;
        for (int k = 1; k <= K; ++k) {
          current_statement__ = 13;
          stan::math::validate_non_negative_index("gamma_full", "I", I);
          current_statement__ = 14;
          stan::math::validate_non_negative_index("gamma_full", "J", J);
          Eigen::Matrix<local_scalar_t__,-1,-1> gamma_full =
            Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J,
              DUMMY_VAR__);
          current_statement__ = 15;
          stan::model::assign(gamma_full,
            gamma_ll(
              stan::model::rvalue(gamma, "gamma", stan::model::index_uni(k)),
              I, J, Gamma, pstream__), "assigning variable gamma_full");
          current_statement__ = 16;
          stan::math::validate_non_negative_index("lpsi", "I", I);
          current_statement__ = 17;
          stan::math::validate_non_negative_index("lpsi", "J", J);
          Eigen::Matrix<local_scalar_t__,-1,-1> lpsi =
            Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J,
              DUMMY_VAR__);
          current_statement__ = 19;
          stan::math::validate_non_negative_index("alpha_1", "I", I);
          Eigen::Matrix<local_scalar_t__,-1,1> alpha_1 =
            Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
          current_statement__ = 20;
          stan::model::assign(alpha_1,
            alpha_1_ll(
              stan::model::rvalue(alpha, "alpha", stan::model::index_uni(k)),
              I, model_num, pstream__), "assigning variable alpha_1");
          local_scalar_t__ scale_full = DUMMY_VAR__;
          current_statement__ = 21;
          scale_full = (stan::math::logical_eq(S, 1) ? stan::model::rvalue(
                                                         scale, "scale",
                                                         stan::model::index_uni(
                                                           1)) : (stan::math::logical_eq(
                                                                    S, K) ? 
            stan::model::rvalue(scale, "scale", stan::model::index_uni(k)) : 1.0));
          current_statement__ = 22;
          stan::math::validate_non_negative_index("psi_k", "NPsi", NPsi);
          Eigen::Matrix<local_scalar_t__,-1,1> psi_k =
            Eigen::Matrix<local_scalar_t__,-1,1>::Constant(NPsi, DUMMY_VAR__);
          current_statement__ = 23;
          stan::model::assign(psi_k,
            stan::model::rvalue(psi, "psi", stan::model::index_uni(k)),
            "assigning variable psi_k");
          current_statement__ = 36;
          if (stan::math::logical_eq(psi_ascs, 1)) {
            current_statement__ = 34;
            if (stan::math::logical_gt(NPsi_ij, 0)) {
              current_statement__ = 31;
              stan::model::assign(lpsi,
                stan::math::rep_matrix(
                  stan::math::transpose(
                    stan::math::append_row(0,
                      stan::math::head(psi_k, (J - 1)))), I),
                "assigning variable lpsi");
              current_statement__ = 32;
              stan::model::assign(lpsi,
                stan::math::add(stan::model::deep_copy(lpsi),
                  stan::math::to_matrix(
                    stan::math::multiply(
                      stan::model::rvalue(dat_psi, "dat_psi",
                        stan::model::index_omni()),
                      stan::math::segment(psi_k, J, NPsi_ij)), I, J, 0)),
                "assigning variable lpsi");
            } else {
              current_statement__ = 29;
              stan::model::assign(lpsi,
                stan::math::rep_matrix(
                  stan::math::transpose(
                    stan::math::append_row(0,
                      stan::math::head(psi_k, (J - 1)))), I),
                "assigning variable lpsi");
            }
          } else {
            current_statement__ = 28;
            if (stan::math::logical_eq(psi_ascs, 0)) {
              current_statement__ = 26;
              if (stan::math::logical_gt(NPsi_ij, 0)) {
                current_statement__ = 25;
                stan::model::assign(lpsi,
                  stan::math::to_matrix(
                    stan::math::multiply(
                      stan::model::rvalue(dat_psi, "dat_psi",
                        stan::model::index_omni()), psi_k), I, J, 0),
                  "assigning variable lpsi");
              } else {
                current_statement__ = 24;
                stan::model::assign(lpsi, stan::math::rep_matrix(0, I, J),
                  "assigning variable lpsi");
              }
            }
          }
          current_statement__ = 62;
          if (stan::math::logical_lt(model_num, 5)) {
            current_statement__ = 52;
            stan::math::validate_non_negative_index("alpha_j", "I", I);
            current_statement__ = 53;
            stan::math::validate_non_negative_index("alpha_j", "J", J);
            Eigen::Matrix<local_scalar_t__,-1,-1> alpha_j =
              Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J,
                DUMMY_VAR__);
            current_statement__ = 54;
            stan::model::assign(alpha_j,
              alpha_j_ll(
                stan::model::rvalue(alpha, "alpha", stan::model::index_uni(k)),
                I, J, model_num, pstream__), "assigning variable alpha_j");
            current_statement__ = 60;
            if (stan::math::logical_eq(K, 1)) {
              current_statement__ = 58;
              stan::model::assign(log_like,
                mdcev_ll(quant_j, price_j, log_num, income, M, log_M_fact,
                  lpsi, gamma_full, alpha_1, alpha_j, scale_full, I, J,
                  nonzero, trunc_data, pstream__),
                "assigning variable log_like");
            } else {
              current_statement__ = 57;
              if (stan::math::logical_gt(K, 1)) {
                current_statement__ = 55;
                stan::model::assign(log_like_util,
                  mdcev_ll(quant_j, price_j, log_num, income, M, log_M_fact,
                    lpsi, gamma_full, alpha_1, alpha_j, scale_full, I, J,
                    nonzero, trunc_data, pstream__),
                  "assigning variable log_like_util",
                  stan::model::index_uni(k));
              }
            }
          } else {
            current_statement__ = 51;
            if (stan::math::logical_eq(model_num, 5)) {
              current_statement__ = 37;
              stan::math::validate_non_negative_index("phi_ij", "I", I);
              current_statement__ = 38;
              stan::math::validate_non_negative_index("phi_ij", "J", J);
              Eigen::Matrix<local_scalar_t__,-1,-1> phi_ij =
                Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J,
                  DUMMY_VAR__);
              current_statement__ = 43;
              if (stan::math::logical_gt(NPhi, 0)) {
                current_statement__ = 42;
                stan::model::assign(phi_ij,
                  stan::math::exp(
                    stan::math::to_matrix(
                      stan::math::multiply(
                        stan::model::rvalue(dat_phi, "dat_phi",
                          stan::model::index_omni()),
                        stan::model::rvalue(phi, "phi",
                          stan::model::index_uni(k))), I, J, 0)),
                  "assigning variable phi_ij");
              } else {
                current_statement__ = 41;
                if (stan::math::logical_eq(NPhi, 0)) {
                  current_statement__ = 40;
                  stan::model::assign(phi_ij,
                    stan::math::rep_matrix(1, I, J),
                    "assigning variable phi_ij");
                }
              }
              current_statement__ = 49;
              if (stan::math::logical_eq(K, 1)) {
                current_statement__ = 47;
                stan::model::assign(log_like,
                  kt_ll(quant_j, price_j, log_num, income, lpsi, phi_ij,
                    gamma_full, alpha_1, scale_full, I, J, nonzero,
                    trunc_data, jacobian_analytical_grad, pstream__),
                  "assigning variable log_like");
              } else {
                current_statement__ = 46;
                if (stan::math::logical_gt(K, 1)) {
                  current_statement__ = 44;
                  stan::model::assign(log_like_util,
                    kt_ll(quant_j, price_j, log_num, income, lpsi, phi_ij,
                      gamma_full, alpha_1, scale_full, I, J, nonzero,
                      trunc_data, jacobian_analytical_grad, pstream__),
                    "assigning variable log_like_util",
                    stan::model::index_uni(k));
                }
              }
            }
          }
        }
        current_statement__ = 76;
        if (stan::math::logical_gt(K, 1)) {
          current_statement__ = 65;
          stan::math::validate_non_negative_index("delta_data", "I", I);
          current_statement__ = 66;
          stan::math::validate_non_negative_index("delta_data", "K - 1", (K -
            1));
          Eigen::Matrix<local_scalar_t__,-1,-1> delta_data =
            Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, (K - 1),
              DUMMY_VAR__);
          current_statement__ = 67;
          stan::model::assign(delta_data,
            stan::math::multiply(data_class, stan::math::transpose(delta)),
            "assigning variable delta_data");
          current_statement__ = 74;
          for (int i = 1; i <= I; ++i) {
            current_statement__ = 68;
            stan::math::validate_non_negative_index("ltheta", "K", K);
            Eigen::Matrix<local_scalar_t__,-1,1> ltheta =
              Eigen::Matrix<local_scalar_t__,-1,1>::Constant(K, DUMMY_VAR__);
            current_statement__ = 69;
            stan::model::assign(ltheta,
              stan::math::log_softmax(
                stan::math::append_row(0,
                  stan::math::transpose(
                    stan::model::rvalue(delta_data, "delta_data",
                      stan::model::index_uni(i))))),
              "assigning variable ltheta");
            current_statement__ = 70;
            stan::math::validate_non_negative_index("lps", "K", K);
            Eigen::Matrix<local_scalar_t__,-1,1> lps =
              Eigen::Matrix<local_scalar_t__,-1,1>::Constant(K, DUMMY_VAR__);
            current_statement__ = 71;
            stan::model::assign(lps,
              stan::math::add(ltheta,
                stan::math::to_vector(
                  stan::model::rvalue(log_like_util, "log_like_util",
                    stan::model::index_omni(), stan::model::index_uni(i)))),
              "assigning variable lps");
            current_statement__ = 72;
            stan::model::assign(log_like, stan::math::log_sum_exp(lps),
              "assigning variable log_like", stan::model::index_uni(i));
          }
        }
      }
      {
        current_statement__ = 102;
        if (stan::math::logical_eq(flat_priors, 0)) {
          current_statement__ = 85;
          lp_accum__.add(stan::math::normal_lpdf<propto__>(scale, 0,
                           prior_scale_sd));
          current_statement__ = 100;
          if (stan::math::logical_eq(K, 1)) {
            current_statement__ = 95;
            lp_accum__.add(stan::math::normal_lpdf<propto__>(
                             stan::model::rvalue(psi, "psi",
                               stan::model::index_uni(1)), 0, prior_psi_sd));
            current_statement__ = 96;
            lp_accum__.add(stan::math::normal_lpdf<propto__>(
                             stan::model::rvalue(phi, "phi",
                               stan::model::index_uni(1)), 0, prior_phi_sd));
            current_statement__ = 97;
            lp_accum__.add(stan::math::normal_lpdf<propto__>(
                             stan::model::rvalue(gamma, "gamma",
                               stan::model::index_uni(1)), 1, prior_gamma_sd));
            current_statement__ = 98;
            lp_accum__.add(stan::math::beta_lpdf<propto__>(
                             stan::model::rvalue(alpha, "alpha",
                               stan::model::index_uni(1)), prior_alpha_shape,
                             prior_alpha_shape));
          } else {
            current_statement__ = 94;
            if (stan::math::logical_gt(K, 1)) {
              current_statement__ = 86;
              lp_accum__.add(stan::math::normal_lpdf<propto__>(
                               stan::math::to_vector(delta), 0,
                               prior_delta_sd));
              current_statement__ = 92;
              for (int k = 1; k <= K; ++k) {
                current_statement__ = 87;
                lp_accum__.add(stan::math::normal_lpdf<propto__>(
                                 stan::math::to_vector(
                                   stan::model::rvalue(psi, "psi",
                                     stan::model::index_uni(k))), 0,
                                 prior_psi_sd));
                current_statement__ = 88;
                lp_accum__.add(stan::math::normal_lpdf<propto__>(
                                 stan::math::to_vector(
                                   stan::model::rvalue(phi, "phi",
                                     stan::model::index_uni(k))), 0,
                                 prior_phi_sd));
                current_statement__ = 89;
                lp_accum__.add(stan::math::normal_lpdf<propto__>(
                                 stan::math::to_vector(
                                   stan::model::rvalue(gamma, "gamma",
                                     stan::model::index_uni(k))), 1,
                                 prior_gamma_sd));
                current_statement__ = 90;
                lp_accum__.add(stan::math::beta_lpdf<propto__>(
                                 stan::math::to_vector(
                                   stan::model::rvalue(alpha, "alpha",
                                     stan::model::index_uni(k))),
                                 prior_alpha_shape, prior_alpha_shape));
              }
            }
          }
        }
        current_statement__ = 103;
        lp_accum__.add(stan::math::dot_product(log_like, weights));
      }
    } catch (const std::exception& e) {
      stan::lang::rethrow_located(e, locations_array__[current_statement__]);
    }
    lp_accum__.add(lp__);
    return lp_accum__.sum();
  }
  // Reverse mode autodiff log prob
  template <bool propto__, bool jacobian__, typename VecR, typename VecI,
            stan::require_vector_like_t<VecR>* = nullptr,
            stan::require_vector_like_vt<std::is_integral, VecI>* = nullptr,
            stan::require_st_var<VecR>* = nullptr>
  inline stan::scalar_type_t<VecR>
  log_prob_impl(VecR& params_r__, VecI& params_i__, std::ostream*
                pstream__ = nullptr) const {
    using T__ = stan::scalar_type_t<VecR>;
    using local_scalar_t__ = T__;
    T__ lp__(0.0);
    stan::math::accumulator<T__> lp_accum__;
    stan::io::deserializer<local_scalar_t__> in__(params_r__, params_i__);
    int current_statement__ = 0;
    // suppress unused var warning
    (void) current_statement__;
    local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
    // suppress unused var warning
    (void) DUMMY_VAR__;
    static constexpr const char* function__ =
      "mdcev_model_namespace::log_prob";
    // suppress unused var warning
    (void) function__;
    try {
      current_statement__ = 1;
      auto psi =
        in__.template read<
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>>(K, NPsi);
      current_statement__ = 2;
      auto phi =
        in__.template read<
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>>(K, NPhi);
      current_statement__ = 3;
      auto gamma =
        in__.template read_constrain_lb<
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>, jacobian__>(0,
          lp__, K, Gamma);
      current_statement__ = 4;
      auto alpha =
        in__.template read_constrain_lub<
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>, jacobian__>(0,
          1, lp__, K, A);
      current_statement__ = 5;
      auto scale =
        in__.template read_constrain_lb<Eigen::Matrix<local_scalar_t__,-1,1>,
          jacobian__>(0, lp__, S);
      current_statement__ = 6;
      auto delta =
        in__.template read<
          Eigen::Matrix<local_scalar_t__,-1,-1>>(delta_1dim__, L);
      Eigen::Matrix<local_scalar_t__,-1,1> log_like =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
      {
        current_statement__ = 10;
        stan::math::validate_non_negative_index("log_like_util", "K", K);
        current_statement__ = 11;
        stan::math::validate_non_negative_index("log_like_util", "I", I);
        std::vector<Eigen::Matrix<local_scalar_t__,-1,1>> log_like_util =
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>(K,
            Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__));
        current_statement__ = 64;
        for (int k = 1; k <= K; ++k) {
          current_statement__ = 13;
          stan::math::validate_non_negative_index("gamma_full", "I", I);
          current_statement__ = 14;
          stan::math::validate_non_negative_index("gamma_full", "J", J);
          Eigen::Matrix<local_scalar_t__,-1,-1> gamma_full =
            Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J,
              DUMMY_VAR__);
          current_statement__ = 15;
          stan::model::assign(gamma_full,
            gamma_ll(
              stan::model::rvalue(gamma, "gamma", stan::model::index_uni(k)),
              I, J, Gamma, pstream__), "assigning variable gamma_full");
          current_statement__ = 16;
          stan::math::validate_non_negative_index("lpsi", "I", I);
          current_statement__ = 17;
          stan::math::validate_non_negative_index("lpsi", "J", J);
          Eigen::Matrix<local_scalar_t__,-1,-1> lpsi =
            Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J,
              DUMMY_VAR__);
          current_statement__ = 19;
          stan::math::validate_non_negative_index("alpha_1", "I", I);
          Eigen::Matrix<local_scalar_t__,-1,1> alpha_1 =
            Eigen::Matrix<local_scalar_t__,-1,1>::Constant(I, DUMMY_VAR__);
          current_statement__ = 20;
          stan::model::assign(alpha_1,
            alpha_1_ll(
              stan::model::rvalue(alpha, "alpha", stan::model::index_uni(k)),
              I, model_num, pstream__), "assigning variable alpha_1");
          local_scalar_t__ scale_full = DUMMY_VAR__;
          current_statement__ = 21;
          scale_full = (stan::math::logical_eq(S, 1) ? stan::model::rvalue(
                                                         scale, "scale",
                                                         stan::model::index_uni(
                                                           1)) : (stan::math::logical_eq(
                                                                    S, K) ? 
            stan::model::rvalue(scale, "scale", stan::model::index_uni(k)) : 1.0));
          current_statement__ = 22;
          stan::math::validate_non_negative_index("psi_k", "NPsi", NPsi);
          Eigen::Matrix<local_scalar_t__,-1,1> psi_k =
            Eigen::Matrix<local_scalar_t__,-1,1>::Constant(NPsi, DUMMY_VAR__);
          current_statement__ = 23;
          stan::model::assign(psi_k,
            stan::model::rvalue(psi, "psi", stan::model::index_uni(k)),
            "assigning variable psi_k");
          current_statement__ = 36;
          if (stan::math::logical_eq(psi_ascs, 1)) {
            current_statement__ = 34;
            if (stan::math::logical_gt(NPsi_ij, 0)) {
              current_statement__ = 31;
              stan::model::assign(lpsi,
                stan::math::rep_matrix(
                  stan::math::transpose(
                    stan::math::append_row(0,
                      stan::math::head(psi_k, (J - 1)))), I),
                "assigning variable lpsi");
              current_statement__ = 32;
              stan::model::assign(lpsi,
                stan::math::add(stan::model::deep_copy(lpsi),
                  stan::math::to_matrix(
                    stan::math::multiply(
                      stan::model::rvalue(dat_psi, "dat_psi",
                        stan::model::index_omni()),
                      stan::math::segment(psi_k, J, NPsi_ij)), I, J, 0)),
                "assigning variable lpsi");
            } else {
              current_statement__ = 29;
              stan::model::assign(lpsi,
                stan::math::rep_matrix(
                  stan::math::transpose(
                    stan::math::append_row(0,
                      stan::math::head(psi_k, (J - 1)))), I),
                "assigning variable lpsi");
            }
          } else {
            current_statement__ = 28;
            if (stan::math::logical_eq(psi_ascs, 0)) {
              current_statement__ = 26;
              if (stan::math::logical_gt(NPsi_ij, 0)) {
                current_statement__ = 25;
                stan::model::assign(lpsi,
                  stan::math::to_matrix(
                    stan::math::multiply(
                      stan::model::rvalue(dat_psi, "dat_psi",
                        stan::model::index_omni()), psi_k), I, J, 0),
                  "assigning variable lpsi");
              } else {
                current_statement__ = 24;
                stan::model::assign(lpsi, stan::math::rep_matrix(0, I, J),
                  "assigning variable lpsi");
              }
            }
          }
          current_statement__ = 62;
          if (stan::math::logical_lt(model_num, 5)) {
            current_statement__ = 52;
            stan::math::validate_non_negative_index("alpha_j", "I", I);
            current_statement__ = 53;
            stan::math::validate_non_negative_index("alpha_j", "J", J);
            Eigen::Matrix<local_scalar_t__,-1,-1> alpha_j =
              Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J,
                DUMMY_VAR__);
            current_statement__ = 54;
            stan::model::assign(alpha_j,
              alpha_j_ll(
                stan::model::rvalue(alpha, "alpha", stan::model::index_uni(k)),
                I, J, model_num, pstream__), "assigning variable alpha_j");
            current_statement__ = 60;
            if (stan::math::logical_eq(K, 1)) {
              current_statement__ = 58;
              stan::model::assign(log_like,
                mdcev_ll(quant_j, price_j, log_num, income, M, log_M_fact,
                  lpsi, gamma_full, alpha_1, alpha_j, scale_full, I, J,
                  nonzero, trunc_data, pstream__),
                "assigning variable log_like");
            } else {
              current_statement__ = 57;
              if (stan::math::logical_gt(K, 1)) {
                current_statement__ = 55;
                stan::model::assign(log_like_util,
                  mdcev_ll(quant_j, price_j, log_num, income, M, log_M_fact,
                    lpsi, gamma_full, alpha_1, alpha_j, scale_full, I, J,
                    nonzero, trunc_data, pstream__),
                  "assigning variable log_like_util",
                  stan::model::index_uni(k));
              }
            }
          } else {
            current_statement__ = 51;
            if (stan::math::logical_eq(model_num, 5)) {
              current_statement__ = 37;
              stan::math::validate_non_negative_index("phi_ij", "I", I);
              current_statement__ = 38;
              stan::math::validate_non_negative_index("phi_ij", "J", J);
              Eigen::Matrix<local_scalar_t__,-1,-1> phi_ij =
                Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, J,
                  DUMMY_VAR__);
              current_statement__ = 43;
              if (stan::math::logical_gt(NPhi, 0)) {
                current_statement__ = 42;
                stan::model::assign(phi_ij,
                  stan::math::exp(
                    stan::math::to_matrix(
                      stan::math::multiply(
                        stan::model::rvalue(dat_phi, "dat_phi",
                          stan::model::index_omni()),
                        stan::model::rvalue(phi, "phi",
                          stan::model::index_uni(k))), I, J, 0)),
                  "assigning variable phi_ij");
              } else {
                current_statement__ = 41;
                if (stan::math::logical_eq(NPhi, 0)) {
                  current_statement__ = 40;
                  stan::model::assign(phi_ij,
                    stan::math::rep_matrix(1, I, J),
                    "assigning variable phi_ij");
                }
              }
              current_statement__ = 49;
              if (stan::math::logical_eq(K, 1)) {
                current_statement__ = 47;
                stan::model::assign(log_like,
                  kt_ll(quant_j, price_j, log_num, income, lpsi, phi_ij,
                    gamma_full, alpha_1, scale_full, I, J, nonzero,
                    trunc_data, jacobian_analytical_grad, pstream__),
                  "assigning variable log_like");
              } else {
                current_statement__ = 46;
                if (stan::math::logical_gt(K, 1)) {
                  current_statement__ = 44;
                  stan::model::assign(log_like_util,
                    kt_ll(quant_j, price_j, log_num, income, lpsi, phi_ij,
                      gamma_full, alpha_1, scale_full, I, J, nonzero,
                      trunc_data, jacobian_analytical_grad, pstream__),
                    "assigning variable log_like_util",
                    stan::model::index_uni(k));
                }
              }
            }
          }
        }
        current_statement__ = 76;
        if (stan::math::logical_gt(K, 1)) {
          current_statement__ = 65;
          stan::math::validate_non_negative_index("delta_data", "I", I);
          current_statement__ = 66;
          stan::math::validate_non_negative_index("delta_data", "K - 1", (K -
            1));
          Eigen::Matrix<local_scalar_t__,-1,-1> delta_data =
            Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(I, (K - 1),
              DUMMY_VAR__);
          current_statement__ = 67;
          stan::model::assign(delta_data,
            stan::math::multiply(data_class, stan::math::transpose(delta)),
            "assigning variable delta_data");
          current_statement__ = 74;
          for (int i = 1; i <= I; ++i) {
            current_statement__ = 68;
            stan::math::validate_non_negative_index("ltheta", "K", K);
            Eigen::Matrix<local_scalar_t__,-1,1> ltheta =
              Eigen::Matrix<local_scalar_t__,-1,1>::Constant(K, DUMMY_VAR__);
            current_statement__ = 69;
            stan::model::assign(ltheta,
              stan::math::log_softmax(
                stan::math::append_row(0,
                  stan::math::transpose(
                    stan::model::rvalue(delta_data, "delta_data",
                      stan::model::index_uni(i))))),
              "assigning variable ltheta");
            current_statement__ = 70;
            stan::math::validate_non_negative_index("lps", "K", K);
            Eigen::Matrix<local_scalar_t__,-1,1> lps =
              Eigen::Matrix<local_scalar_t__,-1,1>::Constant(K, DUMMY_VAR__);
            current_statement__ = 71;
            stan::model::assign(lps,
              stan::math::add(ltheta,
                stan::math::to_vector(
                  stan::model::rvalue(log_like_util, "log_like_util",
                    stan::model::index_omni(), stan::model::index_uni(i)))),
              "assigning variable lps");
            current_statement__ = 72;
            stan::model::assign(log_like, stan::math::log_sum_exp(lps),
              "assigning variable log_like", stan::model::index_uni(i));
          }
        }
      }
      {
        current_statement__ = 102;
        if (stan::math::logical_eq(flat_priors, 0)) {
          current_statement__ = 85;
          lp_accum__.add(stan::math::normal_lpdf<propto__>(scale, 0,
                           prior_scale_sd));
          current_statement__ = 100;
          if (stan::math::logical_eq(K, 1)) {
            current_statement__ = 95;
            lp_accum__.add(stan::math::normal_lpdf<propto__>(
                             stan::model::rvalue(psi, "psi",
                               stan::model::index_uni(1)), 0, prior_psi_sd));
            current_statement__ = 96;
            lp_accum__.add(stan::math::normal_lpdf<propto__>(
                             stan::model::rvalue(phi, "phi",
                               stan::model::index_uni(1)), 0, prior_phi_sd));
            current_statement__ = 97;
            lp_accum__.add(stan::math::normal_lpdf<propto__>(
                             stan::model::rvalue(gamma, "gamma",
                               stan::model::index_uni(1)), 1, prior_gamma_sd));
            current_statement__ = 98;
            lp_accum__.add(stan::math::beta_lpdf<propto__>(
                             stan::model::rvalue(alpha, "alpha",
                               stan::model::index_uni(1)), prior_alpha_shape,
                             prior_alpha_shape));
          } else {
            current_statement__ = 94;
            if (stan::math::logical_gt(K, 1)) {
              current_statement__ = 86;
              lp_accum__.add(stan::math::normal_lpdf<propto__>(
                               stan::math::to_vector(delta), 0,
                               prior_delta_sd));
              current_statement__ = 92;
              for (int k = 1; k <= K; ++k) {
                current_statement__ = 87;
                lp_accum__.add(stan::math::normal_lpdf<propto__>(
                                 stan::math::to_vector(
                                   stan::model::rvalue(psi, "psi",
                                     stan::model::index_uni(k))), 0,
                                 prior_psi_sd));
                current_statement__ = 88;
                lp_accum__.add(stan::math::normal_lpdf<propto__>(
                                 stan::math::to_vector(
                                   stan::model::rvalue(phi, "phi",
                                     stan::model::index_uni(k))), 0,
                                 prior_phi_sd));
                current_statement__ = 89;
                lp_accum__.add(stan::math::normal_lpdf<propto__>(
                                 stan::math::to_vector(
                                   stan::model::rvalue(gamma, "gamma",
                                     stan::model::index_uni(k))), 1,
                                 prior_gamma_sd));
                current_statement__ = 90;
                lp_accum__.add(stan::math::beta_lpdf<propto__>(
                                 stan::math::to_vector(
                                   stan::model::rvalue(alpha, "alpha",
                                     stan::model::index_uni(k))),
                                 prior_alpha_shape, prior_alpha_shape));
              }
            }
          }
        }
        current_statement__ = 103;
        lp_accum__.add(stan::math::dot_product(log_like, weights));
      }
    } catch (const std::exception& e) {
      stan::lang::rethrow_located(e, locations_array__[current_statement__]);
    }
    lp_accum__.add(lp__);
    return lp_accum__.sum();
  }
  template <typename RNG, typename VecR, typename VecI, typename VecVar,
            stan::require_vector_like_vt<std::is_floating_point,
            VecR>* = nullptr, stan::require_vector_like_vt<std::is_integral,
            VecI>* = nullptr, stan::require_vector_vt<std::is_floating_point,
            VecVar>* = 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;
    stan::io::deserializer<local_scalar_t__> in__(params_r__, params_i__);
    stan::io::serializer<local_scalar_t__> out__(vars__);
    static constexpr bool propto__ = true;
    // suppress unused var warning
    (void) propto__;
    double lp__ = 0.0;
    // suppress unused var warning
    (void) lp__;
    int current_statement__ = 0;
    // suppress unused var warning
    (void) current_statement__;
    stan::math::accumulator<double> lp_accum__;
    local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
    // suppress unused var warning
    (void) DUMMY_VAR__;
    constexpr bool jacobian__ = false;
    // suppress unused var warning
    (void) jacobian__;
    static constexpr const char* function__ =
      "mdcev_model_namespace::write_array";
    // suppress unused var warning
    (void) function__;
    try {
      current_statement__ = 1;
      auto psi =
        in__.template read<
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>>(K, NPsi);
      current_statement__ = 2;
      auto phi =
        in__.template read<
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>>(K, NPhi);
      current_statement__ = 3;
      auto gamma =
        in__.template read_constrain_lb<
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>, jacobian__>(0,
          lp__, K, Gamma);
      current_statement__ = 4;
      auto alpha =
        in__.template read_constrain_lub<
          std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>, jacobian__>(0,
          1, lp__, K, A);
      current_statement__ = 5;
      auto scale =
        in__.template read_constrain_lb<Eigen::Matrix<local_scalar_t__,-1,1>,
          jacobian__>(0, lp__, S);
      current_statement__ = 6;
      auto delta =
        in__.template read<
          Eigen::Matrix<local_scalar_t__,-1,-1>>(delta_1dim__, L);
      Eigen::Matrix<double,-1,1> log_like =
        Eigen::Matrix<double,-1,1>::Constant(I,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 1;
      for (int sym1__ = 1; sym1__ <= NPsi; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
          out__.write(psi[(sym2__ - 1)][(sym1__ - 1)]);
        }
      }
      current_statement__ = 2;
      for (int sym1__ = 1; sym1__ <= NPhi; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
          out__.write(phi[(sym2__ - 1)][(sym1__ - 1)]);
        }
      }
      current_statement__ = 3;
      for (int sym1__ = 1; sym1__ <= Gamma; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
          out__.write(gamma[(sym2__ - 1)][(sym1__ - 1)]);
        }
      }
      current_statement__ = 4;
      for (int sym1__ = 1; sym1__ <= A; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
          out__.write(alpha[(sym2__ - 1)][(sym1__ - 1)]);
        }
      }
      out__.write(scale);
      out__.write(delta);
      if (stan::math::logical_negation(
            (stan::math::primitive_value(emit_transformed_parameters__) ||
            stan::math::primitive_value(emit_generated_quantities__)))) {
        return ;
      }
      {
        current_statement__ = 10;
        stan::math::validate_non_negative_index("log_like_util", "K", K);
        current_statement__ = 11;
        stan::math::validate_non_negative_index("log_like_util", "I", I);
        std::vector<Eigen::Matrix<double,-1,1>> log_like_util =
          std::vector<Eigen::Matrix<double,-1,1>>(K,
            Eigen::Matrix<double,-1,1>::Constant(I,
              std::numeric_limits<double>::quiet_NaN()));
        current_statement__ = 64;
        for (int k = 1; k <= K; ++k) {
          current_statement__ = 13;
          stan::math::validate_non_negative_index("gamma_full", "I", I);
          current_statement__ = 14;
          stan::math::validate_non_negative_index("gamma_full", "J", J);
          Eigen::Matrix<double,-1,-1> gamma_full =
            Eigen::Matrix<double,-1,-1>::Constant(I, J,
              std::numeric_limits<double>::quiet_NaN());
          current_statement__ = 15;
          stan::model::assign(gamma_full,
            gamma_ll(
              stan::model::rvalue(gamma, "gamma", stan::model::index_uni(k)),
              I, J, Gamma, pstream__), "assigning variable gamma_full");
          current_statement__ = 16;
          stan::math::validate_non_negative_index("lpsi", "I", I);
          current_statement__ = 17;
          stan::math::validate_non_negative_index("lpsi", "J", J);
          Eigen::Matrix<double,-1,-1> lpsi =
            Eigen::Matrix<double,-1,-1>::Constant(I, J,
              std::numeric_limits<double>::quiet_NaN());
          current_statement__ = 19;
          stan::math::validate_non_negative_index("alpha_1", "I", I);
          Eigen::Matrix<double,-1,1> alpha_1 =
            Eigen::Matrix<double,-1,1>::Constant(I,
              std::numeric_limits<double>::quiet_NaN());
          current_statement__ = 20;
          stan::model::assign(alpha_1,
            alpha_1_ll(
              stan::model::rvalue(alpha, "alpha", stan::model::index_uni(k)),
              I, model_num, pstream__), "assigning variable alpha_1");
          double scale_full = std::numeric_limits<double>::quiet_NaN();
          current_statement__ = 21;
          scale_full = (stan::math::logical_eq(S, 1) ? stan::model::rvalue(
                                                         scale, "scale",
                                                         stan::model::index_uni(
                                                           1)) : (stan::math::logical_eq(
                                                                    S, K) ? 
            stan::model::rvalue(scale, "scale", stan::model::index_uni(k)) : 1.0));
          current_statement__ = 22;
          stan::math::validate_non_negative_index("psi_k", "NPsi", NPsi);
          Eigen::Matrix<double,-1,1> psi_k =
            Eigen::Matrix<double,-1,1>::Constant(NPsi,
              std::numeric_limits<double>::quiet_NaN());
          current_statement__ = 23;
          stan::model::assign(psi_k,
            stan::model::rvalue(psi, "psi", stan::model::index_uni(k)),
            "assigning variable psi_k");
          current_statement__ = 36;
          if (stan::math::logical_eq(psi_ascs, 1)) {
            current_statement__ = 34;
            if (stan::math::logical_gt(NPsi_ij, 0)) {
              current_statement__ = 31;
              stan::model::assign(lpsi,
                stan::math::rep_matrix(
                  stan::math::transpose(
                    stan::math::append_row(0,
                      stan::math::head(psi_k, (J - 1)))), I),
                "assigning variable lpsi");
              current_statement__ = 32;
              stan::model::assign(lpsi,
                stan::math::add(stan::model::deep_copy(lpsi),
                  stan::math::to_matrix(
                    stan::math::multiply(
                      stan::model::rvalue(dat_psi, "dat_psi",
                        stan::model::index_omni()),
                      stan::math::segment(psi_k, J, NPsi_ij)), I, J, 0)),
                "assigning variable lpsi");
            } else {
              current_statement__ = 29;
              stan::model::assign(lpsi,
                stan::math::rep_matrix(
                  stan::math::transpose(
                    stan::math::append_row(0,
                      stan::math::head(psi_k, (J - 1)))), I),
                "assigning variable lpsi");
            }
          } else {
            current_statement__ = 28;
            if (stan::math::logical_eq(psi_ascs, 0)) {
              current_statement__ = 26;
              if (stan::math::logical_gt(NPsi_ij, 0)) {
                current_statement__ = 25;
                stan::model::assign(lpsi,
                  stan::math::to_matrix(
                    stan::math::multiply(
                      stan::model::rvalue(dat_psi, "dat_psi",
                        stan::model::index_omni()), psi_k), I, J, 0),
                  "assigning variable lpsi");
              } else {
                current_statement__ = 24;
                stan::model::assign(lpsi, stan::math::rep_matrix(0, I, J),
                  "assigning variable lpsi");
              }
            }
          }
          current_statement__ = 62;
          if (stan::math::logical_lt(model_num, 5)) {
            current_statement__ = 52;
            stan::math::validate_non_negative_index("alpha_j", "I", I);
            current_statement__ = 53;
            stan::math::validate_non_negative_index("alpha_j", "J", J);
            Eigen::Matrix<double,-1,-1> alpha_j =
              Eigen::Matrix<double,-1,-1>::Constant(I, J,
                std::numeric_limits<double>::quiet_NaN());
            current_statement__ = 54;
            stan::model::assign(alpha_j,
              alpha_j_ll(
                stan::model::rvalue(alpha, "alpha", stan::model::index_uni(k)),
                I, J, model_num, pstream__), "assigning variable alpha_j");
            current_statement__ = 60;
            if (stan::math::logical_eq(K, 1)) {
              current_statement__ = 58;
              stan::model::assign(log_like,
                mdcev_ll(quant_j, price_j, log_num, income, M, log_M_fact,
                  lpsi, gamma_full, alpha_1, alpha_j, scale_full, I, J,
                  nonzero, trunc_data, pstream__),
                "assigning variable log_like");
            } else {
              current_statement__ = 57;
              if (stan::math::logical_gt(K, 1)) {
                current_statement__ = 55;
                stan::model::assign(log_like_util,
                  mdcev_ll(quant_j, price_j, log_num, income, M, log_M_fact,
                    lpsi, gamma_full, alpha_1, alpha_j, scale_full, I, J,
                    nonzero, trunc_data, pstream__),
                  "assigning variable log_like_util",
                  stan::model::index_uni(k));
              }
            }
          } else {
            current_statement__ = 51;
            if (stan::math::logical_eq(model_num, 5)) {
              current_statement__ = 37;
              stan::math::validate_non_negative_index("phi_ij", "I", I);
              current_statement__ = 38;
              stan::math::validate_non_negative_index("phi_ij", "J", J);
              Eigen::Matrix<double,-1,-1> phi_ij =
                Eigen::Matrix<double,-1,-1>::Constant(I, J,
                  std::numeric_limits<double>::quiet_NaN());
              current_statement__ = 43;
              if (stan::math::logical_gt(NPhi, 0)) {
                current_statement__ = 42;
                stan::model::assign(phi_ij,
                  stan::math::exp(
                    stan::math::to_matrix(
                      stan::math::multiply(
                        stan::model::rvalue(dat_phi, "dat_phi",
                          stan::model::index_omni()),
                        stan::model::rvalue(phi, "phi",
                          stan::model::index_uni(k))), I, J, 0)),
                  "assigning variable phi_ij");
              } else {
                current_statement__ = 41;
                if (stan::math::logical_eq(NPhi, 0)) {
                  current_statement__ = 40;
                  stan::model::assign(phi_ij,
                    stan::math::rep_matrix(1, I, J),
                    "assigning variable phi_ij");
                }
              }
              current_statement__ = 49;
              if (stan::math::logical_eq(K, 1)) {
                current_statement__ = 47;
                stan::model::assign(log_like,
                  kt_ll(quant_j, price_j, log_num, income, lpsi, phi_ij,
                    gamma_full, alpha_1, scale_full, I, J, nonzero,
                    trunc_data, jacobian_analytical_grad, pstream__),
                  "assigning variable log_like");
              } else {
                current_statement__ = 46;
                if (stan::math::logical_gt(K, 1)) {
                  current_statement__ = 44;
                  stan::model::assign(log_like_util,
                    kt_ll(quant_j, price_j, log_num, income, lpsi, phi_ij,
                      gamma_full, alpha_1, scale_full, I, J, nonzero,
                      trunc_data, jacobian_analytical_grad, pstream__),
                    "assigning variable log_like_util",
                    stan::model::index_uni(k));
                }
              }
            }
          }
        }
        current_statement__ = 76;
        if (stan::math::logical_gt(K, 1)) {
          current_statement__ = 65;
          stan::math::validate_non_negative_index("delta_data", "I", I);
          current_statement__ = 66;
          stan::math::validate_non_negative_index("delta_data", "K - 1", (K -
            1));
          Eigen::Matrix<double,-1,-1> delta_data =
            Eigen::Matrix<double,-1,-1>::Constant(I, (K - 1),
              std::numeric_limits<double>::quiet_NaN());
          current_statement__ = 67;
          stan::model::assign(delta_data,
            stan::math::multiply(data_class, stan::math::transpose(delta)),
            "assigning variable delta_data");
          current_statement__ = 74;
          for (int i = 1; i <= I; ++i) {
            current_statement__ = 68;
            stan::math::validate_non_negative_index("ltheta", "K", K);
            Eigen::Matrix<double,-1,1> ltheta =
              Eigen::Matrix<double,-1,1>::Constant(K,
                std::numeric_limits<double>::quiet_NaN());
            current_statement__ = 69;
            stan::model::assign(ltheta,
              stan::math::log_softmax(
                stan::math::append_row(0,
                  stan::math::transpose(
                    stan::model::rvalue(delta_data, "delta_data",
                      stan::model::index_uni(i))))),
              "assigning variable ltheta");
            current_statement__ = 70;
            stan::math::validate_non_negative_index("lps", "K", K);
            Eigen::Matrix<double,-1,1> lps =
              Eigen::Matrix<double,-1,1>::Constant(K,
                std::numeric_limits<double>::quiet_NaN());
            current_statement__ = 71;
            stan::model::assign(lps,
              stan::math::add(ltheta,
                stan::math::to_vector(
                  stan::model::rvalue(log_like_util, "log_like_util",
                    stan::model::index_omni(), stan::model::index_uni(i)))),
              "assigning variable lps");
            current_statement__ = 72;
            stan::model::assign(log_like, stan::math::log_sum_exp(lps),
              "assigning variable log_like", stan::model::index_uni(i));
          }
        }
      }
      if (emit_transformed_parameters__) {
        out__.write(log_like);
      }
      if (stan::math::logical_negation(emit_generated_quantities__)) {
        return ;
      }
      double sum_log_lik = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 8;
      sum_log_lik = stan::math::dot_product(log_like, weights);
      Eigen::Matrix<double,-1,-1> theta =
        Eigen::Matrix<double,-1,-1>::Constant(theta_1dim__, K,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 84;
      if (stan::math::logical_gt(K, 1)) {
        current_statement__ = 78;
        stan::math::validate_non_negative_index("delta_data", "I", I);
        current_statement__ = 79;
        stan::math::validate_non_negative_index("delta_data", "K - 1", (K -
          1));
        Eigen::Matrix<double,-1,-1> delta_data =
          Eigen::Matrix<double,-1,-1>::Constant(I, (K - 1),
            std::numeric_limits<double>::quiet_NaN());
        current_statement__ = 80;
        stan::model::assign(delta_data,
          stan::math::multiply(data_class, stan::math::transpose(delta)),
          "assigning variable delta_data");
        current_statement__ = 82;
        for (int i = 1; i <= I; ++i) {
          current_statement__ = 81;
          stan::model::assign(theta,
            stan::math::transpose(
              stan::math::softmax(
                stan::math::append_row(0,
                  stan::math::transpose(
                    stan::model::rvalue(delta_data, "delta_data",
                      stan::model::index_uni(i)))))),
            "assigning variable theta", stan::model::index_uni(i));
        }
      }
      out__.write(sum_log_lik);
      out__.write(theta);
    } catch (const std::exception& e) {
      stan::lang::rethrow_located(e, locations_array__[current_statement__]);
    }
  }
  template <typename VecVar, typename VecI,
            stan::require_vector_t<VecVar>* = nullptr,
            stan::require_vector_like_vt<std::is_integral, VecI>* = 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;
    stan::io::deserializer<local_scalar_t__> in__(params_r__, params_i__);
    stan::io::serializer<local_scalar_t__> out__(vars__);
    int current_statement__ = 0;
    // suppress unused var warning
    (void) current_statement__;
    local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
    // suppress unused var warning
    (void) DUMMY_VAR__;
    try {
      std::vector<Eigen::Matrix<local_scalar_t__,-1,1>> psi =
        std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>(K,
          Eigen::Matrix<local_scalar_t__,-1,1>::Constant(NPsi, DUMMY_VAR__));
      current_statement__ = 1;
      for (int sym1__ = 1; sym1__ <= NPsi; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
          current_statement__ = 1;
          stan::model::assign(psi, in__.read<local_scalar_t__>(),
            "assigning variable psi", stan::model::index_uni(sym2__),
            stan::model::index_uni(sym1__));
        }
      }
      out__.write(psi);
      std::vector<Eigen::Matrix<local_scalar_t__,-1,1>> phi =
        std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>(K,
          Eigen::Matrix<local_scalar_t__,-1,1>::Constant(NPhi, DUMMY_VAR__));
      current_statement__ = 2;
      for (int sym1__ = 1; sym1__ <= NPhi; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
          current_statement__ = 2;
          stan::model::assign(phi, in__.read<local_scalar_t__>(),
            "assigning variable phi", stan::model::index_uni(sym2__),
            stan::model::index_uni(sym1__));
        }
      }
      out__.write(phi);
      std::vector<Eigen::Matrix<local_scalar_t__,-1,1>> gamma =
        std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>(K,
          Eigen::Matrix<local_scalar_t__,-1,1>::Constant(Gamma, DUMMY_VAR__));
      current_statement__ = 3;
      for (int sym1__ = 1; sym1__ <= Gamma; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
          current_statement__ = 3;
          stan::model::assign(gamma, in__.read<local_scalar_t__>(),
            "assigning variable gamma", stan::model::index_uni(sym2__),
            stan::model::index_uni(sym1__));
        }
      }
      out__.write_free_lb(0, gamma);
      std::vector<Eigen::Matrix<local_scalar_t__,-1,1>> alpha =
        std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>(K,
          Eigen::Matrix<local_scalar_t__,-1,1>::Constant(A, DUMMY_VAR__));
      current_statement__ = 4;
      for (int sym1__ = 1; sym1__ <= A; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
          current_statement__ = 4;
          stan::model::assign(alpha, in__.read<local_scalar_t__>(),
            "assigning variable alpha", stan::model::index_uni(sym2__),
            stan::model::index_uni(sym1__));
        }
      }
      out__.write_free_lub(0, 1, alpha);
      Eigen::Matrix<local_scalar_t__,-1,1> scale =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(S, DUMMY_VAR__);
      current_statement__ = 5;
      stan::model::assign(scale,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(S),
        "assigning variable scale");
      out__.write_free_lb(0, scale);
      Eigen::Matrix<local_scalar_t__,-1,-1> delta =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(delta_1dim__, L,
          DUMMY_VAR__);
      current_statement__ = 6;
      stan::model::assign(delta,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,-1>>(delta_1dim__, L),
        "assigning variable delta");
      out__.write(delta);
    } catch (const std::exception& e) {
      stan::lang::rethrow_located(e, locations_array__[current_statement__]);
    }
  }
  template <typename VecVar, stan::require_vector_t<VecVar>* = 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<local_scalar_t__> out__(vars__);
    int current_statement__ = 0;
    // suppress unused var warning
    (void) current_statement__;
    local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
    // suppress unused var warning
    (void) DUMMY_VAR__;
    try {
      current_statement__ = 1;
      context__.validate_dims("parameter initialization", "psi", "double",
        std::vector<size_t>{static_cast<size_t>(K),
          static_cast<size_t>(NPsi)});
      current_statement__ = 2;
      context__.validate_dims("parameter initialization", "phi", "double",
        std::vector<size_t>{static_cast<size_t>(K),
          static_cast<size_t>(NPhi)});
      current_statement__ = 3;
      context__.validate_dims("parameter initialization", "gamma", "double",
        std::vector<size_t>{static_cast<size_t>(K),
          static_cast<size_t>(Gamma)});
      current_statement__ = 4;
      context__.validate_dims("parameter initialization", "alpha", "double",
        std::vector<size_t>{static_cast<size_t>(K), static_cast<size_t>(A)});
      current_statement__ = 5;
      context__.validate_dims("parameter initialization", "scale", "double",
        std::vector<size_t>{static_cast<size_t>(S)});
      current_statement__ = 6;
      context__.validate_dims("parameter initialization", "delta", "double",
        std::vector<size_t>{static_cast<size_t>(delta_1dim__),
          static_cast<size_t>(L)});
      int pos__ = std::numeric_limits<int>::min();
      pos__ = 1;
      std::vector<Eigen::Matrix<local_scalar_t__,-1,1>> psi =
        std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>(K,
          Eigen::Matrix<local_scalar_t__,-1,1>::Constant(NPsi, DUMMY_VAR__));
      {
        std::vector<local_scalar_t__> psi_flat__;
        current_statement__ = 1;
        psi_flat__ = context__.vals_r("psi");
        pos__ = 1;
        for (int sym1__ = 1; sym1__ <= NPsi; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
            stan::model::assign(psi, psi_flat__[(pos__ - 1)],
              "assigning variable psi", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            pos__ = (pos__ + 1);
          }
        }
      }
      out__.write(psi);
      std::vector<Eigen::Matrix<local_scalar_t__,-1,1>> phi =
        std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>(K,
          Eigen::Matrix<local_scalar_t__,-1,1>::Constant(NPhi, DUMMY_VAR__));
      {
        std::vector<local_scalar_t__> phi_flat__;
        current_statement__ = 2;
        phi_flat__ = context__.vals_r("phi");
        pos__ = 1;
        for (int sym1__ = 1; sym1__ <= NPhi; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
            stan::model::assign(phi, phi_flat__[(pos__ - 1)],
              "assigning variable phi", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            pos__ = (pos__ + 1);
          }
        }
      }
      out__.write(phi);
      std::vector<Eigen::Matrix<local_scalar_t__,-1,1>> gamma =
        std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>(K,
          Eigen::Matrix<local_scalar_t__,-1,1>::Constant(Gamma, DUMMY_VAR__));
      {
        std::vector<local_scalar_t__> gamma_flat__;
        current_statement__ = 3;
        gamma_flat__ = context__.vals_r("gamma");
        pos__ = 1;
        for (int sym1__ = 1; sym1__ <= Gamma; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
            stan::model::assign(gamma, gamma_flat__[(pos__ - 1)],
              "assigning variable gamma", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            pos__ = (pos__ + 1);
          }
        }
      }
      out__.write_free_lb(0, gamma);
      std::vector<Eigen::Matrix<local_scalar_t__,-1,1>> alpha =
        std::vector<Eigen::Matrix<local_scalar_t__,-1,1>>(K,
          Eigen::Matrix<local_scalar_t__,-1,1>::Constant(A, DUMMY_VAR__));
      {
        std::vector<local_scalar_t__> alpha_flat__;
        current_statement__ = 4;
        alpha_flat__ = context__.vals_r("alpha");
        pos__ = 1;
        for (int sym1__ = 1; sym1__ <= A; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
            stan::model::assign(alpha, alpha_flat__[(pos__ - 1)],
              "assigning variable alpha", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            pos__ = (pos__ + 1);
          }
        }
      }
      out__.write_free_lub(0, 1, alpha);
      Eigen::Matrix<local_scalar_t__,-1,1> scale =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(S, DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> scale_flat__;
        current_statement__ = 5;
        scale_flat__ = context__.vals_r("scale");
        pos__ = 1;
        for (int sym1__ = 1; sym1__ <= S; ++sym1__) {
          stan::model::assign(scale, scale_flat__[(pos__ - 1)],
            "assigning variable scale", stan::model::index_uni(sym1__));
          pos__ = (pos__ + 1);
        }
      }
      out__.write_free_lb(0, scale);
      Eigen::Matrix<local_scalar_t__,-1,-1> delta =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(delta_1dim__, L,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> delta_flat__;
        current_statement__ = 6;
        delta_flat__ = context__.vals_r("delta");
        pos__ = 1;
        for (int sym1__ = 1; sym1__ <= L; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= delta_1dim__; ++sym2__) {
            stan::model::assign(delta, delta_flat__[(pos__ - 1)],
              "assigning variable delta", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            pos__ = (pos__ + 1);
          }
        }
      }
      out__.write(delta);
    } catch (const std::exception& e) {
      stan::lang::rethrow_located(e, locations_array__[current_statement__]);
    }
  }
  inline void
  get_param_names(std::vector<std::string>& names__, const bool
                  emit_transformed_parameters__ = true, const bool
                  emit_generated_quantities__ = true) const {
    names__ = std::vector<std::string>{"psi", "phi", "gamma", "alpha",
                "scale", "delta"};
    if (emit_transformed_parameters__) {
      std::vector<std::string> temp{"log_like"};
      names__.reserve(names__.size() + temp.size());
      names__.insert(names__.end(), temp.begin(), temp.end());
    }
    if (emit_generated_quantities__) {
      std::vector<std::string> temp{"sum_log_lik", "theta"};
      names__.reserve(names__.size() + temp.size());
      names__.insert(names__.end(), temp.begin(), temp.end());
    }
  }
  inline void
  get_dims(std::vector<std::vector<size_t>>& dimss__, const bool
           emit_transformed_parameters__ = true, const bool
           emit_generated_quantities__ = true) const {
    dimss__ = std::vector<std::vector<size_t>>{std::vector<size_t>{static_cast<
                                                                    size_t>(K),
                                                 static_cast<size_t>(NPsi)},
                std::vector<size_t>{static_cast<size_t>(K),
                  static_cast<size_t>(NPhi)},
                std::vector<size_t>{static_cast<size_t>(K),
                  static_cast<size_t>(Gamma)},
                std::vector<size_t>{static_cast<size_t>(K),
                  static_cast<size_t>(A)},
                std::vector<size_t>{static_cast<size_t>(S)},
                std::vector<size_t>{static_cast<size_t>(delta_1dim__),
                  static_cast<size_t>(L)}};
    if (emit_transformed_parameters__) {
      std::vector<std::vector<size_t>>
        temp{std::vector<size_t>{static_cast<size_t>(I)}};
      dimss__.reserve(dimss__.size() + temp.size());
      dimss__.insert(dimss__.end(), temp.begin(), temp.end());
    }
    if (emit_generated_quantities__) {
      std::vector<std::vector<size_t>>
        temp{std::vector<size_t>{},
             std::vector<size_t>{static_cast<size_t>(theta_1dim__),
               static_cast<size_t>(K)}};
      dimss__.reserve(dimss__.size() + temp.size());
      dimss__.insert(dimss__.end(), temp.begin(), temp.end());
    }
  }
  inline void
  constrained_param_names(std::vector<std::string>& param_names__, bool
                          emit_transformed_parameters__ = true, bool
                          emit_generated_quantities__ = true) const final {
    for (int sym1__ = 1; sym1__ <= NPsi; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
        param_names__.emplace_back(std::string() + "psi" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= NPhi; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
        param_names__.emplace_back(std::string() + "phi" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= Gamma; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
        param_names__.emplace_back(std::string() + "gamma" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= A; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
        param_names__.emplace_back(std::string() + "alpha" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= S; ++sym1__) {
      param_names__.emplace_back(std::string() + "scale" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= L; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= delta_1dim__; ++sym2__) {
        param_names__.emplace_back(std::string() + "delta" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    if (emit_transformed_parameters__) {
      for (int sym1__ = 1; sym1__ <= I; ++sym1__) {
        param_names__.emplace_back(std::string() + "log_like" + '.' +
          std::to_string(sym1__));
      }
    }
    if (emit_generated_quantities__) {
      param_names__.emplace_back(std::string() + "sum_log_lik");
      for (int sym1__ = 1; sym1__ <= K; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= theta_1dim__; ++sym2__) {
          param_names__.emplace_back(std::string() + "theta" + '.' +
            std::to_string(sym2__) + '.' + std::to_string(sym1__));
        }
      }
    }
  }
  inline void
  unconstrained_param_names(std::vector<std::string>& param_names__, bool
                            emit_transformed_parameters__ = true, bool
                            emit_generated_quantities__ = true) const final {
    for (int sym1__ = 1; sym1__ <= NPsi; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
        param_names__.emplace_back(std::string() + "psi" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= NPhi; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
        param_names__.emplace_back(std::string() + "phi" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= Gamma; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
        param_names__.emplace_back(std::string() + "gamma" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= A; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
        param_names__.emplace_back(std::string() + "alpha" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= S; ++sym1__) {
      param_names__.emplace_back(std::string() + "scale" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= L; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= delta_1dim__; ++sym2__) {
        param_names__.emplace_back(std::string() + "delta" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    if (emit_transformed_parameters__) {
      for (int sym1__ = 1; sym1__ <= I; ++sym1__) {
        param_names__.emplace_back(std::string() + "log_like" + '.' +
          std::to_string(sym1__));
      }
    }
    if (emit_generated_quantities__) {
      param_names__.emplace_back(std::string() + "sum_log_lik");
      for (int sym1__ = 1; sym1__ <= K; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= theta_1dim__; ++sym2__) {
          param_names__.emplace_back(std::string() + "theta" + '.' +
            std::to_string(sym2__) + '.' + std::to_string(sym1__));
        }
      }
    }
  }
  inline std::string get_constrained_sizedtypes() const {
    return std::string("[{\"name\":\"psi\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(NPsi) + "}},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(NPhi) + "}},\"block\":\"parameters\"},{\"name\":\"gamma\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(Gamma) + "}},\"block\":\"parameters\"},{\"name\":\"alpha\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(A) + "}},\"block\":\"parameters\"},{\"name\":\"scale\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(S) + "},\"block\":\"parameters\"},{\"name\":\"delta\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(delta_1dim__) + ",\"cols\":" + std::to_string(L) + "},\"block\":\"parameters\"},{\"name\":\"log_like\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(I) + "},\"block\":\"transformed_parameters\"},{\"name\":\"sum_log_lik\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"theta\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(theta_1dim__) + ",\"cols\":" + std::to_string(K) + "},\"block\":\"generated_quantities\"}]");
  }
  inline std::string get_unconstrained_sizedtypes() const {
    return std::string("[{\"name\":\"psi\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(NPsi) + "}},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(NPhi) + "}},\"block\":\"parameters\"},{\"name\":\"gamma\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(Gamma) + "}},\"block\":\"parameters\"},{\"name\":\"alpha\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(A) + "}},\"block\":\"parameters\"},{\"name\":\"scale\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(S) + "},\"block\":\"parameters\"},{\"name\":\"delta\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(delta_1dim__) + ",\"cols\":" + std::to_string(L) + "},\"block\":\"parameters\"},{\"name\":\"log_like\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(I) + "},\"block\":\"transformed_parameters\"},{\"name\":\"sum_log_lik\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"theta\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(theta_1dim__) + ",\"cols\":" + std::to_string(K) + "},\"block\":\"generated_quantities\"}]");
  }
  // Begin method overload boilerplate
  template <typename RNG> inline void
  write_array(RNG& base_rng, Eigen::Matrix<double,-1,1>& params_r,
              Eigen::Matrix<double,-1,1>& vars, const bool
              emit_transformed_parameters = true, const bool
              emit_generated_quantities = true, std::ostream*
              pstream = nullptr) const {
    const size_t num_params__ = ((((((K * NPsi) + (K * NPhi)) + (K * Gamma))
      + (K * A)) + S) + (delta_1dim__ * L));
    const size_t num_transformed = emit_transformed_parameters * (I);
    const size_t num_gen_quantities = emit_generated_quantities * ((1 +
      (theta_1dim__ * K)));
    const size_t num_to_write = num_params__ + num_transformed +
      num_gen_quantities;
    std::vector<int> params_i;
    vars = Eigen::Matrix<double,-1,1>::Constant(num_to_write,
             std::numeric_limits<double>::quiet_NaN());
    write_array_impl(base_rng, params_r, params_i, vars,
      emit_transformed_parameters, emit_generated_quantities, pstream);
  }
  template <typename RNG> inline void
  write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
              params_i, std::vector<double>& vars, bool
              emit_transformed_parameters = true, bool
              emit_generated_quantities = true, std::ostream*
              pstream = nullptr) const {
    const size_t num_params__ = ((((((K * NPsi) + (K * NPhi)) + (K * Gamma))
      + (K * A)) + S) + (delta_1dim__ * L));
    const size_t num_transformed = emit_transformed_parameters * (I);
    const size_t num_gen_quantities = emit_generated_quantities * ((1 +
      (theta_1dim__ * K)));
    const size_t num_to_write = num_params__ + num_transformed +
      num_gen_quantities;
    vars = std::vector<double>(num_to_write,
             std::numeric_limits<double>::quiet_NaN());
    write_array_impl(base_rng, params_r, params_i, vars,
      emit_transformed_parameters, emit_generated_quantities, pstream);
  }
  template <bool propto__, bool jacobian__, typename T_> inline T_
  log_prob(Eigen::Matrix<T_,-1,1>& params_r, std::ostream* pstream = nullptr) const {
    Eigen::Matrix<int,-1,1> params_i;
    return log_prob_impl<propto__, jacobian__>(params_r, params_i, pstream);
  }
  template <bool propto__, bool jacobian__, typename T_> inline T_
  log_prob(std::vector<T_>& params_r, std::vector<int>& params_i,
           std::ostream* pstream = nullptr) const {
    return log_prob_impl<propto__, jacobian__>(params_r, params_i, pstream);
  }
  inline void
  transform_inits(const stan::io::var_context& context,
                  Eigen::Matrix<double,-1,1>& params_r, std::ostream*
                  pstream = nullptr) const final {
    std::vector<double> params_r_vec(params_r.size());
    std::vector<int> params_i;
    transform_inits(context, params_i, params_r_vec, pstream);
    params_r = Eigen::Map<Eigen::Matrix<double,-1,1>>(params_r_vec.data(),
                 params_r_vec.size());
  }
  inline void
  transform_inits(const stan::io::var_context& context, std::vector<int>&
                  params_i, std::vector<double>& vars, std::ostream*
                  pstream__ = nullptr) const {
    vars.resize(num_params_r__);
    transform_inits_impl(context, vars, pstream__);
  }
  inline void
  unconstrain_array(const std::vector<double>& params_constrained,
                    std::vector<double>& params_unconstrained, std::ostream*
                    pstream = nullptr) const {
    const std::vector<int> params_i;
    params_unconstrained = std::vector<double>(num_params_r__,
                             std::numeric_limits<double>::quiet_NaN());
    unconstrain_array_impl(params_constrained, params_i,
      params_unconstrained, pstream);
  }
  inline void
  unconstrain_array(const Eigen::Matrix<double,-1,1>& params_constrained,
                    Eigen::Matrix<double,-1,1>& params_unconstrained,
                    std::ostream* pstream = nullptr) const {
    const std::vector<int> params_i;
    params_unconstrained = Eigen::Matrix<double,-1,1>::Constant(num_params_r__,
                             std::numeric_limits<double>::quiet_NaN());
    unconstrain_array_impl(params_constrained, params_i,
      params_unconstrained, pstream);
  }
};
}
using stan_model = mdcev_model_namespace::mdcev_model;
#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* m = new stan_model(data_context, seed, msg_stream);
  return *m;
}
stan::math::profile_map& get_stan_profile_data() {
  return mdcev_model_namespace::profiles__;
}
#endif