// Generated by rstantools.  Do not edit by hand.

/*
    disbayes is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    disbayes is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with disbayes.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MODELS_HPP
#define MODELS_HPP
#define STAN__SERVICES__COMMAND_HPP
#ifndef USE_STANC3
#define USE_STANC3
#endif
#include <rstan/rstaninc.hpp>
// Code generated by stanc v2.32.2
#include <stan/model/model_header.hpp>
namespace model_disbayes_hier_namespace {
using stan::model::model_base_crtp;
using namespace stan::math;
stan::math::profile_map profiles__;
static constexpr std::array<const char*, 530> locations_array__ =
  {" (found before start of program)",
  " (in 'string', line 159, column 2 to column 62)",
  " (in 'string', line 160, column 2 to column 94)",
  " (in 'string', line 162, column 2 to column 68)",
  " (in 'string', line 163, column 2 to column 86)",
  " (in 'string', line 164, column 2 to column 44)",
  " (in 'string', line 165, column 2 to column 25)",
  " (in 'string', line 168, column 2 to column 59)",
  " (in 'string', line 169, column 2 to column 45)",
  " (in 'string', line 170, column 2 to column 45)",
  " (in 'string', line 172, column 2 to column 18)",
  " (in 'string', line 173, column 2 to column 45)",
  " (in 'string', line 174, column 2 to column 32)",
  " (in 'string', line 175, column 2 to column 103)",
  " (in 'string', line 176, column 2 to column 58)",
  " (in 'string', line 177, column 2 to column 61)",
  " (in 'string', line 178, column 2 to column 58)",
  " (in 'string', line 179, column 2 to column 68)",
  " (in 'string', line 180, column 2 to column 59)",
  " (in 'string', line 184, column 2 to column 41)",
  " (in 'string', line 185, column 2 to column 40)",
  " (in 'string', line 186, column 2 to column 52)",
  " (in 'string', line 187, column 2 to column 46)",
  " (in 'string', line 188, column 2 to column 47)",
  " (in 'string', line 189, column 2 to column 47)",
  " (in 'string', line 190, column 2 to column 41)",
  " (in 'string', line 191, column 2 to column 56)",
  " (in 'string', line 192, column 2 to column 45)",
  " (in 'string', line 193, column 2 to column 51)",
  " (in 'string', line 194, column 2 to column 20)",
  " (in 'string', line 195, column 2 to column 16)",
  " (in 'string', line 196, column 2 to column 26)",
  " (in 'string', line 197, column 2 to column 28)",
  " (in 'string', line 199, column 2 to column 25)",
  " (in 'string', line 200, column 2 to column 30)",
  " (in 'string', line 201, column 2 to column 30)",
  " (in 'string', line 202, column 2 to column 35)",
  " (in 'string', line 203, column 2 to column 31)",
  " (in 'string', line 204, column 2 to column 31)",
  " (in 'string', line 205, column 2 to column 39)",
  " (in 'string', line 469, column 2 to column 32)",
  " (in 'string', line 470, column 2 to column 31)",
  " (in 'string', line 471, column 2 to column 32)",
  " (in 'string', line 472, column 2 to column 41)",
  " (in 'string', line 473, column 2 to column 51)",
  " (in 'string', line 474, column 2 to column 12)",
  " (in 'string', line 206, column 53 to column 77)",
  " (in 'string', line 206, column 22 to column 47)",
  " (in 'string', line 206, column 2 to column 77)",
  " (in 'string', line 207, column 102 to column 128)",
  " (in 'string', line 207, column 67 to column 96)",
  " (in 'string', line 207, column 2 to column 128)",
  " (in 'string', line 208, column 69 to column 98)",
  " (in 'string', line 208, column 31 to column 63)",
  " (in 'string', line 208, column 2 to column 98)",
  " (in 'string', line 209, column 82 to column 121)",
  " (in 'string', line 209, column 34 to column 76)",
  " (in 'string', line 209, column 2 to column 121)",
  " (in 'string', line 210, column 75 to column 106)",
  " (in 'string', line 210, column 35 to column 69)",
  " (in 'string', line 210, column 2 to column 106)",
  " (in 'string', line 211, column 75 to column 106)",
  " (in 'string', line 211, column 35 to column 69)",
  " (in 'string', line 211, column 2 to column 106)",
  " (in 'string', line 236, column 24 to column 52)",
  " (in 'string', line 236, column 22 to column 54)",
  " (in 'string', line 236, column 6 to column 54)",
  " (in 'string', line 243, column 5 to column 46)",
  " (in 'string', line 242, column 20 to line 244, column 2)",
  " (in 'string', line 242, column 1 to line 244, column 2)",
  " (in 'string', line 250, column 3 to column 66)",
  " (in 'string', line 249, column 8 to line 251, column 2)",
  " (in 'string', line 248, column 3 to column 52)",
  " (in 'string', line 247, column 24 to line 249, column 2)",
  " (in 'string', line 247, column 8 to line 251, column 2)",
  " (in 'string', line 246, column 5 to column 35)",
  " (in 'string', line 245, column 20 to line 247, column 2)",
  " (in 'string', line 245, column 1 to line 251, column 2)",
  " (in 'string', line 241, column 13 to line 252, column 7)",
  " (in 'string', line 239, column 3 to column 19)",
  " (in 'string', line 238, column 20 to line 240, column 2)",
  " (in 'string', line 238, column 1 to line 240, column 2)",
  " (in 'string', line 237, column 19 to line 241, column 7)",
  " (in 'string', line 237, column 6 to line 252, column 7)",
  " (in 'string', line 256, column 1 to column 58)",
  " (in 'string', line 255, column 12 to line 257, column 7)",
  " (in 'string', line 254, column 1 to column 29)",
  " (in 'string', line 253, column 22 to line 255, column 7)",
  " (in 'string', line 253, column 6 to line 257, column 7)",
  " (in 'string', line 235, column 9 to line 258, column 5)",
  " (in 'string', line 214, column 24 to column 52)",
  " (in 'string', line 214, column 22 to column 54)",
  " (in 'string', line 214, column 6 to column 54)",
  " (in 'string', line 221, column 3 to column 44)",
  " (in 'string', line 220, column 19 to line 222, column 2)",
  " (in 'string', line 220, column 1 to line 222, column 2)",
  " (in 'string', line 226, column 3 to column 33)",
  " (in 'string', line 225, column 8 to line 227, column 2)",
  " (in 'string', line 224, column 3 to column 52)",
  " (in 'string', line 223, column 17 to line 225, column 2)",
  " (in 'string', line 223, column 1 to line 227, column 2)",
  " (in 'string', line 219, column 13 to line 228, column 7)",
  " (in 'string', line 217, column 3 to column 19)",
  " (in 'string', line 216, column 20 to line 218, column 2)",
  " (in 'string', line 216, column 1 to line 218, column 2)",
  " (in 'string', line 215, column 19 to line 219, column 7)",
  " (in 'string', line 215, column 6 to line 228, column 7)",
  " (in 'string', line 232, column 1 to column 26)",
  " (in 'string', line 231, column 13 to line 233, column 7)",
  " (in 'string', line 230, column 1 to column 29)",
  " (in 'string', line 229, column 22 to line 231, column 7)",
  " (in 'string', line 229, column 6 to line 233, column 7)",
  " (in 'string', line 213, column 16 to line 234, column 5)",
  " (in 'string', line 213, column 4 to line 258, column 5)",
  " (in 'string', line 212, column 20 to line 259, column 3)",
  " (in 'string', line 212, column 2 to line 259, column 3)",
  " (in 'string', line 267, column 5 to column 33)",
  " (in 'string', line 266, column 10 to line 268, column 4)",
  " (in 'string', line 265, column 5 to column 55)",
  " (in 'string', line 264, column 19 to line 266, column 4)",
  " (in 'string', line 264, column 3 to line 268, column 4)",
  " (in 'string', line 263, column 18 to line 269, column 2)",
  " (in 'string', line 263, column 1 to line 269, column 2)",
  " (in 'string', line 274, column 5 to column 31)",
  " (in 'string', line 273, column 10 to line 275, column 4)",
  " (in 'string', line 272, column 5 to column 48)",
  " (in 'string', line 271, column 15 to line 273, column 4)",
  " (in 'string', line 271, column 3 to line 275, column 4)",
  " (in 'string', line 270, column 16 to line 276, column 7)",
  " (in 'string', line 270, column 1 to line 276, column 7)",
  " (in 'string', line 280, column 11 to column 32)",
  " (in 'string', line 279, column 1 to column 34)",
  " (in 'string', line 278, column 6 to line 280, column 32)",
  " (in 'string', line 281, column 6 to column 31)",
  " (in 'string', line 282, column 6 to column 31)",
  " (in 'string', line 283, column 6 to column 31)",
  " (in 'string', line 303, column 3 to column 48)",
  " (in 'string', line 302, column 18 to line 304, column 2)",
  " (in 'string', line 302, column 1 to line 304, column 2)",
  " (in 'string', line 298, column 11 to line 305, column 7)",
  " (in 'string', line 288, column 3 to column 49)",
  " (in 'string', line 287, column 19 to line 289, column 2)",
  " (in 'string', line 287, column 1 to line 289, column 2)",
  " (in 'string', line 292, column 3 to column 35)",
  " (in 'string', line 291, column 23 to line 293, column 2)",
  " (in 'string', line 291, column 1 to line 293, column 2)",
  " (in 'string', line 295, column 3 to column 40)",
  " (in 'string', line 294, column 22 to line 296, column 2)",
  " (in 'string', line 294, column 1 to line 296, column 2)",
  " (in 'string', line 285, column 21 to line 297, column 7)",
  " (in 'string', line 285, column 6 to line 305, column 7)",
  " (in 'string', line 318, column 36 to column 51)",
  " (in 'string', line 318, column 34 to column 53)",
  " (in 'string', line 318, column 16 to column 53)",
  " (in 'string', line 318, column 13 to column 55)",
  " (in 'string', line 317, column 3 to column 27)",
  " (in 'string', line 315, column 5 to column 31)",
  " (in 'string', line 314, column 3 to line 315, column 31)",
  " (in 'string', line 313, column 21 to line 316, column 2)",
  " (in 'string', line 313, column 6 to line 317, column 27)",
  " (in 'string', line 310, column 5 to column 55)",
  " (in 'string', line 309, column 20 to line 311, column 4)",
  " (in 'string', line 309, column 3 to line 311, column 4)",
  " (in 'string', line 308, column 17 to line 312, column 2)",
  " (in 'string', line 308, column 1 to line 317, column 27)",
  " (in 'string', line 307, column 21 to line 318, column 7)",
  " (in 'string', line 307, column 6 to line 318, column 55)",
  " (in 'string', line 320, column 1 to column 52)",
  " (in 'string', line 321, column 1 to column 47)",
  " (in 'string', line 323, column 3 to column 28)",
  " (in 'string', line 322, column 1 to line 323, column 28)",
  " (in 'string', line 325, column 3 to column 91)",
  " (in 'string', line 324, column 1 to line 325, column 91)",
  " (in 'string', line 326, column 1 to column 34)",
  " (in 'string', line 327, column 1 to column 32)",
  " (in 'string', line 328, column 1 to column 37)",
  " (in 'string', line 329, column 1 to column 76)",
  " (in 'string', line 331, column 1 to column 49)",
  " (in 'string', line 332, column 1 to column 49)",
  " (in 'string', line 319, column 23 to line 333, column 7)",
  " (in 'string', line 319, column 6 to line 333, column 7)",
  " (in 'string', line 262, column 23 to line 334, column 5)",
  " (in 'string', line 262, column 4 to line 334, column 5)",
  " (in 'string', line 261, column 19 to line 335, column 3)",
  " (in 'string', line 261, column 2 to line 335, column 3)",
  " (in 'string', line 478, column 1 to column 83)",
  " (in 'string', line 479, column 1 to column 79)",
  " (in 'string', line 480, column 1 to column 83)",
  " (in 'string', line 482, column 3 to column 81)",
  " (in 'string', line 481, column 1 to line 482, column 81)",
  " (in 'string', line 483, column 1 to column 11)",
  " (in 'string', line 477, column 22 to line 484, column 7)",
  " (in 'string', line 477, column 6 to line 484, column 7)",
  " (in 'string', line 476, column 23 to line 485, column 5)",
  " (in 'string', line 476, column 4 to line 485, column 5)",
  " (in 'string', line 475, column 20 to line 486, column 3)",
  " (in 'string', line 475, column 2 to line 486, column 3)",
  " (in 'string', line 487, column 2 to column 84)",
  " (in 'string', line 338, column 2 to column 34)",
  " (in 'string', line 341, column 4 to column 36)",
  " (in 'string', line 352, column 3 to column 29)",
  " (in 'string', line 351, column 19 to line 353, column 2)",
  " (in 'string', line 351, column 1 to line 353, column 2)",
  " (in 'string', line 354, column 1 to column 33)",
  " (in 'string', line 356, column 3 to column 35)",
  " (in 'string', line 355, column 33 to line 357, column 2)",
  " (in 'string', line 355, column 1 to line 357, column 2)",
  " (in 'string', line 350, column 24 to line 358, column 7)",
  " (in 'string', line 350, column 6 to line 358, column 7)",
  " (in 'string', line 349, column 11 to line 359, column 5)",
  " (in 'string', line 344, column 1 to column 27)",
  " (in 'string', line 343, column 24 to line 345, column 7)",
  " (in 'string', line 343, column 6 to line 345, column 7)",
  " (in 'string', line 347, column 1 to column 33)",
  " (in 'string', line 346, column 38 to line 348, column 7)",
  " (in 'string', line 346, column 6 to line 348, column 7)",
  " (in 'string', line 342, column 16 to line 349, column 5)",
  " (in 'string', line 342, column 4 to line 359, column 5)",
  " (in 'string', line 340, column 17 to line 360, column 3)",
  " (in 'string', line 340, column 2 to line 360, column 3)",
  " (in 'string', line 368, column 3 to column 47)",
  " (in 'string', line 367, column 20 to line 369, column 2)",
  " (in 'string', line 367, column 1 to line 369, column 2)",
  " (in 'string', line 371, column 3 to column 36)",
  " (in 'string', line 370, column 19 to line 372, column 2)",
  " (in 'string', line 370, column 1 to line 372, column 2)",
  " (in 'string', line 366, column 21 to line 373, column 7)",
  " (in 'string', line 366, column 6 to line 373, column 7)",
  " (in 'string', line 365, column 22 to line 374, column 5)",
  " (in 'string', line 365, column 4 to line 374, column 5)",
  " (in 'string', line 361, column 18 to line 375, column 3)",
  " (in 'string', line 361, column 2 to line 375, column 3)",
  " (in 'string', line 378, column 4 to column 32)",
  " (in 'string', line 377, column 28 to line 379, column 3)",
  " (in 'string', line 377, column 2 to line 379, column 3)",
  " (in 'string', line 382, column 6 to column 67)",
  " (in 'string', line 383, column 6 to column 64)",
  " (in 'string', line 384, column 6 to column 67)",
  " (in 'string', line 386, column 1 to column 59)",
  " (in 'string', line 385, column 21 to line 387, column 7)",
  " (in 'string', line 385, column 6 to line 387, column 7)",
  " (in 'string', line 381, column 20 to line 388, column 5)",
  " (in 'string', line 381, column 4 to line 388, column 5)",
  " (in 'string', line 390, column 6 to column 48)",
  " (in 'string', line 389, column 30 to line 391, column 5)",
  " (in 'string', line 389, column 4 to line 391, column 5)",
  " (in 'string', line 380, column 20 to line 392, column 3)",
  " (in 'string', line 380, column 2 to line 392, column 3)",
  " (in 'string', line 411, column 3 to column 52)",
  " (in 'string', line 410, column 19 to line 412, column 2)",
  " (in 'string', line 410, column 1 to line 412, column 2)",
  " (in 'string', line 409, column 22 to line 413, column 7)",
  " (in 'string', line 409, column 6 to line 413, column 7)",
  " (in 'string', line 408, column 11 to line 414, column 5)",
  " (in 'string', line 407, column 22 to column 71)",
  " (in 'string', line 407, column 6 to column 71)",
  " (in 'string', line 406, column 24 to line 408, column 5)",
  " (in 'string', line 406, column 9 to line 414, column 5)",
  " (in 'string', line 398, column 5 to column 49)",
  " (in 'string', line 397, column 22 to line 399, column 4)",
  " (in 'string', line 397, column 3 to line 399, column 4)",
  " (in 'string', line 401, column 5 to column 38)",
  " (in 'string', line 400, column 21 to line 402, column 4)",
  " (in 'string', line 400, column 3 to line 402, column 4)",
  " (in 'string', line 396, column 16 to line 403, column 2)",
  " (in 'string', line 396, column 1 to line 403, column 2)",
  " (in 'string', line 395, column 24 to line 404, column 7)",
  " (in 'string', line 395, column 6 to line 404, column 7)",
  " (in 'string', line 394, column 20 to line 405, column 5)",
  " (in 'string', line 394, column 4 to line 414, column 5)",
  " (in 'string', line 393, column 16 to line 415, column 3)",
  " (in 'string', line 393, column 2 to line 415, column 3)",
  " (in 'string', line 419, column 4 to column 36)",
  " (in 'string', line 418, column 32 to line 420, column 3)",
  " (in 'string', line 418, column 2 to line 420, column 3)",
  " (in 'string', line 422, column 4 to column 37)",
  " (in 'string', line 421, column 34 to line 423, column 3)",
  " (in 'string', line 421, column 2 to line 423, column 3)",
  " (in 'string', line 425, column 4 to column 37)",
  " (in 'string', line 424, column 34 to line 426, column 3)",
  " (in 'string', line 424, column 2 to line 426, column 3)",
  " (in 'string', line 429, column 6 to column 45)",
  " (in 'string', line 427, column 55 to line 430, column 5)",
  " (in 'string', line 427, column 2 to line 430, column 5)",
  " (in 'string', line 432, column 2 to column 37)",
  " (in 'string', line 436, column 6 to column 43)",
  " (in 'string', line 435, column 38 to line 437, column 5)",
  " (in 'string', line 435, column 4 to line 437, column 5)",
  " (in 'string', line 441, column 6 to column 47)",
  " (in 'string', line 440, column 22 to line 442, column 5)",
  " (in 'string', line 440, column 4 to line 442, column 5)",
  " (in 'string', line 444, column 4 to column 49)",
  " (in 'string', line 446, column 4 to column 45)",
  " (in 'string', line 434, column 14 to line 450, column 3)",
  " (in 'string', line 434, column 2 to line 450, column 3)",
  " (in 'string', line 455, column 3 to column 54)",
  " (in 'string', line 454, column 16 to line 456, column 2)",
  " (in 'string', line 454, column 1 to line 456, column 2)",
  " (in 'string', line 453, column 24 to line 457, column 7)",
  " (in 'string', line 453, column 6 to line 457, column 7)",
  " (in 'string', line 452, column 21 to line 458, column 5)",
  " (in 'string', line 452, column 4 to line 458, column 5)",
  " (in 'string', line 451, column 18 to line 459, column 3)",
  " (in 'string', line 451, column 2 to line 459, column 3)",
  " (in 'string', line 463, column 1 to column 27)",
  " (in 'string', line 462, column 21 to line 464, column 7)",
  " (in 'string', line 462, column 6 to line 464, column 7)",
  " (in 'string', line 461, column 22 to line 465, column 5)",
  " (in 'string', line 461, column 4 to line 465, column 5)",
  " (in 'string', line 460, column 16 to line 466, column 3)",
  " (in 'string', line 460, column 2 to line 466, column 3)",
  " (in 'string', line 104, column 2 to column 20)",
  " (in 'string', line 105, column 2 to column 21)",
  " (in 'string', line 106, column 2 to column 18)",
  " (in 'string', line 107, column 2 to column 21)",
  " (in 'string', line 108, column 2 to column 16)",
  " (in 'string', line 109, column 2 to column 16)",
  " (in 'string', line 110, column 8 to column 12)",
  " (in 'string', line 110, column 13 to column 18)",
  " (in 'string', line 110, column 19 to column 21)",
  " (in 'string', line 110, column 2 to column 45)",
  " (in 'string', line 111, column 8 to column 12)",
  " (in 'string', line 111, column 13 to column 18)",
  " (in 'string', line 111, column 19 to column 21)",
  " (in 'string', line 111, column 2 to column 47)",
  " (in 'string', line 112, column 8 to column 12)",
  " (in 'string', line 112, column 13 to column 18)",
  " (in 'string', line 112, column 19 to column 21)",
  " (in 'string', line 112, column 2 to column 45)",
  " (in 'string', line 113, column 8 to column 12)",
  " (in 'string', line 113, column 13 to column 18)",
  " (in 'string', line 113, column 19 to column 21)",
  " (in 'string', line 113, column 2 to column 47)",
  " (in 'string', line 114, column 8 to column 12)",
  " (in 'string', line 114, column 13 to column 18)",
  " (in 'string', line 114, column 19 to column 21)",
  " (in 'string', line 114, column 2 to column 44)",
  " (in 'string', line 115, column 8 to column 12)",
  " (in 'string', line 115, column 13 to column 18)",
  " (in 'string', line 115, column 19 to column 21)",
  " (in 'string', line 115, column 2 to column 46)",
  " (in 'string', line 116, column 8 to column 12)",
  " (in 'string', line 116, column 13 to column 18)",
  " (in 'string', line 116, column 19 to column 21)",
  " (in 'string', line 116, column 2 to column 44)",
  " (in 'string', line 117, column 8 to column 12)",
  " (in 'string', line 117, column 13 to column 18)",
  " (in 'string', line 117, column 19 to column 21)",
  " (in 'string', line 117, column 2 to column 46)",
  " (in 'string', line 119, column 2 to column 17)",
  " (in 'string', line 120, column 9 to column 13)",
  " (in 'string', line 120, column 14 to column 15)",
  " (in 'string', line 120, column 2 to column 19)",
  " (in 'string', line 121, column 2 to column 32)",
  " (in 'string', line 122, column 2 to column 12)",
  " (in 'string', line 123, column 2 to column 21)",
  " (in 'string', line 124, column 2 to column 12)",
  " (in 'string', line 125, column 2 to column 21)",
  " (in 'string', line 126, column 2 to column 24)",
  " (in 'string', line 127, column 2 to column 24)",
  " (in 'string', line 128, column 2 to column 26)",
  " (in 'string', line 129, column 2 to column 26)",
  " (in 'string', line 130, column 2 to column 35)",
  " (in 'string', line 131, column 2 to column 37)",
  " (in 'string', line 134, column 2 to column 20)",
  " (in 'string', line 135, column 2 to column 17)",
  " (in 'string', line 136, column 2 to column 13)",
  " (in 'string', line 137, column 2 to column 15)",
  " (in 'string', line 138, column 2 to column 16)",
  " (in 'string', line 139, column 2 to column 17)",
  " (in 'string', line 140, column 2 to column 17)",
  " (in 'string', line 142, column 2 to column 21)",
  " (in 'string', line 143, column 2 to column 23)",
  " (in 'string', line 144, column 2 to column 29)",
  " (in 'string', line 145, column 2 to column 31)",
  " (in 'string', line 146, column 2 to column 35)",
  " (in 'string', line 147, column 2 to column 35)",
  " (in 'string', line 149, column 2 to column 18)",
  " (in 'string', line 150, column 2 to column 22)",
  " (in 'string', line 151, column 2 to column 19)",
  " (in 'string', line 152, column 2 to column 19)",
  " (in 'string', line 153, column 2 to column 32)",
  " (in 'string', line 154, column 2 to column 37)",
  " (in 'string', line 155, column 2 to column 33)",
  " (in 'string', line 156, column 2 to column 33)",
  " (in 'string', line 159, column 8 to column 29)",
  " (in 'string', line 159, column 30 to column 35)",
  " (in 'string', line 159, column 36 to column 38)",
  " (in 'string', line 160, column 8 to column 67)",
  " (in 'string', line 160, column 68 to column 70)",
  " (in 'string', line 162, column 9 to column 27)",
  " (in 'string', line 162, column 29 to column 60)",
  " (in 'string', line 163, column 9 to column 41)",
  " (in 'string', line 163, column 43 to column 72)",
  " (in 'string', line 164, column 9 to column 10)",
  " (in 'string', line 164, column 12 to column 30)",
  " (in 'string', line 165, column 9 to column 17)",
  " (in 'string', line 168, column 9 to column 49)",
  " (in 'string', line 169, column 8 to column 20)",
  " (in 'string', line 169, column 21 to column 26)",
  " (in 'string', line 169, column 27 to column 29)",
  " (in 'string', line 170, column 8 to column 20)",
  " (in 'string', line 170, column 21 to column 26)",
  " (in 'string', line 170, column 27 to column 29)",
  " (in 'string', line 173, column 18 to column 34)",
  " (in 'string', line 174, column 9 to column 19)",
  " (in 'string', line 175, column 18 to column 92)",
  " (in 'string', line 176, column 18 to column 46)",
  " (in 'string', line 177, column 18 to column 44)",
  " (in 'string', line 178, column 18 to column 45)",
  " (in 'string', line 179, column 18 to column 55)",
  " (in 'string', line 180, column 8 to column 23)",
  " (in 'string', line 180, column 24 to column 26)",
  " (in 'string', line 184, column 8 to column 12)",
  " (in 'string', line 184, column 13 to column 18)",
  " (in 'string', line 184, column 19 to column 21)",
  " (in 'string', line 185, column 8 to column 12)",
  " (in 'string', line 185, column 13 to column 18)",
  " (in 'string', line 185, column 19 to column 21)",
  " (in 'string', line 186, column 8 to column 23)",
  " (in 'string', line 186, column 24 to column 29)",
  " (in 'string', line 186, column 30 to column 32)",
  " (in 'string', line 187, column 8 to column 12)",
  " (in 'string', line 187, column 13 to column 18)",
  " (in 'string', line 187, column 19 to column 21)",
  " (in 'string', line 188, column 8 to column 12)",
  " (in 'string', line 188, column 13 to column 18)",
  " (in 'string', line 188, column 19 to column 21)",
  " (in 'string', line 189, column 8 to column 12)",
  " (in 'string', line 189, column 13 to column 18)",
  " (in 'string', line 189, column 19 to column 21)",
  " (in 'string', line 190, column 8 to column 12)",
  " (in 'string', line 190, column 13 to column 18)",
  " (in 'string', line 190, column 19 to column 21)",
  " (in 'string', line 191, column 8 to column 22)",
  " (in 'string', line 191, column 23 to column 28)",
  " (in 'string', line 191, column 29 to column 31)",
  " (in 'string', line 192, column 8 to column 12)",
  " (in 'string', line 192, column 13 to column 18)",
  " (in 'string', line 192, column 19 to column 21)",
  " (in 'string', line 193, column 8 to column 14)",
  " (in 'string', line 193, column 15 to column 20)",
  " (in 'string', line 193, column 21 to column 23)",
  " (in 'string', line 199, column 9 to column 10)",
  " (in 'string', line 199, column 11 to column 16)",
  " (in 'string', line 200, column 8 to column 9)",
  " (in 'string', line 200, column 10 to column 15)",
  " (in 'string', line 200, column 16 to column 18)",
  " (in 'string', line 205, column 9 to column 25)",
  " (in 'string', line 469, column 9 to column 22)",
  " (in 'string', line 470, column 9 to column 22)",
  " (in 'string', line 471, column 9 to column 22)",
  " (in 'string', line 472, column 9 to column 32)",
  " (in 'string', line 473, column 9 to column 38)",
  " (in 'string', line 11, column 4 to column 23)",
  " (in 'string', line 12, column 4 to column 61)",
  " (in 'string', line 13, column 4 to column 31)",
  " (in 'string', line 14, column 4 to column 31)",
  " (in 'string', line 15, column 4 to column 18)",
  " (in 'string', line 16, column 4 to column 57)",
  " (in 'string', line 17, column 4 to column 23)",
  " (in 'string', line 18, column 4 to column 15)",
  " (in 'string', line 20, column 4 to column 25)",
  " (in 'string', line 21, column 4 to column 54)",
  " (in 'string', line 22, column 4 to column 15)",
  " (in 'string', line 24, column 4 to column 44)",
  " (in 'string', line 25, column 4 to column 51)",
  " (in 'string', line 26, column 4 to column 15)",
  " (in 'string', line 27, column 4 to column 13)",
  " (in 'string', line 10, column 50 to line 28, column 3)",
  " (in 'string', line 31, column 4 to column 19)",
  " (in 'string', line 32, column 4 to column 38)",
  " (in 'string', line 33, column 4 to column 31)",
  " (in 'string', line 34, column 4 to column 31)",
  " (in 'string', line 35, column 4 to column 18)",
  " (in 'string', line 36, column 4 to column 53)",
  " (in 'string', line 37, column 4 to column 15)",
  " (in 'string', line 38, column 4 to column 15)",
  " (in 'string', line 40, column 4 to column 25)",
  " (in 'string', line 41, column 4 to column 50)",
  " (in 'string', line 42, column 4 to column 15)",
  " (in 'string', line 44, column 4 to column 44)",
  " (in 'string', line 45, column 4 to column 51)",
  " (in 'string', line 46, column 4 to column 15)",
  " (in 'string', line 47, column 4 to column 13)",
  " (in 'string', line 30, column 47 to line 48, column 3)",
  " (in 'string', line 51, column 4 to column 18)",
  " (in 'string', line 52, column 4 to column 21)",
  " (in 'string', line 53, column 4 to column 23)",
  " (in 'string', line 54, column 4 to column 38)",
  " (in 'string', line 56, column 4 to column 15)",
  " (in 'string', line 57, column 4 to column 21)",
  " (in 'string', line 58, column 4 to column 25)",
  " (in 'string', line 60, column 4 to column 15)",
  " (in 'string', line 61, column 4 to column 15)",
  " (in 'string', line 62, column 4 to column 15)",
  " (in 'string', line 63, column 4 to column 13)",
  " (in 'string', line 50, column 38 to line 64, column 3)",
  " (in 'string', line 67, column 6 to column 21)",
  " (in 'string', line 70, column 3 to column 20)",
  " (in 'string', line 71, column 19 to column 31)",
  " (in 'string', line 71, column 3 to column 31)",
  " (in 'string', line 72, column 19 to column 31)",
  " (in 'string', line 72, column 3 to column 31)",
  " (in 'string', line 69, column 16 to line 73, column 2)",
  " (in 'string', line 69, column 1 to line 73, column 2)",
  " (in 'string', line 68, column 21 to line 74, column 7)",
  " (in 'string', line 68, column 6 to line 74, column 7)",
  " (in 'string', line 75, column 6 to column 16)",
  " (in 'string', line 66, column 29 to line 76, column 5)",
  " (in 'string', line 79, column 4 to column 18)",
  " (in 'string', line 86, column 1 to column 32)",
  " (in 'string', line 84, column 1 to column 28)",
  " (in 'string', line 83, column 6 to line 86, column 32)",
  " (in 'string', line 82, column 9 to line 87, column 5)",
  " (in 'string', line 81, column 6 to column 35)",
  " (in 'string', line 80, column 4 to line 87, column 5)",
  " (in 'string', line 88, column 4 to column 23)",
  " (in 'string', line 78, column 45 to line 89, column 3)",
  " (in 'string', line 92, column 4 to column 13)",
  " (in 'string', line 97, column 13 to column 21)",
  " (in 'string', line 97, column 11 to column 23)",
  " (in 'string', line 96, column 6 to column 32)",
  " (in 'string', line 95, column 23 to line 97, column 5)",
  " (in 'string', line 95, column 11 to line 97, column 23)",
  " (in 'string', line 94, column 6 to column 36)",
  " (in 'string', line 93, column 16 to line 95, column 5)",
  " (in 'string', line 93, column 4 to line 97, column 23)",
  " (in 'string', line 98, column 4 to column 13)",
  " (in 'string', line 91, column 25 to line 99, column 3)"};
template <typename T0__, typename T1__, typename T2__,
          stan::require_all_t<stan::is_stan_scalar<T0__>,
                              stan::is_stan_scalar<T1__>,
                              stan::is_stan_scalar<T2__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<T0__, T1__, T2__>,-1,-1>
trans_probs_rem(const T0__& i, const T1__& f, const T2__& r, std::ostream*
                pstream__);
template <typename T0__, typename T1__,
          stan::require_all_t<stan::is_stan_scalar<T0__>,
                              stan::is_stan_scalar<T1__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<T0__, T1__>,-1,-1>
trans_probs_norem_if(const T0__& i, const T1__& f, std::ostream* pstream__);
template <typename T0__,
          stan::require_all_t<stan::is_stan_scalar<T0__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<T0__>,-1,-1>
trans_probs_norem_i(const T0__& i, std::ostream* pstream__);
template <typename T0__,
          stan::require_all_t<stan::is_eigen_matrix_dynamic<T0__>,
                              stan::is_vt_not_complex<T0__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T0__>>,-1,-1>
defuzz_P(const T0__& P_arg__, std::ostream* pstream__);
template <typename T0__, typename T1__, typename T2__,
          stan::require_all_t<stan::is_stan_scalar<T0__>,
                              stan::is_stan_scalar<T1__>,
                              stan::is_stan_scalar<T2__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<T0__, T1__, T2__>,-1,-1>
trans_probs(const T0__& i, const T1__& f, const T2__& r, std::ostream*
            pstream__);
template <typename T0__,
          stan::require_all_t<stan::is_stan_scalar<T0__>>* = nullptr>
stan::promote_args_t<T0__> bound_prob(const T0__& x, std::ostream* pstream__);
template <typename T0__, typename T1__, typename T2__,
          stan::require_all_t<stan::is_stan_scalar<T0__>,
                              stan::is_stan_scalar<T1__>,
                              stan::is_stan_scalar<T2__>>*>
Eigen::Matrix<stan::promote_args_t<T0__, T1__, T2__>,-1,-1>
trans_probs_rem(const T0__& i, const T1__& f, const T2__& r, std::ostream*
                pstream__) {
  using local_scalar_t__ = stan::promote_args_t<T0__, T1__, T2__>;
  int current_statement__ = 0;
  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__ l = DUMMY_VAR__;
    current_statement__ = 454;
    l = ((i + r) + f);
    local_scalar_t__ q = DUMMY_VAR__;
    current_statement__ = 455;
    q = stan::math::sqrt(((((((i * i) + ((2 * i) * r)) - ((2 * i) * f)) + (r
          * r)) + ((2 * f) * r)) + (f * f)));
    local_scalar_t__ w = DUMMY_VAR__;
    current_statement__ = 456;
    w = stan::math::exp((-(l + q) / 2));
    local_scalar_t__ v = DUMMY_VAR__;
    current_statement__ = 457;
    v = stan::math::exp((-(l - q) / 2));
    Eigen::Matrix<local_scalar_t__,-1,-1> P =
      Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(3, 3, DUMMY_VAR__);
    current_statement__ = 459;
    stan::model::assign(P, (((((2 * (v - w)) * (f + r)) + (v * (q - l))) + (w
      * (q + l))) / (2 * q)), "assigning variable P",
      stan::model::index_uni(1), stan::model::index_uni(1));
    current_statement__ = 460;
    stan::model::assign(P, (((v - w) * r) / q), "assigning variable P",
      stan::model::index_uni(2), stan::model::index_uni(1));
    current_statement__ = 461;
    stan::model::assign(P, 0, "assigning variable P",
      stan::model::index_uni(3), stan::model::index_uni(1));
    current_statement__ = 462;
    stan::model::assign(P, ((i * (v - w)) / q), "assigning variable P",
      stan::model::index_uni(1), stan::model::index_uni(2));
    current_statement__ = 463;
    stan::model::assign(P, (-((((2 * (f + r)) - l) * (v - w)) - (q * (v +
      w))) / (2 * q)), "assigning variable P", stan::model::index_uni(2),
      stan::model::index_uni(2));
    current_statement__ = 464;
    stan::model::assign(P, 0, "assigning variable P",
      stan::model::index_uni(3), stan::model::index_uni(2));
    current_statement__ = 465;
    stan::model::assign(P, ((((-l * (v - w)) - (q * (v + w))) / (2 * q)) +
      1), "assigning variable P", stan::model::index_uni(1),
      stan::model::index_uni(3));
    current_statement__ = 466;
    stan::model::assign(P, (((((v - w) * ((2 * f) - l)) - (q * (v + w))) / (2
      * q)) + 1), "assigning variable P", stan::model::index_uni(2),
      stan::model::index_uni(3));
    current_statement__ = 467;
    stan::model::assign(P, 1, "assigning variable P",
      stan::model::index_uni(3), stan::model::index_uni(3));
    current_statement__ = 468;
    return P;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T0__, typename T1__,
          stan::require_all_t<stan::is_stan_scalar<T0__>,
                              stan::is_stan_scalar<T1__>>*>
Eigen::Matrix<stan::promote_args_t<T0__, T1__>,-1,-1>
trans_probs_norem_if(const T0__& i, const T1__& f, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<T0__, T1__>;
  int current_statement__ = 0;
  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__ l = DUMMY_VAR__;
    current_statement__ = 470;
    l = (i + f);
    local_scalar_t__ q = DUMMY_VAR__;
    current_statement__ = 471;
    q = stan::math::sqrt((((i * i) - ((2 * i) * f)) + (f * f)));
    local_scalar_t__ w = DUMMY_VAR__;
    current_statement__ = 472;
    w = stan::math::exp((-(l + q) / 2));
    local_scalar_t__ v = DUMMY_VAR__;
    current_statement__ = 473;
    v = stan::math::exp((-(l - q) / 2));
    Eigen::Matrix<local_scalar_t__,-1,-1> P =
      Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(3, 3, DUMMY_VAR__);
    current_statement__ = 475;
    stan::model::assign(P, (((((2 * (v - w)) * f) + (v * (q - l))) + (w * (q
      + l))) / (2 * q)), "assigning variable P", stan::model::index_uni(1),
      stan::model::index_uni(1));
    current_statement__ = 476;
    stan::model::assign(P, 0, "assigning variable P",
      stan::model::index_uni(2), stan::model::index_uni(1));
    current_statement__ = 477;
    stan::model::assign(P, 0, "assigning variable P",
      stan::model::index_uni(3), stan::model::index_uni(1));
    current_statement__ = 478;
    stan::model::assign(P, ((i * (v - w)) / q), "assigning variable P",
      stan::model::index_uni(1), stan::model::index_uni(2));
    current_statement__ = 479;
    stan::model::assign(P, (-((((2 * f) - l) * (v - w)) - (q * (v + w))) / (2
      * q)), "assigning variable P", stan::model::index_uni(2),
      stan::model::index_uni(2));
    current_statement__ = 480;
    stan::model::assign(P, 0, "assigning variable P",
      stan::model::index_uni(3), stan::model::index_uni(2));
    current_statement__ = 481;
    stan::model::assign(P, ((((-l * (v - w)) - (q * (v + w))) / (2 * q)) +
      1), "assigning variable P", stan::model::index_uni(1),
      stan::model::index_uni(3));
    current_statement__ = 482;
    stan::model::assign(P, (((((v - w) * ((2 * f) - l)) - (q * (v + w))) / (2
      * q)) + 1), "assigning variable P", stan::model::index_uni(2),
      stan::model::index_uni(3));
    current_statement__ = 483;
    stan::model::assign(P, 1, "assigning variable P",
      stan::model::index_uni(3), stan::model::index_uni(3));
    current_statement__ = 484;
    return P;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T0__, stan::require_all_t<stan::is_stan_scalar<T0__>>*>
Eigen::Matrix<stan::promote_args_t<T0__>,-1,-1>
trans_probs_norem_i(const T0__& i, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<T0__>;
  int current_statement__ = 0;
  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 {
    Eigen::Matrix<local_scalar_t__,-1,-1> P =
      Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(3, 3, DUMMY_VAR__);
    current_statement__ = 487;
    stan::model::assign(P, stan::math::exp(-i), "assigning variable P",
      stan::model::index_uni(1), stan::model::index_uni(1));
    current_statement__ = 488;
    stan::model::assign(P, (i * stan::math::exp(-i)), "assigning variable P",
      stan::model::index_uni(1), stan::model::index_uni(2));
    current_statement__ = 489;
    stan::model::assign(P, ((-stan::math::exp(-i) + 1) - (i *
      stan::math::exp(-i))), "assigning variable P",
      stan::model::index_uni(1), stan::model::index_uni(3));
    current_statement__ = 490;
    stan::model::assign(P, 0, "assigning variable P",
      stan::model::index_uni(2), stan::model::index_uni(1));
    current_statement__ = 491;
    stan::model::assign(P, stan::math::exp(-i), "assigning variable P",
      stan::model::index_uni(2), stan::model::index_uni(2));
    current_statement__ = 492;
    stan::model::assign(P, (1 - stan::math::exp(-i)), "assigning variable P",
      stan::model::index_uni(2), stan::model::index_uni(3));
    current_statement__ = 493;
    stan::model::assign(P, 0, "assigning variable P",
      stan::model::index_uni(3), stan::model::index_uni(1));
    current_statement__ = 494;
    stan::model::assign(P, 0, "assigning variable P",
      stan::model::index_uni(3), stan::model::index_uni(2));
    current_statement__ = 495;
    stan::model::assign(P, 1, "assigning variable P",
      stan::model::index_uni(3), stan::model::index_uni(3));
    current_statement__ = 496;
    return P;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T0__,
          stan::require_all_t<stan::is_eigen_matrix_dynamic<T0__>,
                              stan::is_vt_not_complex<T0__>>*>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T0__>>,-1,-1>
defuzz_P(const T0__& P_arg__, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T0__>>;
  int current_statement__ = 0;
  const auto& P = stan::math::to_ref(P_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 {
    Eigen::Matrix<local_scalar_t__,-1,-1> Pr =
      Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(3, 3, DUMMY_VAR__);
    current_statement__ = 507;
    for (int r = 1; r <= 3; ++r) {
      current_statement__ = 505;
      for (int s = 1; s <= 3; ++s) {
        current_statement__ = 499;
        stan::model::assign(Pr,
          stan::model::rvalue(P, "P", stan::model::index_uni(r),
            stan::model::index_uni(s)), "assigning variable Pr",
          stan::model::index_uni(r), stan::model::index_uni(s));
        current_statement__ = 501;
        if (stan::math::logical_lt(
              stan::model::rvalue(P, "P", stan::model::index_uni(r),
                stan::model::index_uni(s)), 0)) {
          current_statement__ = 500;
          stan::model::assign(Pr, 0, "assigning variable Pr",
            stan::model::index_uni(r), stan::model::index_uni(s));
        }
        current_statement__ = 503;
        if (stan::math::logical_gt(
              stan::model::rvalue(P, "P", stan::model::index_uni(r),
                stan::model::index_uni(s)), 1)) {
          current_statement__ = 502;
          stan::model::assign(Pr, 1, "assigning variable Pr",
            stan::model::index_uni(r), stan::model::index_uni(s));
        }
      }
    }
    current_statement__ = 508;
    return Pr;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T0__, typename T1__, typename T2__,
          stan::require_all_t<stan::is_stan_scalar<T0__>,
                              stan::is_stan_scalar<T1__>,
                              stan::is_stan_scalar<T2__>>*>
Eigen::Matrix<stan::promote_args_t<T0__, T1__, T2__>,-1,-1>
trans_probs(const T0__& i, const T1__& f, const T2__& r, std::ostream*
            pstream__) {
  using local_scalar_t__ = stan::promote_args_t<T0__, T1__, T2__>;
  int current_statement__ = 0;
  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 {
    Eigen::Matrix<local_scalar_t__,-1,-1> P =
      Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(3, 3, DUMMY_VAR__);
    current_statement__ = 516;
    if (stan::math::logical_neq(r, 0)) {
      current_statement__ = 515;
      stan::model::assign(P, trans_probs_rem(i, f, r, pstream__),
        "assigning variable P");
    } else {
      current_statement__ = 513;
      if (stan::math::logical_eq(i, f)) {
        current_statement__ = 512;
        stan::model::assign(P, trans_probs_norem_i(i, pstream__),
          "assigning variable P");
      } else {
        current_statement__ = 511;
        stan::model::assign(P, trans_probs_norem_if(i, f, pstream__),
          "assigning variable P");
      }
    }
    current_statement__ = 517;
    return defuzz_P(P, pstream__);
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T0__, stan::require_all_t<stan::is_stan_scalar<T0__>>*>
stan::promote_args_t<T0__> bound_prob(const T0__& x, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<T0__>;
  int current_statement__ = 0;
  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__ ret = DUMMY_VAR__;
    current_statement__ = 527;
    if (stan::math::logical_gte(x, 1)) {
      current_statement__ = 525;
      ret = (1 - stan::math::machine_precision());
    } else {
      current_statement__ = 524;
      if (stan::math::logical_lte(x, 0)) {
        current_statement__ = 522;
        ret = stan::math::machine_precision();
      } else {
        current_statement__ = 520;
        ret = x;
      }
    }
    current_statement__ = 528;
    return x;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
#include <stan_meta_header.hpp>
class model_disbayes_hier final : public model_base_crtp<model_disbayes_hier> {
private:
  int nage;
  int narea;
  int ng;
  int eqage;
  int remission;
  int prev_zero;
  std::vector<std::vector<std::vector<int>>> mort_num;
  std::vector<std::vector<std::vector<int>>> mort_denom;
  std::vector<std::vector<std::vector<int>>> prev_num;
  std::vector<std::vector<std::vector<int>>> prev_denom;
  std::vector<std::vector<std::vector<int>>> inc_num;
  std::vector<std::vector<std::vector<int>>> inc_denom;
  std::vector<std::vector<std::vector<int>>> rem_num;
  std::vector<std::vector<std::vector<int>>> rem_denom;
  int K;
  Eigen::Matrix<double,-1,-1> X_data__;
  std::vector<double> sprior;
  double mipm;
  double mips;
  double mism;
  double miss;
  double gpint_a;
  double gpint_b;
  double gpslope_a;
  double gpslope_b;
  double gender_int_priorsd;
  double gender_slope_priorsd;
  int interceptonly;
  int increasing;
  int common;
  int const_cf;
  int const_rem;
  int smooth_inc;
  int smooth_rem;
  int sd_int_isfixed;
  int sd_slope_isfixed;
  double sd_int_fixed;
  double sd_slope_fixed;
  std::vector<double> inc_prior;
  std::vector<double> rem_prior;
  int scf_isfixed;
  int scfmale_isfixed;
  int sinc_isfixed;
  int srem_isfixed;
  double lambda_cf_fixed;
  double lambda_cf_male_fixed;
  double lambda_inc_fixed;
  double lambda_rem_fixed;
  int inc_par_1dim__;
  int rem_par_1dim__;
  int barea_1dim__;
  int barea_2dim__;
  int barea_slope_1dim__;
  int barea_slope_2dim__;
  int barea_inter_2dim__;
  int bmale_1dim__;
  int lcfbase_1dim__;
  int beta_inc_1dim__;
  int beta_rem_1dim__;
  int sd_inter_1dim__;
  int mean_slope_1dim__;
  int sd_slope_1dim__;
  int lambda_cf_1dim__;
  int lambda_cf_male_1dim__;
  int lambda_inc_1dim__;
  int lambda_rem_1dim__;
  int prevzero_1dim__;
  int dcf_1dim__;
  int rem_prob_1dim__;
  int state_probs_1dim__;
  int lcfbase_use_1dim__;
  int ll_mort_1dim__;
  int ll_inc_1dim__;
  int ll_prev_1dim__;
  int ll_rem_1dim__;
  int ll_overall_1dim__;
  Eigen::Map<Eigen::Matrix<double,-1,-1>> X{nullptr, 0, 0};
public:
  ~model_disbayes_hier() {}
  model_disbayes_hier(stan::io::var_context& context__, unsigned int
                      random_seed__ = 0, std::ostream* pstream__ = nullptr)
      : model_base_crtp(0) {
    int current_statement__ = 0;
    using local_scalar_t__ = double;
    boost::ecuyer1988 base_rng__ =
      stan::services::util::create_rng(random_seed__, 0);
    // suppress unused var warning
    (void) base_rng__;
    static constexpr const char* function__ =
      "model_disbayes_hier_namespace::model_disbayes_hier";
    // 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__ = 311;
      context__.validate_dims("data initialization", "nage", "int",
        std::vector<size_t>{});
      nage = std::numeric_limits<int>::min();
      current_statement__ = 311;
      nage = context__.vals_i("nage")[(1 - 1)];
      current_statement__ = 311;
      stan::math::check_greater_or_equal(function__, "nage", nage, 0);
      current_statement__ = 312;
      context__.validate_dims("data initialization", "narea", "int",
        std::vector<size_t>{});
      narea = std::numeric_limits<int>::min();
      current_statement__ = 312;
      narea = context__.vals_i("narea")[(1 - 1)];
      current_statement__ = 312;
      stan::math::check_greater_or_equal(function__, "narea", narea, 0);
      current_statement__ = 313;
      context__.validate_dims("data initialization", "ng", "int",
        std::vector<size_t>{});
      ng = std::numeric_limits<int>::min();
      current_statement__ = 313;
      ng = context__.vals_i("ng")[(1 - 1)];
      current_statement__ = 313;
      stan::math::check_greater_or_equal(function__, "ng", ng, 0);
      current_statement__ = 314;
      context__.validate_dims("data initialization", "eqage", "int",
        std::vector<size_t>{});
      eqage = std::numeric_limits<int>::min();
      current_statement__ = 314;
      eqage = context__.vals_i("eqage")[(1 - 1)];
      current_statement__ = 314;
      stan::math::check_greater_or_equal(function__, "eqage", eqage, 0);
      current_statement__ = 315;
      context__.validate_dims("data initialization", "remission", "int",
        std::vector<size_t>{});
      remission = std::numeric_limits<int>::min();
      current_statement__ = 315;
      remission = context__.vals_i("remission")[(1 - 1)];
      current_statement__ = 316;
      context__.validate_dims("data initialization", "prev_zero", "int",
        std::vector<size_t>{});
      prev_zero = std::numeric_limits<int>::min();
      current_statement__ = 316;
      prev_zero = context__.vals_i("prev_zero")[(1 - 1)];
      current_statement__ = 317;
      stan::math::validate_non_negative_index("mort_num", "nage", nage);
      current_statement__ = 318;
      stan::math::validate_non_negative_index("mort_num", "narea", narea);
      current_statement__ = 319;
      stan::math::validate_non_negative_index("mort_num", "ng", ng);
      current_statement__ = 320;
      context__.validate_dims("data initialization", "mort_num", "int",
        std::vector<size_t>{static_cast<size_t>(nage),
          static_cast<size_t>(narea), static_cast<size_t>(ng)});
      mort_num = std::vector<std::vector<std::vector<int>>>(nage,
                   std::vector<std::vector<int>>(narea,
                     std::vector<int>(ng, std::numeric_limits<int>::min())));
      {
        std::vector<int> mort_num_flat__;
        current_statement__ = 320;
        mort_num_flat__ = context__.vals_i("mort_num");
        current_statement__ = 320;
        pos__ = 1;
        current_statement__ = 320;
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          current_statement__ = 320;
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            current_statement__ = 320;
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              current_statement__ = 320;
              stan::model::assign(mort_num, mort_num_flat__[(pos__ - 1)],
                "assigning variable mort_num",
                stan::model::index_uni(sym3__),
                stan::model::index_uni(sym2__),
                stan::model::index_uni(sym1__));
              current_statement__ = 320;
              pos__ = (pos__ + 1);
            }
          }
        }
      }
      current_statement__ = 320;
      stan::math::check_greater_or_equal(function__, "mort_num", mort_num, 0);
      current_statement__ = 321;
      stan::math::validate_non_negative_index("mort_denom", "nage", nage);
      current_statement__ = 322;
      stan::math::validate_non_negative_index("mort_denom", "narea", narea);
      current_statement__ = 323;
      stan::math::validate_non_negative_index("mort_denom", "ng", ng);
      current_statement__ = 324;
      context__.validate_dims("data initialization", "mort_denom", "int",
        std::vector<size_t>{static_cast<size_t>(nage),
          static_cast<size_t>(narea), static_cast<size_t>(ng)});
      mort_denom = std::vector<std::vector<std::vector<int>>>(nage,
                     std::vector<std::vector<int>>(narea,
                       std::vector<int>(ng, std::numeric_limits<int>::min())));
      {
        std::vector<int> mort_denom_flat__;
        current_statement__ = 324;
        mort_denom_flat__ = context__.vals_i("mort_denom");
        current_statement__ = 324;
        pos__ = 1;
        current_statement__ = 324;
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          current_statement__ = 324;
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            current_statement__ = 324;
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              current_statement__ = 324;
              stan::model::assign(mort_denom, mort_denom_flat__[(pos__ - 1)],
                "assigning variable mort_denom",
                stan::model::index_uni(sym3__),
                stan::model::index_uni(sym2__),
                stan::model::index_uni(sym1__));
              current_statement__ = 324;
              pos__ = (pos__ + 1);
            }
          }
        }
      }
      current_statement__ = 324;
      stan::math::check_greater_or_equal(function__, "mort_denom",
        mort_denom, 0);
      current_statement__ = 325;
      stan::math::validate_non_negative_index("prev_num", "nage", nage);
      current_statement__ = 326;
      stan::math::validate_non_negative_index("prev_num", "narea", narea);
      current_statement__ = 327;
      stan::math::validate_non_negative_index("prev_num", "ng", ng);
      current_statement__ = 328;
      context__.validate_dims("data initialization", "prev_num", "int",
        std::vector<size_t>{static_cast<size_t>(nage),
          static_cast<size_t>(narea), static_cast<size_t>(ng)});
      prev_num = std::vector<std::vector<std::vector<int>>>(nage,
                   std::vector<std::vector<int>>(narea,
                     std::vector<int>(ng, std::numeric_limits<int>::min())));
      {
        std::vector<int> prev_num_flat__;
        current_statement__ = 328;
        prev_num_flat__ = context__.vals_i("prev_num");
        current_statement__ = 328;
        pos__ = 1;
        current_statement__ = 328;
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          current_statement__ = 328;
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            current_statement__ = 328;
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              current_statement__ = 328;
              stan::model::assign(prev_num, prev_num_flat__[(pos__ - 1)],
                "assigning variable prev_num",
                stan::model::index_uni(sym3__),
                stan::model::index_uni(sym2__),
                stan::model::index_uni(sym1__));
              current_statement__ = 328;
              pos__ = (pos__ + 1);
            }
          }
        }
      }
      current_statement__ = 328;
      stan::math::check_greater_or_equal(function__, "prev_num", prev_num, 0);
      current_statement__ = 329;
      stan::math::validate_non_negative_index("prev_denom", "nage", nage);
      current_statement__ = 330;
      stan::math::validate_non_negative_index("prev_denom", "narea", narea);
      current_statement__ = 331;
      stan::math::validate_non_negative_index("prev_denom", "ng", ng);
      current_statement__ = 332;
      context__.validate_dims("data initialization", "prev_denom", "int",
        std::vector<size_t>{static_cast<size_t>(nage),
          static_cast<size_t>(narea), static_cast<size_t>(ng)});
      prev_denom = std::vector<std::vector<std::vector<int>>>(nage,
                     std::vector<std::vector<int>>(narea,
                       std::vector<int>(ng, std::numeric_limits<int>::min())));
      {
        std::vector<int> prev_denom_flat__;
        current_statement__ = 332;
        prev_denom_flat__ = context__.vals_i("prev_denom");
        current_statement__ = 332;
        pos__ = 1;
        current_statement__ = 332;
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          current_statement__ = 332;
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            current_statement__ = 332;
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              current_statement__ = 332;
              stan::model::assign(prev_denom, prev_denom_flat__[(pos__ - 1)],
                "assigning variable prev_denom",
                stan::model::index_uni(sym3__),
                stan::model::index_uni(sym2__),
                stan::model::index_uni(sym1__));
              current_statement__ = 332;
              pos__ = (pos__ + 1);
            }
          }
        }
      }
      current_statement__ = 332;
      stan::math::check_greater_or_equal(function__, "prev_denom",
        prev_denom, 0);
      current_statement__ = 333;
      stan::math::validate_non_negative_index("inc_num", "nage", nage);
      current_statement__ = 334;
      stan::math::validate_non_negative_index("inc_num", "narea", narea);
      current_statement__ = 335;
      stan::math::validate_non_negative_index("inc_num", "ng", ng);
      current_statement__ = 336;
      context__.validate_dims("data initialization", "inc_num", "int",
        std::vector<size_t>{static_cast<size_t>(nage),
          static_cast<size_t>(narea), static_cast<size_t>(ng)});
      inc_num = std::vector<std::vector<std::vector<int>>>(nage,
                  std::vector<std::vector<int>>(narea,
                    std::vector<int>(ng, std::numeric_limits<int>::min())));
      {
        std::vector<int> inc_num_flat__;
        current_statement__ = 336;
        inc_num_flat__ = context__.vals_i("inc_num");
        current_statement__ = 336;
        pos__ = 1;
        current_statement__ = 336;
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          current_statement__ = 336;
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            current_statement__ = 336;
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              current_statement__ = 336;
              stan::model::assign(inc_num, inc_num_flat__[(pos__ - 1)],
                "assigning variable inc_num", stan::model::index_uni(sym3__),
                stan::model::index_uni(sym2__),
                stan::model::index_uni(sym1__));
              current_statement__ = 336;
              pos__ = (pos__ + 1);
            }
          }
        }
      }
      current_statement__ = 336;
      stan::math::check_greater_or_equal(function__, "inc_num", inc_num, 0);
      current_statement__ = 337;
      stan::math::validate_non_negative_index("inc_denom", "nage", nage);
      current_statement__ = 338;
      stan::math::validate_non_negative_index("inc_denom", "narea", narea);
      current_statement__ = 339;
      stan::math::validate_non_negative_index("inc_denom", "ng", ng);
      current_statement__ = 340;
      context__.validate_dims("data initialization", "inc_denom", "int",
        std::vector<size_t>{static_cast<size_t>(nage),
          static_cast<size_t>(narea), static_cast<size_t>(ng)});
      inc_denom = std::vector<std::vector<std::vector<int>>>(nage,
                    std::vector<std::vector<int>>(narea,
                      std::vector<int>(ng, std::numeric_limits<int>::min())));
      {
        std::vector<int> inc_denom_flat__;
        current_statement__ = 340;
        inc_denom_flat__ = context__.vals_i("inc_denom");
        current_statement__ = 340;
        pos__ = 1;
        current_statement__ = 340;
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          current_statement__ = 340;
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            current_statement__ = 340;
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              current_statement__ = 340;
              stan::model::assign(inc_denom, inc_denom_flat__[(pos__ - 1)],
                "assigning variable inc_denom",
                stan::model::index_uni(sym3__),
                stan::model::index_uni(sym2__),
                stan::model::index_uni(sym1__));
              current_statement__ = 340;
              pos__ = (pos__ + 1);
            }
          }
        }
      }
      current_statement__ = 340;
      stan::math::check_greater_or_equal(function__, "inc_denom", inc_denom,
        0);
      current_statement__ = 341;
      stan::math::validate_non_negative_index("rem_num", "nage", nage);
      current_statement__ = 342;
      stan::math::validate_non_negative_index("rem_num", "narea", narea);
      current_statement__ = 343;
      stan::math::validate_non_negative_index("rem_num", "ng", ng);
      current_statement__ = 344;
      context__.validate_dims("data initialization", "rem_num", "int",
        std::vector<size_t>{static_cast<size_t>(nage),
          static_cast<size_t>(narea), static_cast<size_t>(ng)});
      rem_num = std::vector<std::vector<std::vector<int>>>(nage,
                  std::vector<std::vector<int>>(narea,
                    std::vector<int>(ng, std::numeric_limits<int>::min())));
      {
        std::vector<int> rem_num_flat__;
        current_statement__ = 344;
        rem_num_flat__ = context__.vals_i("rem_num");
        current_statement__ = 344;
        pos__ = 1;
        current_statement__ = 344;
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          current_statement__ = 344;
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            current_statement__ = 344;
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              current_statement__ = 344;
              stan::model::assign(rem_num, rem_num_flat__[(pos__ - 1)],
                "assigning variable rem_num", stan::model::index_uni(sym3__),
                stan::model::index_uni(sym2__),
                stan::model::index_uni(sym1__));
              current_statement__ = 344;
              pos__ = (pos__ + 1);
            }
          }
        }
      }
      current_statement__ = 344;
      stan::math::check_greater_or_equal(function__, "rem_num", rem_num, 0);
      current_statement__ = 345;
      stan::math::validate_non_negative_index("rem_denom", "nage", nage);
      current_statement__ = 346;
      stan::math::validate_non_negative_index("rem_denom", "narea", narea);
      current_statement__ = 347;
      stan::math::validate_non_negative_index("rem_denom", "ng", ng);
      current_statement__ = 348;
      context__.validate_dims("data initialization", "rem_denom", "int",
        std::vector<size_t>{static_cast<size_t>(nage),
          static_cast<size_t>(narea), static_cast<size_t>(ng)});
      rem_denom = std::vector<std::vector<std::vector<int>>>(nage,
                    std::vector<std::vector<int>>(narea,
                      std::vector<int>(ng, std::numeric_limits<int>::min())));
      {
        std::vector<int> rem_denom_flat__;
        current_statement__ = 348;
        rem_denom_flat__ = context__.vals_i("rem_denom");
        current_statement__ = 348;
        pos__ = 1;
        current_statement__ = 348;
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          current_statement__ = 348;
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            current_statement__ = 348;
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              current_statement__ = 348;
              stan::model::assign(rem_denom, rem_denom_flat__[(pos__ - 1)],
                "assigning variable rem_denom",
                stan::model::index_uni(sym3__),
                stan::model::index_uni(sym2__),
                stan::model::index_uni(sym1__));
              current_statement__ = 348;
              pos__ = (pos__ + 1);
            }
          }
        }
      }
      current_statement__ = 348;
      stan::math::check_greater_or_equal(function__, "rem_denom", rem_denom,
        0);
      current_statement__ = 349;
      context__.validate_dims("data initialization", "K", "int",
        std::vector<size_t>{});
      K = std::numeric_limits<int>::min();
      current_statement__ = 349;
      K = context__.vals_i("K")[(1 - 1)];
      current_statement__ = 349;
      stan::math::check_greater_or_equal(function__, "K", K, 0);
      current_statement__ = 350;
      stan::math::validate_non_negative_index("X", "nage", nage);
      current_statement__ = 351;
      stan::math::validate_non_negative_index("X", "K", K);
      current_statement__ = 352;
      context__.validate_dims("data initialization", "X", "double",
        std::vector<size_t>{static_cast<size_t>(nage),
          static_cast<size_t>(K)});
      X_data__ = Eigen::Matrix<double,-1,-1>::Constant(nage, K,
                   std::numeric_limits<double>::quiet_NaN());
      new (&X) Eigen::Map<Eigen::Matrix<double,-1,-1>>(X_data__.data(), nage,
        K);
      {
        std::vector<local_scalar_t__> X_flat__;
        current_statement__ = 352;
        X_flat__ = context__.vals_r("X");
        current_statement__ = 352;
        pos__ = 1;
        current_statement__ = 352;
        for (int sym1__ = 1; sym1__ <= K; ++sym1__) {
          current_statement__ = 352;
          for (int sym2__ = 1; sym2__ <= nage; ++sym2__) {
            current_statement__ = 352;
            stan::model::assign(X, X_flat__[(pos__ - 1)],
              "assigning variable X", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            current_statement__ = 352;
            pos__ = (pos__ + 1);
          }
        }
      }
      current_statement__ = 353;
      context__.validate_dims("data initialization", "sprior", "double",
        std::vector<size_t>{static_cast<size_t>(3)});
      sprior = std::vector<double>(3,
                 std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 353;
      sprior = context__.vals_r("sprior");
      current_statement__ = 353;
      stan::math::check_greater_or_equal(function__, "sprior", sprior, 0);
      current_statement__ = 354;
      context__.validate_dims("data initialization", "mipm", "double",
        std::vector<size_t>{});
      mipm = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 354;
      mipm = context__.vals_r("mipm")[(1 - 1)];
      current_statement__ = 355;
      context__.validate_dims("data initialization", "mips", "double",
        std::vector<size_t>{});
      mips = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 355;
      mips = context__.vals_r("mips")[(1 - 1)];
      current_statement__ = 355;
      stan::math::check_greater_or_equal(function__, "mips", mips, 0);
      current_statement__ = 356;
      context__.validate_dims("data initialization", "mism", "double",
        std::vector<size_t>{});
      mism = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 356;
      mism = context__.vals_r("mism")[(1 - 1)];
      current_statement__ = 357;
      context__.validate_dims("data initialization", "miss", "double",
        std::vector<size_t>{});
      miss = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 357;
      miss = context__.vals_r("miss")[(1 - 1)];
      current_statement__ = 357;
      stan::math::check_greater_or_equal(function__, "miss", miss, 0);
      current_statement__ = 358;
      context__.validate_dims("data initialization", "gpint_a", "double",
        std::vector<size_t>{});
      gpint_a = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 358;
      gpint_a = context__.vals_r("gpint_a")[(1 - 1)];
      current_statement__ = 358;
      stan::math::check_greater_or_equal(function__, "gpint_a", gpint_a, 0);
      current_statement__ = 359;
      context__.validate_dims("data initialization", "gpint_b", "double",
        std::vector<size_t>{});
      gpint_b = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 359;
      gpint_b = context__.vals_r("gpint_b")[(1 - 1)];
      current_statement__ = 359;
      stan::math::check_greater_or_equal(function__, "gpint_b", gpint_b, 0);
      current_statement__ = 360;
      context__.validate_dims("data initialization", "gpslope_a", "double",
        std::vector<size_t>{});
      gpslope_a = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 360;
      gpslope_a = context__.vals_r("gpslope_a")[(1 - 1)];
      current_statement__ = 360;
      stan::math::check_greater_or_equal(function__, "gpslope_a", gpslope_a,
        0);
      current_statement__ = 361;
      context__.validate_dims("data initialization", "gpslope_b", "double",
        std::vector<size_t>{});
      gpslope_b = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 361;
      gpslope_b = context__.vals_r("gpslope_b")[(1 - 1)];
      current_statement__ = 361;
      stan::math::check_greater_or_equal(function__, "gpslope_b", gpslope_b,
        0);
      current_statement__ = 362;
      context__.validate_dims("data initialization", "gender_int_priorsd",
        "double", std::vector<size_t>{});
      gender_int_priorsd = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 362;
      gender_int_priorsd = context__.vals_r("gender_int_priorsd")[(1 - 1)];
      current_statement__ = 362;
      stan::math::check_greater_or_equal(function__, "gender_int_priorsd",
        gender_int_priorsd, 0);
      current_statement__ = 363;
      context__.validate_dims("data initialization", "gender_slope_priorsd",
        "double", std::vector<size_t>{});
      gender_slope_priorsd = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 363;
      gender_slope_priorsd = context__.vals_r("gender_slope_priorsd")[(1 -
        1)];
      current_statement__ = 363;
      stan::math::check_greater_or_equal(function__, "gender_slope_priorsd",
        gender_slope_priorsd, 0);
      current_statement__ = 364;
      context__.validate_dims("data initialization", "interceptonly", "int",
        std::vector<size_t>{});
      interceptonly = std::numeric_limits<int>::min();
      current_statement__ = 364;
      interceptonly = context__.vals_i("interceptonly")[(1 - 1)];
      current_statement__ = 365;
      context__.validate_dims("data initialization", "increasing", "int",
        std::vector<size_t>{});
      increasing = std::numeric_limits<int>::min();
      current_statement__ = 365;
      increasing = context__.vals_i("increasing")[(1 - 1)];
      current_statement__ = 366;
      context__.validate_dims("data initialization", "common", "int",
        std::vector<size_t>{});
      common = std::numeric_limits<int>::min();
      current_statement__ = 366;
      common = context__.vals_i("common")[(1 - 1)];
      current_statement__ = 367;
      context__.validate_dims("data initialization", "const_cf", "int",
        std::vector<size_t>{});
      const_cf = std::numeric_limits<int>::min();
      current_statement__ = 367;
      const_cf = context__.vals_i("const_cf")[(1 - 1)];
      current_statement__ = 368;
      context__.validate_dims("data initialization", "const_rem", "int",
        std::vector<size_t>{});
      const_rem = std::numeric_limits<int>::min();
      current_statement__ = 368;
      const_rem = context__.vals_i("const_rem")[(1 - 1)];
      current_statement__ = 369;
      context__.validate_dims("data initialization", "smooth_inc", "int",
        std::vector<size_t>{});
      smooth_inc = std::numeric_limits<int>::min();
      current_statement__ = 369;
      smooth_inc = context__.vals_i("smooth_inc")[(1 - 1)];
      current_statement__ = 370;
      context__.validate_dims("data initialization", "smooth_rem", "int",
        std::vector<size_t>{});
      smooth_rem = std::numeric_limits<int>::min();
      current_statement__ = 370;
      smooth_rem = context__.vals_i("smooth_rem")[(1 - 1)];
      current_statement__ = 371;
      context__.validate_dims("data initialization", "sd_int_isfixed", "int",
        std::vector<size_t>{});
      sd_int_isfixed = std::numeric_limits<int>::min();
      current_statement__ = 371;
      sd_int_isfixed = context__.vals_i("sd_int_isfixed")[(1 - 1)];
      current_statement__ = 372;
      context__.validate_dims("data initialization", "sd_slope_isfixed",
        "int", std::vector<size_t>{});
      sd_slope_isfixed = std::numeric_limits<int>::min();
      current_statement__ = 372;
      sd_slope_isfixed = context__.vals_i("sd_slope_isfixed")[(1 - 1)];
      current_statement__ = 373;
      context__.validate_dims("data initialization", "sd_int_fixed",
        "double", std::vector<size_t>{});
      sd_int_fixed = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 373;
      sd_int_fixed = context__.vals_r("sd_int_fixed")[(1 - 1)];
      current_statement__ = 373;
      stan::math::check_greater_or_equal(function__, "sd_int_fixed",
        sd_int_fixed, 0);
      current_statement__ = 374;
      context__.validate_dims("data initialization", "sd_slope_fixed",
        "double", std::vector<size_t>{});
      sd_slope_fixed = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 374;
      sd_slope_fixed = context__.vals_r("sd_slope_fixed")[(1 - 1)];
      current_statement__ = 374;
      stan::math::check_greater_or_equal(function__, "sd_slope_fixed",
        sd_slope_fixed, 0);
      current_statement__ = 375;
      context__.validate_dims("data initialization", "inc_prior", "double",
        std::vector<size_t>{static_cast<size_t>(2)});
      inc_prior = std::vector<double>(2,
                    std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 375;
      inc_prior = context__.vals_r("inc_prior");
      current_statement__ = 375;
      stan::math::check_greater_or_equal(function__, "inc_prior", inc_prior,
        0);
      current_statement__ = 376;
      context__.validate_dims("data initialization", "rem_prior", "double",
        std::vector<size_t>{static_cast<size_t>(2)});
      rem_prior = std::vector<double>(2,
                    std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 376;
      rem_prior = context__.vals_r("rem_prior");
      current_statement__ = 376;
      stan::math::check_greater_or_equal(function__, "rem_prior", rem_prior,
        0);
      current_statement__ = 377;
      context__.validate_dims("data initialization", "scf_isfixed", "int",
        std::vector<size_t>{});
      scf_isfixed = std::numeric_limits<int>::min();
      current_statement__ = 377;
      scf_isfixed = context__.vals_i("scf_isfixed")[(1 - 1)];
      current_statement__ = 378;
      context__.validate_dims("data initialization", "scfmale_isfixed",
        "int", std::vector<size_t>{});
      scfmale_isfixed = std::numeric_limits<int>::min();
      current_statement__ = 378;
      scfmale_isfixed = context__.vals_i("scfmale_isfixed")[(1 - 1)];
      current_statement__ = 379;
      context__.validate_dims("data initialization", "sinc_isfixed", "int",
        std::vector<size_t>{});
      sinc_isfixed = std::numeric_limits<int>::min();
      current_statement__ = 379;
      sinc_isfixed = context__.vals_i("sinc_isfixed")[(1 - 1)];
      current_statement__ = 380;
      context__.validate_dims("data initialization", "srem_isfixed", "int",
        std::vector<size_t>{});
      srem_isfixed = std::numeric_limits<int>::min();
      current_statement__ = 380;
      srem_isfixed = context__.vals_i("srem_isfixed")[(1 - 1)];
      current_statement__ = 381;
      context__.validate_dims("data initialization", "lambda_cf_fixed",
        "double", std::vector<size_t>{});
      lambda_cf_fixed = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 381;
      lambda_cf_fixed = context__.vals_r("lambda_cf_fixed")[(1 - 1)];
      current_statement__ = 381;
      stan::math::check_greater_or_equal(function__, "lambda_cf_fixed",
        lambda_cf_fixed, 0);
      current_statement__ = 382;
      context__.validate_dims("data initialization", "lambda_cf_male_fixed",
        "double", std::vector<size_t>{});
      lambda_cf_male_fixed = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 382;
      lambda_cf_male_fixed = context__.vals_r("lambda_cf_male_fixed")[(1 -
        1)];
      current_statement__ = 382;
      stan::math::check_greater_or_equal(function__, "lambda_cf_male_fixed",
        lambda_cf_male_fixed, 0);
      current_statement__ = 383;
      context__.validate_dims("data initialization", "lambda_inc_fixed",
        "double", std::vector<size_t>{});
      lambda_inc_fixed = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 383;
      lambda_inc_fixed = context__.vals_r("lambda_inc_fixed")[(1 - 1)];
      current_statement__ = 383;
      stan::math::check_greater_or_equal(function__, "lambda_inc_fixed",
        lambda_inc_fixed, 0);
      current_statement__ = 384;
      context__.validate_dims("data initialization", "lambda_rem_fixed",
        "double", std::vector<size_t>{});
      lambda_rem_fixed = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 384;
      lambda_rem_fixed = context__.vals_r("lambda_rem_fixed")[(1 - 1)];
      current_statement__ = 384;
      stan::math::check_greater_or_equal(function__, "lambda_rem_fixed",
        lambda_rem_fixed, 0);
      current_statement__ = 385;
      inc_par_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 385;
      inc_par_1dim__ = (nage * (1 - smooth_inc));
      current_statement__ = 385;
      stan::math::validate_non_negative_index("inc_par",
        "nage * (1 - smooth_inc)", inc_par_1dim__);
      current_statement__ = 386;
      stan::math::validate_non_negative_index("inc_par", "narea", narea);
      current_statement__ = 387;
      stan::math::validate_non_negative_index("inc_par", "ng", ng);
      current_statement__ = 388;
      rem_par_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 388;
      rem_par_1dim__ = ((remission * (1 - smooth_rem)) * ((nage * (1 -
        const_rem)) + (1 * const_rem)));
      current_statement__ = 388;
      stan::math::validate_non_negative_index("rem_par",
        "remission * (1 - smooth_rem) * (nage * (1 - const_rem) + 1 * const_rem)",
        rem_par_1dim__);
      current_statement__ = 389;
      stan::math::validate_non_negative_index("rem_par", "ng", ng);
      current_statement__ = 390;
      barea_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 390;
      barea_1dim__ = ((K - 2) * (1 - const_cf));
      current_statement__ = 390;
      stan::math::validate_non_negative_index("barea",
        "(K - 2) * (1 - const_cf)", barea_1dim__);
      current_statement__ = 391;
      barea_2dim__ = std::numeric_limits<int>::min();
      current_statement__ = 391;
      barea_2dim__ = ((narea * (1 - common)) + (1 * common));
      current_statement__ = 391;
      stan::math::validate_non_negative_index("barea",
        "narea * (1 - common) + 1 * (common)", barea_2dim__);
      current_statement__ = 392;
      barea_slope_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 392;
      barea_slope_1dim__ = ((1 - interceptonly) * (1 - const_cf));
      current_statement__ = 392;
      stan::math::validate_non_negative_index("barea_slope",
        "(1 - interceptonly) * (1 - const_cf)", barea_slope_1dim__);
      current_statement__ = 393;
      barea_slope_2dim__ = std::numeric_limits<int>::min();
      current_statement__ = 393;
      barea_slope_2dim__ = ((narea * (1 - common)) + (1 * common));
      current_statement__ = 393;
      stan::math::validate_non_negative_index("barea_slope",
        "narea * (1 - common) + 1 * common", barea_slope_2dim__);
      current_statement__ = 394;
      stan::math::validate_non_negative_index("barea_inter", "1", 1);
      current_statement__ = 395;
      barea_inter_2dim__ = std::numeric_limits<int>::min();
      current_statement__ = 395;
      barea_inter_2dim__ = (narea * (1 - common));
      current_statement__ = 395;
      stan::math::validate_non_negative_index("barea_inter",
        "narea * (1 - common)", barea_inter_2dim__);
      current_statement__ = 396;
      bmale_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 396;
      bmale_1dim__ = (K * (ng - 1));
      current_statement__ = 396;
      stan::math::validate_non_negative_index("bmale", "K * (ng - 1)",
        bmale_1dim__);
      current_statement__ = 397;
      lcfbase_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 397;
      lcfbase_1dim__ = (((narea * (1 - common)) + (1 * common)) *
        increasing);
      current_statement__ = 397;
      stan::math::validate_non_negative_index("lcfbase",
        "(narea * (1 - common) + 1 * common) * increasing", lcfbase_1dim__);
      current_statement__ = 398;
      beta_inc_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 398;
      beta_inc_1dim__ = (K * smooth_inc);
      current_statement__ = 398;
      stan::math::validate_non_negative_index("beta_inc", "K * smooth_inc",
        beta_inc_1dim__);
      current_statement__ = 399;
      stan::math::validate_non_negative_index("beta_inc", "narea", narea);
      current_statement__ = 400;
      stan::math::validate_non_negative_index("beta_inc", "ng", ng);
      current_statement__ = 401;
      beta_rem_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 401;
      beta_rem_1dim__ = (K * smooth_rem);
      current_statement__ = 401;
      stan::math::validate_non_negative_index("beta_rem", "K * smooth_rem",
        beta_rem_1dim__);
      current_statement__ = 402;
      stan::math::validate_non_negative_index("beta_rem", "narea", narea);
      current_statement__ = 403;
      stan::math::validate_non_negative_index("beta_rem", "ng", ng);
      current_statement__ = 404;
      sd_inter_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 404;
      sd_inter_1dim__ = (1 - sd_int_isfixed);
      current_statement__ = 404;
      stan::math::validate_non_negative_index("sd_inter",
        "1 - sd_int_isfixed", sd_inter_1dim__);
      current_statement__ = 405;
      mean_slope_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 405;
      mean_slope_1dim__ = (1 - const_cf);
      current_statement__ = 405;
      stan::math::validate_non_negative_index("mean_slope", "1 - const_cf",
        mean_slope_1dim__);
      current_statement__ = 406;
      sd_slope_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 406;
      sd_slope_1dim__ = ((((1 - const_cf) * (1 - interceptonly)) * (1 -
        increasing)) * (1 - sd_slope_isfixed));
      current_statement__ = 406;
      stan::math::validate_non_negative_index("sd_slope",
        "(1 - const_cf) * (1 - interceptonly) * (1 - increasing)\n* (1 - sd_slope_isfixed)",
        sd_slope_1dim__);
      current_statement__ = 407;
      lambda_cf_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 407;
      lambda_cf_1dim__ = ((1 - const_cf) * (1 - scf_isfixed));
      current_statement__ = 407;
      stan::math::validate_non_negative_index("lambda_cf",
        "(1 - const_cf) * (1 - scf_isfixed)", lambda_cf_1dim__);
      current_statement__ = 408;
      lambda_cf_male_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 408;
      lambda_cf_male_1dim__ = ((ng - 1) * (1 - scfmale_isfixed));
      current_statement__ = 408;
      stan::math::validate_non_negative_index("lambda_cf_male",
        "(ng - 1) * (1 - scfmale_isfixed)", lambda_cf_male_1dim__);
      current_statement__ = 409;
      lambda_inc_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 409;
      lambda_inc_1dim__ = (smooth_inc * (1 - sinc_isfixed));
      current_statement__ = 409;
      stan::math::validate_non_negative_index("lambda_inc",
        "smooth_inc * (1 - sinc_isfixed)", lambda_inc_1dim__);
      current_statement__ = 410;
      lambda_rem_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 410;
      lambda_rem_1dim__ = ((remission * smooth_rem) * (1 - srem_isfixed));
      current_statement__ = 410;
      stan::math::validate_non_negative_index("lambda_rem",
        "remission * smooth_rem * (1 - srem_isfixed)", lambda_rem_1dim__);
      current_statement__ = 411;
      prevzero_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 411;
      prevzero_1dim__ = (narea * prev_zero);
      current_statement__ = 411;
      stan::math::validate_non_negative_index("prevzero",
        "narea * prev_zero", prevzero_1dim__);
      current_statement__ = 412;
      stan::math::validate_non_negative_index("prevzero", "ng", ng);
      current_statement__ = 413;
      stan::math::validate_non_negative_index("inc", "nage", nage);
      current_statement__ = 414;
      stan::math::validate_non_negative_index("inc", "narea", narea);
      current_statement__ = 415;
      stan::math::validate_non_negative_index("inc", "ng", ng);
      current_statement__ = 416;
      stan::math::validate_non_negative_index("cf", "nage", nage);
      current_statement__ = 417;
      stan::math::validate_non_negative_index("cf", "narea", narea);
      current_statement__ = 418;
      stan::math::validate_non_negative_index("cf", "ng", ng);
      current_statement__ = 419;
      dcf_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 419;
      dcf_1dim__ = (nage * increasing);
      current_statement__ = 419;
      stan::math::validate_non_negative_index("dcf", "nage * increasing",
        dcf_1dim__);
      current_statement__ = 420;
      stan::math::validate_non_negative_index("dcf", "narea", narea);
      current_statement__ = 421;
      stan::math::validate_non_negative_index("dcf", "ng", ng);
      current_statement__ = 422;
      stan::math::validate_non_negative_index("inc_prob", "nage", nage);
      current_statement__ = 423;
      stan::math::validate_non_negative_index("inc_prob", "narea", narea);
      current_statement__ = 424;
      stan::math::validate_non_negative_index("inc_prob", "ng", ng);
      current_statement__ = 425;
      stan::math::validate_non_negative_index("prev_prob", "nage", nage);
      current_statement__ = 426;
      stan::math::validate_non_negative_index("prev_prob", "narea", narea);
      current_statement__ = 427;
      stan::math::validate_non_negative_index("prev_prob", "ng", ng);
      current_statement__ = 428;
      stan::math::validate_non_negative_index("mort_prob", "nage", nage);
      current_statement__ = 429;
      stan::math::validate_non_negative_index("mort_prob", "narea", narea);
      current_statement__ = 430;
      stan::math::validate_non_negative_index("mort_prob", "ng", ng);
      current_statement__ = 431;
      stan::math::validate_non_negative_index("rem", "nage", nage);
      current_statement__ = 432;
      stan::math::validate_non_negative_index("rem", "narea", narea);
      current_statement__ = 433;
      stan::math::validate_non_negative_index("rem", "ng", ng);
      current_statement__ = 434;
      rem_prob_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 434;
      rem_prob_1dim__ = (nage * remission);
      current_statement__ = 434;
      stan::math::validate_non_negative_index("rem_prob", "nage * remission",
        rem_prob_1dim__);
      current_statement__ = 435;
      stan::math::validate_non_negative_index("rem_prob", "narea", narea);
      current_statement__ = 436;
      stan::math::validate_non_negative_index("rem_prob", "ng", ng);
      current_statement__ = 437;
      stan::math::validate_non_negative_index("cf_prob", "nage", nage);
      current_statement__ = 438;
      stan::math::validate_non_negative_index("cf_prob", "narea", narea);
      current_statement__ = 439;
      stan::math::validate_non_negative_index("cf_prob", "ng", ng);
      current_statement__ = 440;
      state_probs_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 440;
      state_probs_1dim__ = (nage + 1);
      current_statement__ = 440;
      stan::math::validate_non_negative_index("state_probs", "nage + 1",
        state_probs_1dim__);
      current_statement__ = 441;
      stan::math::validate_non_negative_index("state_probs", "narea", narea);
      current_statement__ = 442;
      stan::math::validate_non_negative_index("state_probs", "ng", ng);
      current_statement__ = 443;
      stan::math::validate_non_negative_index("bareat", "K", K);
      current_statement__ = 444;
      stan::math::validate_non_negative_index("bareat", "narea", narea);
      current_statement__ = 445;
      stan::math::validate_non_negative_index("beta", "K", K);
      current_statement__ = 446;
      stan::math::validate_non_negative_index("beta", "narea", narea);
      current_statement__ = 447;
      stan::math::validate_non_negative_index("beta", "ng", ng);
      current_statement__ = 448;
      lcfbase_use_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 448;
      lcfbase_use_1dim__ = (narea * increasing);
      current_statement__ = 448;
      stan::math::validate_non_negative_index("lcfbase_use",
        "narea * increasing", lcfbase_use_1dim__);
      current_statement__ = 449;
      ll_mort_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 449;
      ll_mort_1dim__ = ((nage * narea) * ng);
      current_statement__ = 449;
      stan::math::validate_non_negative_index("ll_mort", "nage * narea * ng",
        ll_mort_1dim__);
      current_statement__ = 450;
      ll_inc_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 450;
      ll_inc_1dim__ = ((nage * narea) * ng);
      current_statement__ = 450;
      stan::math::validate_non_negative_index("ll_inc", "nage * narea * ng",
        ll_inc_1dim__);
      current_statement__ = 451;
      ll_prev_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 451;
      ll_prev_1dim__ = ((nage * narea) * ng);
      current_statement__ = 451;
      stan::math::validate_non_negative_index("ll_prev", "nage * narea * ng",
        ll_prev_1dim__);
      current_statement__ = 452;
      ll_rem_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 452;
      ll_rem_1dim__ = (((nage * narea) * ng) * remission);
      current_statement__ = 452;
      stan::math::validate_non_negative_index("ll_rem",
        "nage * narea * ng * remission", ll_rem_1dim__);
      current_statement__ = 453;
      ll_overall_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 453;
      ll_overall_1dim__ = (((nage * narea) * ng) * (3 + remission));
      current_statement__ = 453;
      stan::math::validate_non_negative_index("ll_overall",
        "nage * narea * ng * (3 + remission)", ll_overall_1dim__);
    } catch (const std::exception& e) {
      stan::lang::rethrow_located(e, locations_array__[current_statement__]);
    }
    num_params_r__ = (inc_par_1dim__ * narea * ng) + (rem_par_1dim__ * ng) +
      (barea_1dim__ * barea_2dim__) + (barea_slope_1dim__ *
      barea_slope_2dim__) + (1 * barea_inter_2dim__) + bmale_1dim__ +
      lcfbase_1dim__ + (beta_inc_1dim__ * narea * ng) + (beta_rem_1dim__ *
      narea * ng) + 1 + sd_inter_1dim__ + mean_slope_1dim__ + sd_slope_1dim__
      + lambda_cf_1dim__ + lambda_cf_male_1dim__ + lambda_inc_1dim__ +
      lambda_rem_1dim__ + (prevzero_1dim__ * ng);
  }
  inline std::string model_name() const final {
    return "model_disbayes_hier";
  }
  inline std::vector<std::string> model_compile_info() const noexcept {
    return std::vector<std::string>{"stanc_version = stanc3 v2.32.2",
             "stancflags = --allow-undefined"};
  }
  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>
  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;
    local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
    // suppress unused var warning
    (void) DUMMY_VAR__;
    static constexpr const char* function__ =
      "model_disbayes_hier_namespace::log_prob";
    // suppress unused var warning
    (void) function__;
    try {
      std::vector<std::vector<std::vector<local_scalar_t__>>> inc_par =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(inc_par_1dim__,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      current_statement__ = 1;
      inc_par = in__.template read_constrain_lb<
                  std::vector<std::vector<std::vector<local_scalar_t__>>>,
                  jacobian__>(0, lp__, inc_par_1dim__, narea, ng);
      std::vector<std::vector<local_scalar_t__>> rem_par =
        std::vector<std::vector<local_scalar_t__>>(rem_par_1dim__,
          std::vector<local_scalar_t__>(ng, DUMMY_VAR__));
      current_statement__ = 2;
      rem_par = in__.template read_constrain_lb<
                  std::vector<std::vector<local_scalar_t__>>, jacobian__>(0,
                  lp__, rem_par_1dim__, ng);
      Eigen::Matrix<local_scalar_t__,-1,-1> barea =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(barea_1dim__,
          barea_2dim__, DUMMY_VAR__);
      current_statement__ = 3;
      barea = in__.template read<
                Eigen::Matrix<local_scalar_t__,-1,-1>>(barea_1dim__,
                barea_2dim__);
      Eigen::Matrix<local_scalar_t__,-1,-1> barea_slope =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(barea_slope_1dim__,
          barea_slope_2dim__, DUMMY_VAR__);
      current_statement__ = 4;
      barea_slope = in__.template read<
                      Eigen::Matrix<local_scalar_t__,-1,-1>>(barea_slope_1dim__,
                      barea_slope_2dim__);
      Eigen::Matrix<local_scalar_t__,-1,-1> barea_inter =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(1,
          barea_inter_2dim__, DUMMY_VAR__);
      current_statement__ = 5;
      barea_inter = in__.template read<
                      Eigen::Matrix<local_scalar_t__,-1,-1>>(1,
                      barea_inter_2dim__);
      Eigen::Matrix<local_scalar_t__,-1,1> bmale =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(bmale_1dim__,
          DUMMY_VAR__);
      current_statement__ = 6;
      bmale = in__.template read<
                Eigen::Matrix<local_scalar_t__,-1,1>>(bmale_1dim__);
      Eigen::Matrix<local_scalar_t__,-1,1> lcfbase =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lcfbase_1dim__,
          DUMMY_VAR__);
      current_statement__ = 7;
      lcfbase = in__.template read<
                  Eigen::Matrix<local_scalar_t__,-1,1>>(lcfbase_1dim__);
      std::vector<std::vector<std::vector<local_scalar_t__>>> beta_inc =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(beta_inc_1dim__,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      current_statement__ = 8;
      beta_inc = in__.template read<
                   std::vector<std::vector<std::vector<local_scalar_t__>>>>(beta_inc_1dim__,
                   narea, ng);
      std::vector<std::vector<std::vector<local_scalar_t__>>> beta_rem =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(beta_rem_1dim__,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      current_statement__ = 9;
      beta_rem = in__.template read<
                   std::vector<std::vector<std::vector<local_scalar_t__>>>>(beta_rem_1dim__,
                   narea, ng);
      local_scalar_t__ mean_inter = DUMMY_VAR__;
      current_statement__ = 10;
      mean_inter = in__.template read<local_scalar_t__>();
      Eigen::Matrix<local_scalar_t__,-1,1> sd_inter =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(sd_inter_1dim__,
          DUMMY_VAR__);
      current_statement__ = 11;
      sd_inter = in__.template read_constrain_lb<
                   Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0, lp__,
                   sd_inter_1dim__);
      Eigen::Matrix<local_scalar_t__,-1,1> mean_slope =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(mean_slope_1dim__,
          DUMMY_VAR__);
      current_statement__ = 12;
      mean_slope = in__.template read<
                     Eigen::Matrix<local_scalar_t__,-1,1>>(mean_slope_1dim__);
      Eigen::Matrix<local_scalar_t__,-1,1> sd_slope =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(sd_slope_1dim__,
          DUMMY_VAR__);
      current_statement__ = 13;
      sd_slope = in__.template read_constrain_lb<
                   Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0, lp__,
                   sd_slope_1dim__);
      Eigen::Matrix<local_scalar_t__,-1,1> lambda_cf =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lambda_cf_1dim__,
          DUMMY_VAR__);
      current_statement__ = 14;
      lambda_cf = in__.template read_constrain_lb<
                    Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0,
                    lp__, lambda_cf_1dim__);
      Eigen::Matrix<local_scalar_t__,-1,1> lambda_cf_male =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lambda_cf_male_1dim__,
          DUMMY_VAR__);
      current_statement__ = 15;
      lambda_cf_male = in__.template read_constrain_lb<
                         Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0,
                         lp__, lambda_cf_male_1dim__);
      Eigen::Matrix<local_scalar_t__,-1,1> lambda_inc =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lambda_inc_1dim__,
          DUMMY_VAR__);
      current_statement__ = 16;
      lambda_inc = in__.template read_constrain_lb<
                     Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0,
                     lp__, lambda_inc_1dim__);
      Eigen::Matrix<local_scalar_t__,-1,1> lambda_rem =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lambda_rem_1dim__,
          DUMMY_VAR__);
      current_statement__ = 17;
      lambda_rem = in__.template read_constrain_lb<
                     Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0,
                     lp__, lambda_rem_1dim__);
      std::vector<std::vector<local_scalar_t__>> prevzero =
        std::vector<std::vector<local_scalar_t__>>(prevzero_1dim__,
          std::vector<local_scalar_t__>(ng, DUMMY_VAR__));
      current_statement__ = 18;
      prevzero = in__.template read_constrain_lub<
                   std::vector<std::vector<local_scalar_t__>>, jacobian__>(0,
                   1, lp__, prevzero_1dim__, ng);
      std::vector<std::vector<std::vector<local_scalar_t__>>> inc =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(nage,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      std::vector<std::vector<std::vector<local_scalar_t__>>> cf =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(nage,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      std::vector<std::vector<std::vector<local_scalar_t__>>> dcf =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(dcf_1dim__,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      std::vector<std::vector<std::vector<local_scalar_t__>>> inc_prob =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(nage,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      std::vector<std::vector<std::vector<local_scalar_t__>>> prev_prob =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(nage,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      std::vector<std::vector<std::vector<local_scalar_t__>>> mort_prob =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(nage,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      std::vector<std::vector<std::vector<local_scalar_t__>>> rem =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(nage,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      std::vector<std::vector<std::vector<local_scalar_t__>>> rem_prob =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(rem_prob_1dim__,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      std::vector<std::vector<std::vector<local_scalar_t__>>> cf_prob =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(nage,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      std::vector<
        std::vector<std::vector<Eigen::Matrix<local_scalar_t__,1,-1>>>>
        state_probs =
        std::vector<
          std::vector<std::vector<Eigen::Matrix<local_scalar_t__,1,-1>>>>(state_probs_1dim__,
          std::vector<std::vector<Eigen::Matrix<local_scalar_t__,1,-1>>>(narea,
            std::vector<Eigen::Matrix<local_scalar_t__,1,-1>>(ng,
              Eigen::Matrix<local_scalar_t__,1,-1>::Constant(3, DUMMY_VAR__))));
      Eigen::Matrix<local_scalar_t__,1,-1> tmp =
        Eigen::Matrix<local_scalar_t__,1,-1>::Constant(3, DUMMY_VAR__);
      Eigen::Matrix<local_scalar_t__,-1,-1> P =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(3, 3, DUMMY_VAR__);
      local_scalar_t__ sdint_use = DUMMY_VAR__;
      local_scalar_t__ sdslope_use = DUMMY_VAR__;
      Eigen::Matrix<local_scalar_t__,-1,-1> bareat =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(K, narea,
          DUMMY_VAR__);
      std::vector<std::vector<std::vector<local_scalar_t__>>> beta =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(K,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      local_scalar_t__ lambda_cf_use = DUMMY_VAR__;
      local_scalar_t__ lambda_cf_male_use = DUMMY_VAR__;
      local_scalar_t__ lambda_inc_use = DUMMY_VAR__;
      local_scalar_t__ lambda_rem_use = DUMMY_VAR__;
      Eigen::Matrix<local_scalar_t__,-1,1> lcfbase_use =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lcfbase_use_1dim__,
          DUMMY_VAR__);
      current_statement__ = 48;
      if (sd_int_isfixed) {
        current_statement__ = 47;
        sdint_use = sd_int_fixed;
      } else {
        current_statement__ = 46;
        sdint_use = stan::model::rvalue(sd_inter, "sd_inter",
                      stan::model::index_uni(1));
      }
      current_statement__ = 51;
      if ((stan::math::primitive_value(
             (stan::math::primitive_value(
                (stan::math::primitive_value(sd_slope_isfixed) ||
                stan::math::primitive_value(const_cf))) ||
             stan::math::primitive_value(interceptonly)))
          || stan::math::primitive_value(increasing))) {
        current_statement__ = 50;
        sdslope_use = sd_slope_fixed;
      } else {
        current_statement__ = 49;
        sdslope_use = stan::model::rvalue(sd_slope, "sd_slope",
                        stan::model::index_uni(1));
      }
      current_statement__ = 54;
      if ((stan::math::primitive_value(scf_isfixed) ||
          stan::math::primitive_value(const_cf))) {
        current_statement__ = 53;
        lambda_cf_use = lambda_cf_fixed;
      } else {
        current_statement__ = 52;
        lambda_cf_use = stan::model::rvalue(lambda_cf, "lambda_cf",
                          stan::model::index_uni(1));
      }
      current_statement__ = 57;
      if ((stan::math::primitive_value(scfmale_isfixed) ||
          stan::math::primitive_value(stan::math::logical_eq(ng, 1)))) {
        current_statement__ = 56;
        lambda_cf_male_use = lambda_cf_male_fixed;
      } else {
        current_statement__ = 55;
        lambda_cf_male_use = stan::model::rvalue(lambda_cf_male,
                               "lambda_cf_male", stan::model::index_uni(1));
      }
      current_statement__ = 60;
      if ((stan::math::primitive_value(sinc_isfixed) ||
          stan::math::primitive_value(
            stan::math::logical_negation(smooth_inc)))) {
        current_statement__ = 59;
        lambda_inc_use = lambda_inc_fixed;
      } else {
        current_statement__ = 58;
        lambda_inc_use = stan::model::rvalue(lambda_inc, "lambda_inc",
                           stan::model::index_uni(1));
      }
      current_statement__ = 63;
      if ((stan::math::primitive_value(srem_isfixed) ||
          stan::math::primitive_value(
            stan::math::logical_negation(smooth_rem)))) {
        current_statement__ = 62;
        lambda_rem_use = lambda_rem_fixed;
      } else {
        current_statement__ = 61;
        lambda_rem_use = stan::model::rvalue(lambda_rem, "lambda_rem",
                           stan::model::index_uni(1));
      }
      current_statement__ = 115;
      for (int j = 1; j <= narea; ++j) {
        current_statement__ = 113;
        if (common) {
          current_statement__ = 92;
          if (increasing) {
            current_statement__ = 90;
            stan::model::assign(lcfbase_use,
              stan::model::rvalue(lcfbase, "lcfbase",
                stan::model::index_uni(1)), "assigning variable lcfbase_use",
              stan::model::index_uni(j));
          }
          current_statement__ = 106;
          if (const_cf) {
            current_statement__ = 104;
            for (int i = 1; i <= (K - 1); ++i) {
              current_statement__ = 102;
              stan::model::assign(bareat, 0, "assigning variable bareat",
                stan::model::index_uni(i), stan::model::index_uni(j));
            }
          } else {
            current_statement__ = 95;
            for (int i = 1; i <= (K - 2); ++i) {
              current_statement__ = 93;
              stan::model::assign(bareat,
                (stan::model::rvalue(barea, "barea",
                   stan::model::index_uni(i), stan::model::index_uni(1)) *
                lambda_cf_use), "assigning variable bareat",
                stan::model::index_uni(i), stan::model::index_uni(j));
            }
            current_statement__ = 100;
            if (increasing) {
              current_statement__ = 98;
              stan::model::assign(bareat,
                (stan::model::rvalue(barea_slope, "barea_slope",
                   stan::model::index_uni(1), stan::model::index_uni(1)) *
                lambda_cf_use), "assigning variable bareat",
                stan::model::index_uni((K - 1)), stan::model::index_uni(j));
            } else {
              current_statement__ = 96;
              stan::model::assign(bareat,
                stan::model::rvalue(mean_slope, "mean_slope",
                  stan::model::index_uni(1)), "assigning variable bareat",
                stan::model::index_uni((K - 1)), stan::model::index_uni(j));
            }
          }
          current_statement__ = 111;
          if (increasing) {
            current_statement__ = 109;
            stan::model::assign(bareat,
              stan::model::rvalue(mean_slope, "mean_slope",
                stan::model::index_uni(1)), "assigning variable bareat",
              stan::model::index_uni(K), stan::model::index_uni(j));
          } else {
            current_statement__ = 107;
            stan::model::assign(bareat, mean_inter,
              "assigning variable bareat", stan::model::index_uni(K),
              stan::model::index_uni(j));
          }
        } else {
          current_statement__ = 66;
          if (increasing) {
            current_statement__ = 64;
            stan::model::assign(lcfbase_use,
              stan::model::rvalue(lcfbase, "lcfbase",
                stan::model::index_uni(j)), "assigning variable lcfbase_use",
              stan::model::index_uni(j));
          }
          current_statement__ = 83;
          if (const_cf) {
            current_statement__ = 81;
            for (int i = 1; i <= (K - 1); ++i) {
              current_statement__ = 79;
              stan::model::assign(bareat, 0, "assigning variable bareat",
                stan::model::index_uni(i), stan::model::index_uni(j));
            }
          } else {
            current_statement__ = 69;
            for (int i = 1; i <= (K - 2); ++i) {
              current_statement__ = 67;
              stan::model::assign(bareat,
                (stan::model::rvalue(barea, "barea",
                   stan::model::index_uni(i), stan::model::index_uni(j)) *
                lambda_cf_use), "assigning variable bareat",
                stan::model::index_uni(i), stan::model::index_uni(j));
            }
            current_statement__ = 77;
            if (interceptonly) {
              current_statement__ = 75;
              stan::model::assign(bareat,
                stan::model::rvalue(mean_slope, "mean_slope",
                  stan::model::index_uni(1)), "assigning variable bareat",
                stan::model::index_uni((K - 1)), stan::model::index_uni(j));
            } else {
              current_statement__ = 74;
              if (increasing) {
                current_statement__ = 72;
                stan::model::assign(bareat,
                  (stan::model::rvalue(barea_slope, "barea_slope",
                     stan::model::index_uni(1), stan::model::index_uni(j)) *
                  lambda_cf_use), "assigning variable bareat",
                  stan::model::index_uni((K - 1)), stan::model::index_uni(j));
              } else {
                current_statement__ = 70;
                stan::model::assign(bareat,
                  (stan::model::rvalue(mean_slope, "mean_slope",
                     stan::model::index_uni(1)) +
                  (stan::model::rvalue(barea_slope, "barea_slope",
                     stan::model::index_uni(1), stan::model::index_uni(j)) *
                  sdslope_use)), "assigning variable bareat",
                  stan::model::index_uni((K - 1)), stan::model::index_uni(j));
              }
            }
          }
          current_statement__ = 88;
          if (increasing) {
            current_statement__ = 86;
            stan::model::assign(bareat,
              stan::model::rvalue(mean_slope, "mean_slope",
                stan::model::index_uni(1)), "assigning variable bareat",
              stan::model::index_uni(K), stan::model::index_uni(j));
          } else {
            current_statement__ = 84;
            stan::model::assign(bareat, (mean_inter +
              (stan::model::rvalue(barea_inter, "barea_inter",
                 stan::model::index_uni(1), stan::model::index_uni(j)) *
              sdint_use)), "assigning variable bareat",
              stan::model::index_uni(K), stan::model::index_uni(j));
          }
        }
      }
      current_statement__ = 184;
      for (int g = 1; g <= ng; ++g) {
        current_statement__ = 182;
        for (int j = 1; j <= narea; ++j) {
          current_statement__ = 122;
          for (int a = 1; a <= nage; ++a) {
            current_statement__ = 120;
            if (smooth_inc) {
              current_statement__ = 118;
              stan::model::assign(inc,
                stan::math::exp(
                  stan::math::multiply(
                    stan::model::rvalue(X, "X", stan::model::index_uni(a),
                      stan::model::index_omni()),
                    stan::math::to_vector(
                      stan::model::rvalue(beta_inc, "beta_inc",
                        stan::model::index_omni(), stan::model::index_uni(j),
                        stan::model::index_uni(g))))),
                "assigning variable inc", stan::model::index_uni(a),
                stan::model::index_uni(j), stan::model::index_uni(g));
            } else {
              current_statement__ = 116;
              stan::model::assign(inc,
                stan::model::rvalue(inc_par, "inc_par",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g)), "assigning variable inc",
                stan::model::index_uni(a), stan::model::index_uni(j),
                stan::model::index_uni(g));
            }
          }
          current_statement__ = 129;
          for (int k = 1; k <= K; ++k) {
            current_statement__ = 127;
            if (stan::math::logical_gt(ng, 1)) {
              current_statement__ = 125;
              stan::model::assign(beta,
                (stan::model::rvalue(bareat, "bareat",
                   stan::model::index_uni(k), stan::model::index_uni(j)) +
                (stan::model::rvalue(bmale, "bmale",
                   stan::model::index_uni(k)) * (g - 1))),
                "assigning variable beta", stan::model::index_uni(k),
                stan::model::index_uni(j), stan::model::index_uni(g));
            } else {
              current_statement__ = 123;
              stan::model::assign(beta,
                stan::model::rvalue(bareat, "bareat",
                  stan::model::index_uni(k), stan::model::index_uni(j)),
                "assigning variable beta", stan::model::index_uni(k),
                stan::model::index_uni(j), stan::model::index_uni(g));
            }
          }
          current_statement__ = 132;
          if ((stan::math::primitive_value(
                 stan::math::logical_gt(
                   stan::model::rvalue(prev_denom, "prev_denom",
                     stan::model::index_uni(1), stan::model::index_uni(j),
                     stan::model::index_uni(g)), 0))
              &&
              stan::math::primitive_value(
                (stan::math::primitive_value(
                   stan::math::logical_gt(
                     stan::model::rvalue(prev_num, "prev_num",
                       stan::model::index_uni(1), stan::model::index_uni(j),
                       stan::model::index_uni(g)), 0)) ||
                stan::math::primitive_value(prev_zero))))) {
            current_statement__ = 131;
            stan::model::assign(prev_prob,
              stan::model::rvalue(prevzero, "prevzero",
                stan::model::index_uni(j), stan::model::index_uni(g)),
              "assigning variable prev_prob", stan::model::index_uni(1),
              stan::model::index_uni(j), stan::model::index_uni(g));
          } else {
            current_statement__ = 130;
            stan::model::assign(prev_prob, 0, "assigning variable prev_prob",
              stan::model::index_uni(1), stan::model::index_uni(j),
              stan::model::index_uni(g));
          }
          current_statement__ = 133;
          stan::model::assign(state_probs, 1,
            "assigning variable state_probs", stan::model::index_uni(1),
            stan::model::index_uni(j), stan::model::index_uni(g),
            stan::model::index_uni(1));
          current_statement__ = 134;
          stan::model::assign(state_probs, 0,
            "assigning variable state_probs", stan::model::index_uni(1),
            stan::model::index_uni(j), stan::model::index_uni(g),
            stan::model::index_uni(2));
          current_statement__ = 135;
          stan::model::assign(state_probs, 0,
            "assigning variable state_probs", stan::model::index_uni(1),
            stan::model::index_uni(j), stan::model::index_uni(g),
            stan::model::index_uni(3));
          current_statement__ = 150;
          if (increasing) {
            current_statement__ = 142;
            for (int a = 1; a <= nage; ++a) {
              current_statement__ = 140;
              stan::model::assign(dcf,
                stan::math::exp(
                  stan::math::multiply(
                    stan::model::rvalue(X, "X", stan::model::index_uni(a),
                      stan::model::index_omni()),
                    stan::math::to_vector(
                      stan::model::rvalue(beta, "beta",
                        stan::model::index_omni(), stan::model::index_uni(j),
                        stan::model::index_uni(g))))),
                "assigning variable dcf", stan::model::index_uni(a),
                stan::model::index_uni(j), stan::model::index_uni(g));
            }
            current_statement__ = 145;
            for (int a = 1; a <= (eqage - 1); ++a) {
              current_statement__ = 143;
              stan::model::assign(cf,
                stan::math::exp(
                  stan::model::rvalue(lcfbase_use, "lcfbase_use",
                    stan::model::index_uni(j))), "assigning variable cf",
                stan::model::index_uni(a), stan::model::index_uni(j),
                stan::model::index_uni(g));
            }
            current_statement__ = 148;
            for (int a = eqage; a <= nage; ++a) {
              current_statement__ = 146;
              stan::model::assign(cf,
                (stan::model::rvalue(cf, "cf",
                   stan::model::index_uni((a - 1)),
                   stan::model::index_uni(j), stan::model::index_uni(g)) +
                stan::model::rvalue(dcf, "dcf", stan::model::index_uni(a),
                  stan::model::index_uni(j), stan::model::index_uni(g))),
                "assigning variable cf", stan::model::index_uni(a),
                stan::model::index_uni(j), stan::model::index_uni(g));
            }
          } else {
            current_statement__ = 138;
            for (int a = 1; a <= nage; ++a) {
              current_statement__ = 136;
              stan::model::assign(cf,
                stan::math::exp(
                  stan::math::multiply(
                    stan::model::rvalue(X, "X", stan::model::index_uni(a),
                      stan::model::index_omni()),
                    stan::math::to_vector(
                      stan::model::rvalue(beta, "beta",
                        stan::model::index_omni(), stan::model::index_uni(j),
                        stan::model::index_uni(g))))),
                "assigning variable cf", stan::model::index_uni(a),
                stan::model::index_uni(j), stan::model::index_uni(g));
            }
          }
          current_statement__ = 166;
          if (remission) {
            current_statement__ = 164;
            if (smooth_rem) {
              current_statement__ = 162;
              for (int a = 1; a <= nage; ++a) {
                current_statement__ = 160;
                stan::model::assign(rem,
                  stan::math::exp(
                    stan::math::multiply(
                      stan::model::rvalue(X, "X", stan::model::index_uni(a),
                        stan::model::index_omni()),
                      stan::math::to_vector(
                        stan::model::rvalue(beta_rem, "beta_rem",
                          stan::model::index_omni(),
                          stan::model::index_uni(j),
                          stan::model::index_uni(g))))),
                  "assigning variable rem", stan::model::index_uni(a),
                  stan::model::index_uni(j), stan::model::index_uni(g));
              }
            } else {
              current_statement__ = 159;
              if (const_rem) {
                current_statement__ = 157;
                for (int a = 1; a <= nage; ++a) {
                  current_statement__ = 156;
                  stan::model::assign(rem,
                    stan::model::rvalue(rem_par, "rem_par",
                      stan::model::index_uni(1), stan::model::index_uni(g)),
                    "assigning variable rem", stan::model::index_uni(a),
                    stan::model::index_uni(j), stan::model::index_uni(g));
                }
              } else {
                current_statement__ = 155;
                stan::model::assign(rem,
                  stan::model::rvalue(rem_par, "rem_par",
                    stan::model::index_omni(), stan::model::index_uni(g)),
                  "assigning variable rem", stan::model::index_omni(),
                  stan::model::index_uni(j), stan::model::index_uni(g));
              }
            }
          } else {
            current_statement__ = 153;
            for (int a = 1; a <= nage; ++a) {
              current_statement__ = 151;
              stan::model::assign(rem, 0, "assigning variable rem",
                stan::model::index_uni(a), stan::model::index_uni(j),
                stan::model::index_uni(g));
            }
          }
          current_statement__ = 180;
          for (int a = 1; a <= nage; ++a) {
            current_statement__ = 167;
            stan::model::assign(P,
              trans_probs(
                stan::model::rvalue(inc, "inc", stan::model::index_uni(a),
                  stan::model::index_uni(j), stan::model::index_uni(g)),
                stan::model::rvalue(cf, "cf", stan::model::index_uni(a),
                  stan::model::index_uni(j), stan::model::index_uni(g)),
                stan::model::rvalue(rem, "rem", stan::model::index_uni(a),
                  stan::model::index_uni(j), stan::model::index_uni(g)),
                pstream__), "assigning variable P");
            current_statement__ = 168;
            stan::model::assign(inc_prob,
              bound_prob(
                (stan::model::rvalue(P, "P", stan::model::index_uni(1),
                   stan::model::index_uni(2)) +
                stan::model::rvalue(P, "P", stan::model::index_uni(1),
                  stan::model::index_uni(3))), pstream__),
              "assigning variable inc_prob", stan::model::index_uni(a),
              stan::model::index_uni(j), stan::model::index_uni(g));
            current_statement__ = 170;
            if (remission) {
              current_statement__ = 169;
              stan::model::assign(rem_prob,
                stan::model::rvalue(P, "P", stan::model::index_uni(2),
                  stan::model::index_uni(1)), "assigning variable rem_prob",
                stan::model::index_uni(a), stan::model::index_uni(j),
                stan::model::index_uni(g));
            }
            current_statement__ = 172;
            if (stan::math::logical_gt(a, 1)) {
              current_statement__ = 171;
              stan::model::assign(prev_prob,
                (stan::model::rvalue(state_probs, "state_probs",
                   stan::model::index_uni(a), stan::model::index_uni(j),
                   stan::model::index_uni(g), stan::model::index_uni(2)) /
                (stan::model::rvalue(state_probs, "state_probs",
                   stan::model::index_uni(a), stan::model::index_uni(j),
                   stan::model::index_uni(g), stan::model::index_uni(1)) +
                stan::model::rvalue(state_probs, "state_probs",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g), stan::model::index_uni(2)))),
                "assigning variable prev_prob", stan::model::index_uni(a),
                stan::model::index_uni(j), stan::model::index_uni(g));
            }
            current_statement__ = 173;
            stan::model::assign(tmp,
              stan::math::multiply(
                stan::model::rvalue(state_probs, "state_probs",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g), stan::model::index_min_max(1, 3)),
                P), "assigning variable tmp");
            current_statement__ = 174;
            stan::model::assign(state_probs, tmp,
              "assigning variable state_probs",
              stan::model::index_uni((a + 1)), stan::model::index_uni(j),
              stan::model::index_uni(g), stan::model::index_min_max(1, 3));
            current_statement__ = 175;
            stan::model::assign(cf_prob,
              bound_prob(
                stan::model::rvalue(P, "P", stan::model::index_uni(2),
                  stan::model::index_uni(3)), pstream__),
              "assigning variable cf_prob", stan::model::index_uni(a),
              stan::model::index_uni(j), stan::model::index_uni(g));
            current_statement__ = 176;
            stan::model::assign(mort_prob,
              ((stan::model::rvalue(P, "P", stan::model::index_uni(1),
                  stan::model::index_uni(3)) * (1 -
              stan::model::rvalue(prev_prob, "prev_prob",
                stan::model::index_uni(a), stan::model::index_uni(j),
                stan::model::index_uni(g)))) +
              (stan::model::rvalue(P, "P", stan::model::index_uni(2),
                 stan::model::index_uni(3)) *
              stan::model::rvalue(prev_prob, "prev_prob",
                stan::model::index_uni(a), stan::model::index_uni(j),
                stan::model::index_uni(g)))), "assigning variable mort_prob",
              stan::model::index_uni(a), stan::model::index_uni(j),
              stan::model::index_uni(g));
            current_statement__ = 177;
            stan::model::assign(mort_prob,
              bound_prob(
                stan::model::rvalue(mort_prob, "mort_prob",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g)), pstream__),
              "assigning variable mort_prob", stan::model::index_uni(a),
              stan::model::index_uni(j), stan::model::index_uni(g));
            current_statement__ = 178;
            stan::model::assign(mort_prob,
              bound_prob(
                stan::model::rvalue(mort_prob, "mort_prob",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g)), pstream__),
              "assigning variable mort_prob", stan::model::index_uni(a),
              stan::model::index_uni(j), stan::model::index_uni(g));
          }
        }
      }
      current_statement__ = 19;
      stan::math::check_greater_or_equal(function__, "inc", inc, 0);
      current_statement__ = 20;
      stan::math::check_greater_or_equal(function__, "cf", cf, 0);
      current_statement__ = 21;
      stan::math::check_greater_or_equal(function__, "dcf", dcf, 0);
      current_statement__ = 22;
      stan::math::check_greater_or_equal(function__, "inc_prob", inc_prob, 0);
      current_statement__ = 23;
      stan::math::check_greater_or_equal(function__, "prev_prob", prev_prob,
        0);
      current_statement__ = 24;
      stan::math::check_greater_or_equal(function__, "mort_prob", mort_prob,
        0);
      current_statement__ = 25;
      stan::math::check_greater_or_equal(function__, "rem", rem, 0);
      current_statement__ = 26;
      stan::math::check_greater_or_equal(function__, "rem_prob", rem_prob, 0);
      current_statement__ = 27;
      stan::math::check_greater_or_equal(function__, "cf_prob", cf_prob, 0);
      current_statement__ = 31;
      stan::math::check_greater_or_equal(function__, "sdint_use", sdint_use,
        0);
      current_statement__ = 32;
      stan::math::check_greater_or_equal(function__, "sdslope_use",
        sdslope_use, 0);
      current_statement__ = 35;
      stan::math::check_greater_or_equal(function__, "lambda_cf_use",
        lambda_cf_use, 0);
      current_statement__ = 36;
      stan::math::check_greater_or_equal(function__, "lambda_cf_male_use",
        lambda_cf_male_use, 0);
      current_statement__ = 37;
      stan::math::check_greater_or_equal(function__, "lambda_inc_use",
        lambda_inc_use, 0);
      current_statement__ = 38;
      stan::math::check_greater_or_equal(function__, "lambda_rem_use",
        lambda_rem_use, 0);
      {
        current_statement__ = 198;
        lp_accum__.add(stan::math::normal_lpdf<propto__>(mean_inter, mipm,
                         mips));
        current_statement__ = 219;
        if (stan::math::logical_negation(const_cf)) {
          current_statement__ = 199;
          lp_accum__.add(stan::math::normal_lpdf<propto__>(mean_slope, mism,
                           miss));
          current_statement__ = 217;
          if (common) {
            current_statement__ = 212;
            for (int i = 1; i <= (K - 2); ++i) {
              current_statement__ = 210;
              lp_accum__.add(stan::math::normal_lpdf<propto__>(
                               stan::model::rvalue(barea, "barea",
                                 stan::model::index_uni(i),
                                 stan::model::index_uni(1)), 0, 1));
            }
            current_statement__ = 215;
            if ((stan::math::primitive_value(
                   stan::math::logical_negation(interceptonly))
                &&
                stan::math::primitive_value(
                  stan::math::logical_negation(const_cf)))) {
              current_statement__ = 213;
              lp_accum__.add(stan::math::normal_lpdf<propto__>(
                               stan::model::rvalue(barea_slope,
                                 "barea_slope", stan::model::index_uni(1),
                                 stan::model::index_uni(1)), 0, 1));
            }
          } else {
            current_statement__ = 208;
            for (int j = 1; j <= narea; ++j) {
              current_statement__ = 202;
              for (int i = 1; i <= (K - 2); ++i) {
                current_statement__ = 200;
                lp_accum__.add(stan::math::normal_lpdf<propto__>(
                                 stan::model::rvalue(barea, "barea",
                                   stan::model::index_uni(i),
                                   stan::model::index_uni(j)), 0, 1));
              }
              current_statement__ = 203;
              lp_accum__.add(stan::math::normal_lpdf<propto__>(
                               stan::model::rvalue(barea_inter,
                                 "barea_inter", stan::model::index_uni(1),
                                 stan::model::index_uni(j)), 0, 1));
              current_statement__ = 206;
              if ((stan::math::primitive_value(
                     stan::math::logical_negation(interceptonly))
                  &&
                  stan::math::primitive_value(
                    stan::math::logical_negation(const_cf)))) {
                current_statement__ = 204;
                lp_accum__.add(stan::math::normal_lpdf<propto__>(
                                 stan::model::rvalue(barea_slope,
                                   "barea_slope", stan::model::index_uni(1),
                                   stan::model::index_uni(j)), 0, 1));
              }
            }
          }
        }
        current_statement__ = 231;
        if (smooth_inc) {
          current_statement__ = 229;
          for (int j = 1; j <= narea; ++j) {
            current_statement__ = 227;
            for (int g = 1; g <= ng; ++g) {
              current_statement__ = 222;
              for (int i = 1; i <= (K - 2); ++i) {
                current_statement__ = 220;
                lp_accum__.add(stan::math::normal_lpdf<propto__>(
                                 stan::model::rvalue(beta_inc, "beta_inc",
                                   stan::model::index_uni(i),
                                   stan::model::index_uni(j),
                                   stan::model::index_uni(g)), 0,
                                 lambda_inc_use));
              }
              current_statement__ = 225;
              for (int i = (K - 1); i <= K; ++i) {
                current_statement__ = 223;
                lp_accum__.add(stan::math::normal_lpdf<propto__>(
                                 stan::model::rvalue(beta_inc, "beta_inc",
                                   stan::model::index_uni(i),
                                   stan::model::index_uni(j),
                                   stan::model::index_uni(g)), 0, 100));
              }
            }
          }
        }
        current_statement__ = 234;
        if ((stan::math::primitive_value(increasing) &&
            stan::math::primitive_value(common))) {
          current_statement__ = 232;
          lp_accum__.add(stan::math::normal_lpdf<propto__>(
                           stan::model::rvalue(lcfbase, "lcfbase",
                             stan::model::index_uni(1)), 0, 100));
        }
        current_statement__ = 247;
        for (int j = 1; j <= narea; ++j) {
          current_statement__ = 242;
          for (int g = 1; g <= ng; ++g) {
            current_statement__ = 235;
            lp_accum__.add(stan::math::binomial_lpmf<propto__>(
                             stan::model::rvalue(mort_num, "mort_num",
                               stan::model::index_omni(),
                               stan::model::index_uni(j),
                               stan::model::index_uni(g)),
                             stan::model::rvalue(mort_denom, "mort_denom",
                               stan::model::index_omni(),
                               stan::model::index_uni(j),
                               stan::model::index_uni(g)),
                             stan::model::rvalue(mort_prob, "mort_prob",
                               stan::model::index_omni(),
                               stan::model::index_uni(j),
                               stan::model::index_uni(g))));
            current_statement__ = 236;
            lp_accum__.add(stan::math::binomial_lpmf<propto__>(
                             stan::model::rvalue(inc_num, "inc_num",
                               stan::model::index_omni(),
                               stan::model::index_uni(j),
                               stan::model::index_uni(g)),
                             stan::model::rvalue(inc_denom, "inc_denom",
                               stan::model::index_omni(),
                               stan::model::index_uni(j),
                               stan::model::index_uni(g)),
                             stan::model::rvalue(inc_prob, "inc_prob",
                               stan::model::index_omni(),
                               stan::model::index_uni(j),
                               stan::model::index_uni(g))));
            current_statement__ = 237;
            lp_accum__.add(stan::math::binomial_lpmf<propto__>(
                             stan::model::rvalue(prev_num, "prev_num",
                               stan::model::index_omni(),
                               stan::model::index_uni(j),
                               stan::model::index_uni(g)),
                             stan::model::rvalue(prev_denom, "prev_denom",
                               stan::model::index_omni(),
                               stan::model::index_uni(j),
                               stan::model::index_uni(g)),
                             stan::model::rvalue(prev_prob, "prev_prob",
                               stan::model::index_omni(),
                               stan::model::index_uni(j),
                               stan::model::index_uni(g))));
            current_statement__ = 240;
            if (remission) {
              current_statement__ = 238;
              lp_accum__.add(stan::math::binomial_lpmf<propto__>(
                               stan::model::rvalue(rem_num, "rem_num",
                                 stan::model::index_omni(),
                                 stan::model::index_uni(j),
                                 stan::model::index_uni(g)),
                               stan::model::rvalue(rem_denom, "rem_denom",
                                 stan::model::index_omni(),
                                 stan::model::index_uni(j),
                                 stan::model::index_uni(g)),
                               stan::model::rvalue(rem_prob, "rem_prob",
                                 stan::model::index_omni(),
                                 stan::model::index_uni(j),
                                 stan::model::index_uni(g))));
            }
          }
          current_statement__ = 245;
          if ((stan::math::primitive_value(increasing) &&
              stan::math::primitive_value(
                stan::math::logical_negation(common)))) {
            current_statement__ = 243;
            lp_accum__.add(stan::math::normal_lpdf<propto__>(
                             stan::model::rvalue(lcfbase, "lcfbase",
                               stan::model::index_uni(j)), mean_inter,
                             sd_inter));
          }
        }
        current_statement__ = 271;
        if (remission) {
          current_statement__ = 269;
          if (smooth_rem) {
            current_statement__ = 267;
            for (int j = 1; j <= narea; ++j) {
              current_statement__ = 265;
              for (int g = 1; g <= ng; ++g) {
                current_statement__ = 260;
                for (int i = 1; i <= (K - 2); ++i) {
                  current_statement__ = 258;
                  lp_accum__.add(stan::math::normal_lpdf<propto__>(
                                   stan::model::rvalue(beta_rem, "beta_rem",
                                     stan::model::index_uni(i),
                                     stan::model::index_uni(j),
                                     stan::model::index_uni(g)), 0,
                                   lambda_rem_use));
                }
                current_statement__ = 263;
                for (int i = (K - 1); i <= K; ++i) {
                  current_statement__ = 261;
                  lp_accum__.add(stan::math::normal_lpdf<propto__>(
                                   stan::model::rvalue(beta_rem, "beta_rem",
                                     stan::model::index_uni(i),
                                     stan::model::index_uni(j),
                                     stan::model::index_uni(g)), 0, 100));
                }
              }
            }
          } else {
            current_statement__ = 257;
            if (const_rem) {
              current_statement__ = 255;
              for (int g = 1; g <= ng; ++g) {
                current_statement__ = 254;
                lp_accum__.add(stan::math::gamma_lpdf<propto__>(
                                 stan::model::rvalue(rem_par, "rem_par",
                                   stan::model::index_uni(1),
                                   stan::model::index_uni(g)),
                                 stan::model::rvalue(rem_prior, "rem_prior",
                                   stan::model::index_uni(1)),
                                 stan::model::rvalue(rem_prior, "rem_prior",
                                   stan::model::index_uni(2))));
              }
            } else {
              current_statement__ = 252;
              for (int g = 1; g <= ng; ++g) {
                current_statement__ = 250;
                for (int a = 1; a <= nage; ++a) {
                  current_statement__ = 248;
                  lp_accum__.add(stan::math::gamma_lpdf<propto__>(
                                   stan::model::rvalue(rem_par, "rem_par",
                                     stan::model::index_uni(a),
                                     stan::model::index_uni(g)),
                                   stan::model::rvalue(rem_prior,
                                     "rem_prior", stan::model::index_uni(1)),
                                   stan::model::rvalue(rem_prior,
                                     "rem_prior", stan::model::index_uni(2))));
                }
              }
            }
          }
        }
        current_statement__ = 274;
        if ((stan::math::primitive_value(
               stan::math::logical_negation(const_cf))
            &&
            stan::math::primitive_value(
              stan::math::logical_negation(scf_isfixed)))) {
          current_statement__ = 272;
          lp_accum__.add(stan::math::gamma_lpdf<propto__>(lambda_cf, 2,
                           stan::model::rvalue(sprior, "sprior",
                             stan::model::index_uni(2))));
        }
        current_statement__ = 277;
        if ((stan::math::primitive_value(smooth_inc) &&
            stan::math::primitive_value(
              stan::math::logical_negation(sinc_isfixed)))) {
          current_statement__ = 275;
          lp_accum__.add(stan::math::gamma_lpdf<propto__>(lambda_inc, 2,
                           stan::model::rvalue(sprior, "sprior",
                             stan::model::index_uni(1))));
        }
        current_statement__ = 280;
        if ((stan::math::primitive_value(smooth_rem) &&
            stan::math::primitive_value(
              stan::math::logical_negation(srem_isfixed)))) {
          current_statement__ = 278;
          lp_accum__.add(stan::math::gamma_lpdf<propto__>(lambda_rem, 2,
                           stan::model::rvalue(sprior, "sprior",
                             stan::model::index_uni(3))));
        }
        current_statement__ = 283;
        if ((stan::math::primitive_value(
               (stan::math::primitive_value(
                  stan::math::logical_negation(interceptonly)) &&
               stan::math::primitive_value(
                 stan::math::logical_negation(increasing))))
            &&
            stan::math::primitive_value(
              stan::math::logical_negation(const_cf)))) {
          current_statement__ = 281;
          lp_accum__.add(stan::math::gamma_lpdf<propto__>(sd_slope,
                           gpslope_a, gpslope_b));
        }
        current_statement__ = 284;
        lp_accum__.add(stan::math::gamma_lpdf<propto__>(sd_inter, gpint_a,
                         gpint_b));
        current_statement__ = 294;
        if (stan::math::logical_gt(ng, 1)) {
          current_statement__ = 287;
          if ((stan::math::primitive_value(
                 stan::math::logical_negation(const_cf))
              &&
              stan::math::primitive_value(
                stan::math::logical_negation(scfmale_isfixed)))) {
            current_statement__ = 285;
            lp_accum__.add(stan::math::gamma_lpdf<propto__>(lambda_cf_male,
                             2,
                             stan::model::rvalue(sprior, "sprior",
                               stan::model::index_uni(2))));
          }
          current_statement__ = 290;
          for (int i = 1; i <= (K - 2); ++i) {
            current_statement__ = 288;
            lp_accum__.add(stan::math::normal_lpdf<propto__>(
                             stan::model::rvalue(bmale, "bmale",
                               stan::model::index_uni(i)), 0,
                             lambda_cf_male_use));
          }
          current_statement__ = 291;
          lp_accum__.add(stan::math::normal_lpdf<propto__>(
                           stan::model::rvalue(bmale, "bmale",
                             stan::model::index_uni((K - 1))), 0,
                           gender_slope_priorsd));
          current_statement__ = 292;
          lp_accum__.add(stan::math::normal_lpdf<propto__>(
                           stan::model::rvalue(bmale, "bmale",
                             stan::model::index_uni(K)), 0,
                           gender_int_priorsd));
        }
        current_statement__ = 303;
        if (stan::math::logical_negation(smooth_inc)) {
          current_statement__ = 301;
          for (int a = 1; a <= nage; ++a) {
            current_statement__ = 299;
            for (int j = 1; j <= narea; ++j) {
              current_statement__ = 297;
              for (int g = 1; g <= ng; ++g) {
                current_statement__ = 295;
                lp_accum__.add(stan::math::gamma_lpdf<propto__>(
                                 stan::model::rvalue(inc_par, "inc_par",
                                   stan::model::index_uni(a),
                                   stan::model::index_uni(j),
                                   stan::model::index_uni(g)),
                                 stan::model::rvalue(inc_prior, "inc_prior",
                                   stan::model::index_uni(1)),
                                 stan::model::rvalue(inc_prior, "inc_prior",
                                   stan::model::index_uni(2))));
              }
            }
          }
        }
        current_statement__ = 310;
        if (prev_zero) {
          current_statement__ = 308;
          for (int j = 1; j <= narea; ++j) {
            current_statement__ = 306;
            for (int g = 1; g <= ng; ++g) {
              current_statement__ = 304;
              lp_accum__.add(stan::math::beta_lpdf<propto__>(
                               stan::model::rvalue(prevzero, "prevzero",
                                 stan::model::index_uni(j),
                                 stan::model::index_uni(g)), 2, 2));
            }
          }
        }
      }
    } 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;
    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;
    static constexpr const char* function__ =
      "model_disbayes_hier_namespace::write_array";
    // suppress unused var warning
    (void) function__;
    try {
      std::vector<std::vector<std::vector<double>>> inc_par =
        std::vector<std::vector<std::vector<double>>>(inc_par_1dim__,
          std::vector<std::vector<double>>(narea,
            std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN())));
      current_statement__ = 1;
      inc_par = in__.template read_constrain_lb<
                  std::vector<std::vector<std::vector<local_scalar_t__>>>,
                  jacobian__>(0, lp__, inc_par_1dim__, narea, ng);
      std::vector<std::vector<double>> rem_par =
        std::vector<std::vector<double>>(rem_par_1dim__,
          std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN()));
      current_statement__ = 2;
      rem_par = in__.template read_constrain_lb<
                  std::vector<std::vector<local_scalar_t__>>, jacobian__>(0,
                  lp__, rem_par_1dim__, ng);
      Eigen::Matrix<double,-1,-1> barea =
        Eigen::Matrix<double,-1,-1>::Constant(barea_1dim__, barea_2dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 3;
      barea = in__.template read<
                Eigen::Matrix<local_scalar_t__,-1,-1>>(barea_1dim__,
                barea_2dim__);
      Eigen::Matrix<double,-1,-1> barea_slope =
        Eigen::Matrix<double,-1,-1>::Constant(barea_slope_1dim__,
          barea_slope_2dim__, std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 4;
      barea_slope = in__.template read<
                      Eigen::Matrix<local_scalar_t__,-1,-1>>(barea_slope_1dim__,
                      barea_slope_2dim__);
      Eigen::Matrix<double,-1,-1> barea_inter =
        Eigen::Matrix<double,-1,-1>::Constant(1, barea_inter_2dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 5;
      barea_inter = in__.template read<
                      Eigen::Matrix<local_scalar_t__,-1,-1>>(1,
                      barea_inter_2dim__);
      Eigen::Matrix<double,-1,1> bmale =
        Eigen::Matrix<double,-1,1>::Constant(bmale_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 6;
      bmale = in__.template read<
                Eigen::Matrix<local_scalar_t__,-1,1>>(bmale_1dim__);
      Eigen::Matrix<double,-1,1> lcfbase =
        Eigen::Matrix<double,-1,1>::Constant(lcfbase_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 7;
      lcfbase = in__.template read<
                  Eigen::Matrix<local_scalar_t__,-1,1>>(lcfbase_1dim__);
      std::vector<std::vector<std::vector<double>>> beta_inc =
        std::vector<std::vector<std::vector<double>>>(beta_inc_1dim__,
          std::vector<std::vector<double>>(narea,
            std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN())));
      current_statement__ = 8;
      beta_inc = in__.template read<
                   std::vector<std::vector<std::vector<local_scalar_t__>>>>(beta_inc_1dim__,
                   narea, ng);
      std::vector<std::vector<std::vector<double>>> beta_rem =
        std::vector<std::vector<std::vector<double>>>(beta_rem_1dim__,
          std::vector<std::vector<double>>(narea,
            std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN())));
      current_statement__ = 9;
      beta_rem = in__.template read<
                   std::vector<std::vector<std::vector<local_scalar_t__>>>>(beta_rem_1dim__,
                   narea, ng);
      double mean_inter = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 10;
      mean_inter = in__.template read<local_scalar_t__>();
      Eigen::Matrix<double,-1,1> sd_inter =
        Eigen::Matrix<double,-1,1>::Constant(sd_inter_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 11;
      sd_inter = in__.template read_constrain_lb<
                   Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0, lp__,
                   sd_inter_1dim__);
      Eigen::Matrix<double,-1,1> mean_slope =
        Eigen::Matrix<double,-1,1>::Constant(mean_slope_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 12;
      mean_slope = in__.template read<
                     Eigen::Matrix<local_scalar_t__,-1,1>>(mean_slope_1dim__);
      Eigen::Matrix<double,-1,1> sd_slope =
        Eigen::Matrix<double,-1,1>::Constant(sd_slope_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 13;
      sd_slope = in__.template read_constrain_lb<
                   Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0, lp__,
                   sd_slope_1dim__);
      Eigen::Matrix<double,-1,1> lambda_cf =
        Eigen::Matrix<double,-1,1>::Constant(lambda_cf_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 14;
      lambda_cf = in__.template read_constrain_lb<
                    Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0,
                    lp__, lambda_cf_1dim__);
      Eigen::Matrix<double,-1,1> lambda_cf_male =
        Eigen::Matrix<double,-1,1>::Constant(lambda_cf_male_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 15;
      lambda_cf_male = in__.template read_constrain_lb<
                         Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0,
                         lp__, lambda_cf_male_1dim__);
      Eigen::Matrix<double,-1,1> lambda_inc =
        Eigen::Matrix<double,-1,1>::Constant(lambda_inc_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 16;
      lambda_inc = in__.template read_constrain_lb<
                     Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0,
                     lp__, lambda_inc_1dim__);
      Eigen::Matrix<double,-1,1> lambda_rem =
        Eigen::Matrix<double,-1,1>::Constant(lambda_rem_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 17;
      lambda_rem = in__.template read_constrain_lb<
                     Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0,
                     lp__, lambda_rem_1dim__);
      std::vector<std::vector<double>> prevzero =
        std::vector<std::vector<double>>(prevzero_1dim__,
          std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN()));
      current_statement__ = 18;
      prevzero = in__.template read_constrain_lub<
                   std::vector<std::vector<local_scalar_t__>>, jacobian__>(0,
                   1, lp__, prevzero_1dim__, ng);
      std::vector<std::vector<std::vector<double>>> inc =
        std::vector<std::vector<std::vector<double>>>(nage,
          std::vector<std::vector<double>>(narea,
            std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN())));
      std::vector<std::vector<std::vector<double>>> cf =
        std::vector<std::vector<std::vector<double>>>(nage,
          std::vector<std::vector<double>>(narea,
            std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN())));
      std::vector<std::vector<std::vector<double>>> dcf =
        std::vector<std::vector<std::vector<double>>>(dcf_1dim__,
          std::vector<std::vector<double>>(narea,
            std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN())));
      std::vector<std::vector<std::vector<double>>> inc_prob =
        std::vector<std::vector<std::vector<double>>>(nage,
          std::vector<std::vector<double>>(narea,
            std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN())));
      std::vector<std::vector<std::vector<double>>> prev_prob =
        std::vector<std::vector<std::vector<double>>>(nage,
          std::vector<std::vector<double>>(narea,
            std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN())));
      std::vector<std::vector<std::vector<double>>> mort_prob =
        std::vector<std::vector<std::vector<double>>>(nage,
          std::vector<std::vector<double>>(narea,
            std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN())));
      std::vector<std::vector<std::vector<double>>> rem =
        std::vector<std::vector<std::vector<double>>>(nage,
          std::vector<std::vector<double>>(narea,
            std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN())));
      std::vector<std::vector<std::vector<double>>> rem_prob =
        std::vector<std::vector<std::vector<double>>>(rem_prob_1dim__,
          std::vector<std::vector<double>>(narea,
            std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN())));
      std::vector<std::vector<std::vector<double>>> cf_prob =
        std::vector<std::vector<std::vector<double>>>(nage,
          std::vector<std::vector<double>>(narea,
            std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN())));
      std::vector<std::vector<std::vector<Eigen::Matrix<double,1,-1>>>>
        state_probs =
        std::vector<std::vector<std::vector<Eigen::Matrix<double,1,-1>>>>(state_probs_1dim__,
          std::vector<std::vector<Eigen::Matrix<double,1,-1>>>(narea,
            std::vector<Eigen::Matrix<double,1,-1>>(ng,
              Eigen::Matrix<double,1,-1>::Constant(3,
                std::numeric_limits<double>::quiet_NaN()))));
      Eigen::Matrix<double,1,-1> tmp =
        Eigen::Matrix<double,1,-1>::Constant(3,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,-1> P =
        Eigen::Matrix<double,-1,-1>::Constant(3, 3,
          std::numeric_limits<double>::quiet_NaN());
      double sdint_use = std::numeric_limits<double>::quiet_NaN();
      double sdslope_use = std::numeric_limits<double>::quiet_NaN();
      Eigen::Matrix<double,-1,-1> bareat =
        Eigen::Matrix<double,-1,-1>::Constant(K, narea,
          std::numeric_limits<double>::quiet_NaN());
      std::vector<std::vector<std::vector<double>>> beta =
        std::vector<std::vector<std::vector<double>>>(K,
          std::vector<std::vector<double>>(narea,
            std::vector<double>(ng, std::numeric_limits<double>::quiet_NaN())));
      double lambda_cf_use = std::numeric_limits<double>::quiet_NaN();
      double lambda_cf_male_use = std::numeric_limits<double>::quiet_NaN();
      double lambda_inc_use = std::numeric_limits<double>::quiet_NaN();
      double lambda_rem_use = std::numeric_limits<double>::quiet_NaN();
      Eigen::Matrix<double,-1,1> lcfbase_use =
        Eigen::Matrix<double,-1,1>::Constant(lcfbase_use_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= inc_par_1dim__; ++sym3__) {
            out__.write(inc_par[(sym3__ - 1)][(sym2__ - 1)][(sym1__ - 1)]);
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= rem_par_1dim__; ++sym2__) {
          out__.write(rem_par[(sym2__ - 1)][(sym1__ - 1)]);
        }
      }
      out__.write(barea);
      out__.write(barea_slope);
      out__.write(barea_inter);
      out__.write(bmale);
      out__.write(lcfbase);
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= beta_inc_1dim__; ++sym3__) {
            out__.write(beta_inc[(sym3__ - 1)][(sym2__ - 1)][(sym1__ - 1)]);
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= beta_rem_1dim__; ++sym3__) {
            out__.write(beta_rem[(sym3__ - 1)][(sym2__ - 1)][(sym1__ - 1)]);
          }
        }
      }
      out__.write(mean_inter);
      out__.write(sd_inter);
      out__.write(mean_slope);
      out__.write(sd_slope);
      out__.write(lambda_cf);
      out__.write(lambda_cf_male);
      out__.write(lambda_inc);
      out__.write(lambda_rem);
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= prevzero_1dim__; ++sym2__) {
          out__.write(prevzero[(sym2__ - 1)][(sym1__ - 1)]);
        }
      }
      if (stan::math::logical_negation(
            (stan::math::primitive_value(emit_transformed_parameters__) ||
            stan::math::primitive_value(emit_generated_quantities__)))) {
        return ;
      }
      current_statement__ = 48;
      if (sd_int_isfixed) {
        current_statement__ = 47;
        sdint_use = sd_int_fixed;
      } else {
        current_statement__ = 46;
        sdint_use = stan::model::rvalue(sd_inter, "sd_inter",
                      stan::model::index_uni(1));
      }
      current_statement__ = 51;
      if ((stan::math::primitive_value(
             (stan::math::primitive_value(
                (stan::math::primitive_value(sd_slope_isfixed) ||
                stan::math::primitive_value(const_cf))) ||
             stan::math::primitive_value(interceptonly)))
          || stan::math::primitive_value(increasing))) {
        current_statement__ = 50;
        sdslope_use = sd_slope_fixed;
      } else {
        current_statement__ = 49;
        sdslope_use = stan::model::rvalue(sd_slope, "sd_slope",
                        stan::model::index_uni(1));
      }
      current_statement__ = 54;
      if ((stan::math::primitive_value(scf_isfixed) ||
          stan::math::primitive_value(const_cf))) {
        current_statement__ = 53;
        lambda_cf_use = lambda_cf_fixed;
      } else {
        current_statement__ = 52;
        lambda_cf_use = stan::model::rvalue(lambda_cf, "lambda_cf",
                          stan::model::index_uni(1));
      }
      current_statement__ = 57;
      if ((stan::math::primitive_value(scfmale_isfixed) ||
          stan::math::primitive_value(stan::math::logical_eq(ng, 1)))) {
        current_statement__ = 56;
        lambda_cf_male_use = lambda_cf_male_fixed;
      } else {
        current_statement__ = 55;
        lambda_cf_male_use = stan::model::rvalue(lambda_cf_male,
                               "lambda_cf_male", stan::model::index_uni(1));
      }
      current_statement__ = 60;
      if ((stan::math::primitive_value(sinc_isfixed) ||
          stan::math::primitive_value(
            stan::math::logical_negation(smooth_inc)))) {
        current_statement__ = 59;
        lambda_inc_use = lambda_inc_fixed;
      } else {
        current_statement__ = 58;
        lambda_inc_use = stan::model::rvalue(lambda_inc, "lambda_inc",
                           stan::model::index_uni(1));
      }
      current_statement__ = 63;
      if ((stan::math::primitive_value(srem_isfixed) ||
          stan::math::primitive_value(
            stan::math::logical_negation(smooth_rem)))) {
        current_statement__ = 62;
        lambda_rem_use = lambda_rem_fixed;
      } else {
        current_statement__ = 61;
        lambda_rem_use = stan::model::rvalue(lambda_rem, "lambda_rem",
                           stan::model::index_uni(1));
      }
      current_statement__ = 115;
      for (int j = 1; j <= narea; ++j) {
        current_statement__ = 113;
        if (common) {
          current_statement__ = 92;
          if (increasing) {
            current_statement__ = 90;
            stan::model::assign(lcfbase_use,
              stan::model::rvalue(lcfbase, "lcfbase",
                stan::model::index_uni(1)), "assigning variable lcfbase_use",
              stan::model::index_uni(j));
          }
          current_statement__ = 106;
          if (const_cf) {
            current_statement__ = 104;
            for (int i = 1; i <= (K - 1); ++i) {
              current_statement__ = 102;
              stan::model::assign(bareat, 0, "assigning variable bareat",
                stan::model::index_uni(i), stan::model::index_uni(j));
            }
          } else {
            current_statement__ = 95;
            for (int i = 1; i <= (K - 2); ++i) {
              current_statement__ = 93;
              stan::model::assign(bareat,
                (stan::model::rvalue(barea, "barea",
                   stan::model::index_uni(i), stan::model::index_uni(1)) *
                lambda_cf_use), "assigning variable bareat",
                stan::model::index_uni(i), stan::model::index_uni(j));
            }
            current_statement__ = 100;
            if (increasing) {
              current_statement__ = 98;
              stan::model::assign(bareat,
                (stan::model::rvalue(barea_slope, "barea_slope",
                   stan::model::index_uni(1), stan::model::index_uni(1)) *
                lambda_cf_use), "assigning variable bareat",
                stan::model::index_uni((K - 1)), stan::model::index_uni(j));
            } else {
              current_statement__ = 96;
              stan::model::assign(bareat,
                stan::model::rvalue(mean_slope, "mean_slope",
                  stan::model::index_uni(1)), "assigning variable bareat",
                stan::model::index_uni((K - 1)), stan::model::index_uni(j));
            }
          }
          current_statement__ = 111;
          if (increasing) {
            current_statement__ = 109;
            stan::model::assign(bareat,
              stan::model::rvalue(mean_slope, "mean_slope",
                stan::model::index_uni(1)), "assigning variable bareat",
              stan::model::index_uni(K), stan::model::index_uni(j));
          } else {
            current_statement__ = 107;
            stan::model::assign(bareat, mean_inter,
              "assigning variable bareat", stan::model::index_uni(K),
              stan::model::index_uni(j));
          }
        } else {
          current_statement__ = 66;
          if (increasing) {
            current_statement__ = 64;
            stan::model::assign(lcfbase_use,
              stan::model::rvalue(lcfbase, "lcfbase",
                stan::model::index_uni(j)), "assigning variable lcfbase_use",
              stan::model::index_uni(j));
          }
          current_statement__ = 83;
          if (const_cf) {
            current_statement__ = 81;
            for (int i = 1; i <= (K - 1); ++i) {
              current_statement__ = 79;
              stan::model::assign(bareat, 0, "assigning variable bareat",
                stan::model::index_uni(i), stan::model::index_uni(j));
            }
          } else {
            current_statement__ = 69;
            for (int i = 1; i <= (K - 2); ++i) {
              current_statement__ = 67;
              stan::model::assign(bareat,
                (stan::model::rvalue(barea, "barea",
                   stan::model::index_uni(i), stan::model::index_uni(j)) *
                lambda_cf_use), "assigning variable bareat",
                stan::model::index_uni(i), stan::model::index_uni(j));
            }
            current_statement__ = 77;
            if (interceptonly) {
              current_statement__ = 75;
              stan::model::assign(bareat,
                stan::model::rvalue(mean_slope, "mean_slope",
                  stan::model::index_uni(1)), "assigning variable bareat",
                stan::model::index_uni((K - 1)), stan::model::index_uni(j));
            } else {
              current_statement__ = 74;
              if (increasing) {
                current_statement__ = 72;
                stan::model::assign(bareat,
                  (stan::model::rvalue(barea_slope, "barea_slope",
                     stan::model::index_uni(1), stan::model::index_uni(j)) *
                  lambda_cf_use), "assigning variable bareat",
                  stan::model::index_uni((K - 1)), stan::model::index_uni(j));
              } else {
                current_statement__ = 70;
                stan::model::assign(bareat,
                  (stan::model::rvalue(mean_slope, "mean_slope",
                     stan::model::index_uni(1)) +
                  (stan::model::rvalue(barea_slope, "barea_slope",
                     stan::model::index_uni(1), stan::model::index_uni(j)) *
                  sdslope_use)), "assigning variable bareat",
                  stan::model::index_uni((K - 1)), stan::model::index_uni(j));
              }
            }
          }
          current_statement__ = 88;
          if (increasing) {
            current_statement__ = 86;
            stan::model::assign(bareat,
              stan::model::rvalue(mean_slope, "mean_slope",
                stan::model::index_uni(1)), "assigning variable bareat",
              stan::model::index_uni(K), stan::model::index_uni(j));
          } else {
            current_statement__ = 84;
            stan::model::assign(bareat, (mean_inter +
              (stan::model::rvalue(barea_inter, "barea_inter",
                 stan::model::index_uni(1), stan::model::index_uni(j)) *
              sdint_use)), "assigning variable bareat",
              stan::model::index_uni(K), stan::model::index_uni(j));
          }
        }
      }
      current_statement__ = 184;
      for (int g = 1; g <= ng; ++g) {
        current_statement__ = 182;
        for (int j = 1; j <= narea; ++j) {
          current_statement__ = 122;
          for (int a = 1; a <= nage; ++a) {
            current_statement__ = 120;
            if (smooth_inc) {
              current_statement__ = 118;
              stan::model::assign(inc,
                stan::math::exp(
                  stan::math::multiply(
                    stan::model::rvalue(X, "X", stan::model::index_uni(a),
                      stan::model::index_omni()),
                    stan::math::to_vector(
                      stan::model::rvalue(beta_inc, "beta_inc",
                        stan::model::index_omni(), stan::model::index_uni(j),
                        stan::model::index_uni(g))))),
                "assigning variable inc", stan::model::index_uni(a),
                stan::model::index_uni(j), stan::model::index_uni(g));
            } else {
              current_statement__ = 116;
              stan::model::assign(inc,
                stan::model::rvalue(inc_par, "inc_par",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g)), "assigning variable inc",
                stan::model::index_uni(a), stan::model::index_uni(j),
                stan::model::index_uni(g));
            }
          }
          current_statement__ = 129;
          for (int k = 1; k <= K; ++k) {
            current_statement__ = 127;
            if (stan::math::logical_gt(ng, 1)) {
              current_statement__ = 125;
              stan::model::assign(beta,
                (stan::model::rvalue(bareat, "bareat",
                   stan::model::index_uni(k), stan::model::index_uni(j)) +
                (stan::model::rvalue(bmale, "bmale",
                   stan::model::index_uni(k)) * (g - 1))),
                "assigning variable beta", stan::model::index_uni(k),
                stan::model::index_uni(j), stan::model::index_uni(g));
            } else {
              current_statement__ = 123;
              stan::model::assign(beta,
                stan::model::rvalue(bareat, "bareat",
                  stan::model::index_uni(k), stan::model::index_uni(j)),
                "assigning variable beta", stan::model::index_uni(k),
                stan::model::index_uni(j), stan::model::index_uni(g));
            }
          }
          current_statement__ = 132;
          if ((stan::math::primitive_value(
                 stan::math::logical_gt(
                   stan::model::rvalue(prev_denom, "prev_denom",
                     stan::model::index_uni(1), stan::model::index_uni(j),
                     stan::model::index_uni(g)), 0))
              &&
              stan::math::primitive_value(
                (stan::math::primitive_value(
                   stan::math::logical_gt(
                     stan::model::rvalue(prev_num, "prev_num",
                       stan::model::index_uni(1), stan::model::index_uni(j),
                       stan::model::index_uni(g)), 0)) ||
                stan::math::primitive_value(prev_zero))))) {
            current_statement__ = 131;
            stan::model::assign(prev_prob,
              stan::model::rvalue(prevzero, "prevzero",
                stan::model::index_uni(j), stan::model::index_uni(g)),
              "assigning variable prev_prob", stan::model::index_uni(1),
              stan::model::index_uni(j), stan::model::index_uni(g));
          } else {
            current_statement__ = 130;
            stan::model::assign(prev_prob, 0, "assigning variable prev_prob",
              stan::model::index_uni(1), stan::model::index_uni(j),
              stan::model::index_uni(g));
          }
          current_statement__ = 133;
          stan::model::assign(state_probs, 1,
            "assigning variable state_probs", stan::model::index_uni(1),
            stan::model::index_uni(j), stan::model::index_uni(g),
            stan::model::index_uni(1));
          current_statement__ = 134;
          stan::model::assign(state_probs, 0,
            "assigning variable state_probs", stan::model::index_uni(1),
            stan::model::index_uni(j), stan::model::index_uni(g),
            stan::model::index_uni(2));
          current_statement__ = 135;
          stan::model::assign(state_probs, 0,
            "assigning variable state_probs", stan::model::index_uni(1),
            stan::model::index_uni(j), stan::model::index_uni(g),
            stan::model::index_uni(3));
          current_statement__ = 150;
          if (increasing) {
            current_statement__ = 142;
            for (int a = 1; a <= nage; ++a) {
              current_statement__ = 140;
              stan::model::assign(dcf,
                stan::math::exp(
                  stan::math::multiply(
                    stan::model::rvalue(X, "X", stan::model::index_uni(a),
                      stan::model::index_omni()),
                    stan::math::to_vector(
                      stan::model::rvalue(beta, "beta",
                        stan::model::index_omni(), stan::model::index_uni(j),
                        stan::model::index_uni(g))))),
                "assigning variable dcf", stan::model::index_uni(a),
                stan::model::index_uni(j), stan::model::index_uni(g));
            }
            current_statement__ = 145;
            for (int a = 1; a <= (eqage - 1); ++a) {
              current_statement__ = 143;
              stan::model::assign(cf,
                stan::math::exp(
                  stan::model::rvalue(lcfbase_use, "lcfbase_use",
                    stan::model::index_uni(j))), "assigning variable cf",
                stan::model::index_uni(a), stan::model::index_uni(j),
                stan::model::index_uni(g));
            }
            current_statement__ = 148;
            for (int a = eqage; a <= nage; ++a) {
              current_statement__ = 146;
              stan::model::assign(cf,
                (stan::model::rvalue(cf, "cf",
                   stan::model::index_uni((a - 1)),
                   stan::model::index_uni(j), stan::model::index_uni(g)) +
                stan::model::rvalue(dcf, "dcf", stan::model::index_uni(a),
                  stan::model::index_uni(j), stan::model::index_uni(g))),
                "assigning variable cf", stan::model::index_uni(a),
                stan::model::index_uni(j), stan::model::index_uni(g));
            }
          } else {
            current_statement__ = 138;
            for (int a = 1; a <= nage; ++a) {
              current_statement__ = 136;
              stan::model::assign(cf,
                stan::math::exp(
                  stan::math::multiply(
                    stan::model::rvalue(X, "X", stan::model::index_uni(a),
                      stan::model::index_omni()),
                    stan::math::to_vector(
                      stan::model::rvalue(beta, "beta",
                        stan::model::index_omni(), stan::model::index_uni(j),
                        stan::model::index_uni(g))))),
                "assigning variable cf", stan::model::index_uni(a),
                stan::model::index_uni(j), stan::model::index_uni(g));
            }
          }
          current_statement__ = 166;
          if (remission) {
            current_statement__ = 164;
            if (smooth_rem) {
              current_statement__ = 162;
              for (int a = 1; a <= nage; ++a) {
                current_statement__ = 160;
                stan::model::assign(rem,
                  stan::math::exp(
                    stan::math::multiply(
                      stan::model::rvalue(X, "X", stan::model::index_uni(a),
                        stan::model::index_omni()),
                      stan::math::to_vector(
                        stan::model::rvalue(beta_rem, "beta_rem",
                          stan::model::index_omni(),
                          stan::model::index_uni(j),
                          stan::model::index_uni(g))))),
                  "assigning variable rem", stan::model::index_uni(a),
                  stan::model::index_uni(j), stan::model::index_uni(g));
              }
            } else {
              current_statement__ = 159;
              if (const_rem) {
                current_statement__ = 157;
                for (int a = 1; a <= nage; ++a) {
                  current_statement__ = 156;
                  stan::model::assign(rem,
                    stan::model::rvalue(rem_par, "rem_par",
                      stan::model::index_uni(1), stan::model::index_uni(g)),
                    "assigning variable rem", stan::model::index_uni(a),
                    stan::model::index_uni(j), stan::model::index_uni(g));
                }
              } else {
                current_statement__ = 155;
                stan::model::assign(rem,
                  stan::model::rvalue(rem_par, "rem_par",
                    stan::model::index_omni(), stan::model::index_uni(g)),
                  "assigning variable rem", stan::model::index_omni(),
                  stan::model::index_uni(j), stan::model::index_uni(g));
              }
            }
          } else {
            current_statement__ = 153;
            for (int a = 1; a <= nage; ++a) {
              current_statement__ = 151;
              stan::model::assign(rem, 0, "assigning variable rem",
                stan::model::index_uni(a), stan::model::index_uni(j),
                stan::model::index_uni(g));
            }
          }
          current_statement__ = 180;
          for (int a = 1; a <= nage; ++a) {
            current_statement__ = 167;
            stan::model::assign(P,
              trans_probs(
                stan::model::rvalue(inc, "inc", stan::model::index_uni(a),
                  stan::model::index_uni(j), stan::model::index_uni(g)),
                stan::model::rvalue(cf, "cf", stan::model::index_uni(a),
                  stan::model::index_uni(j), stan::model::index_uni(g)),
                stan::model::rvalue(rem, "rem", stan::model::index_uni(a),
                  stan::model::index_uni(j), stan::model::index_uni(g)),
                pstream__), "assigning variable P");
            current_statement__ = 168;
            stan::model::assign(inc_prob,
              bound_prob(
                (stan::model::rvalue(P, "P", stan::model::index_uni(1),
                   stan::model::index_uni(2)) +
                stan::model::rvalue(P, "P", stan::model::index_uni(1),
                  stan::model::index_uni(3))), pstream__),
              "assigning variable inc_prob", stan::model::index_uni(a),
              stan::model::index_uni(j), stan::model::index_uni(g));
            current_statement__ = 170;
            if (remission) {
              current_statement__ = 169;
              stan::model::assign(rem_prob,
                stan::model::rvalue(P, "P", stan::model::index_uni(2),
                  stan::model::index_uni(1)), "assigning variable rem_prob",
                stan::model::index_uni(a), stan::model::index_uni(j),
                stan::model::index_uni(g));
            }
            current_statement__ = 172;
            if (stan::math::logical_gt(a, 1)) {
              current_statement__ = 171;
              stan::model::assign(prev_prob,
                (stan::model::rvalue(state_probs, "state_probs",
                   stan::model::index_uni(a), stan::model::index_uni(j),
                   stan::model::index_uni(g), stan::model::index_uni(2)) /
                (stan::model::rvalue(state_probs, "state_probs",
                   stan::model::index_uni(a), stan::model::index_uni(j),
                   stan::model::index_uni(g), stan::model::index_uni(1)) +
                stan::model::rvalue(state_probs, "state_probs",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g), stan::model::index_uni(2)))),
                "assigning variable prev_prob", stan::model::index_uni(a),
                stan::model::index_uni(j), stan::model::index_uni(g));
            }
            current_statement__ = 173;
            stan::model::assign(tmp,
              stan::math::multiply(
                stan::model::rvalue(state_probs, "state_probs",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g), stan::model::index_min_max(1, 3)),
                P), "assigning variable tmp");
            current_statement__ = 174;
            stan::model::assign(state_probs, tmp,
              "assigning variable state_probs",
              stan::model::index_uni((a + 1)), stan::model::index_uni(j),
              stan::model::index_uni(g), stan::model::index_min_max(1, 3));
            current_statement__ = 175;
            stan::model::assign(cf_prob,
              bound_prob(
                stan::model::rvalue(P, "P", stan::model::index_uni(2),
                  stan::model::index_uni(3)), pstream__),
              "assigning variable cf_prob", stan::model::index_uni(a),
              stan::model::index_uni(j), stan::model::index_uni(g));
            current_statement__ = 176;
            stan::model::assign(mort_prob,
              ((stan::model::rvalue(P, "P", stan::model::index_uni(1),
                  stan::model::index_uni(3)) * (1 -
              stan::model::rvalue(prev_prob, "prev_prob",
                stan::model::index_uni(a), stan::model::index_uni(j),
                stan::model::index_uni(g)))) +
              (stan::model::rvalue(P, "P", stan::model::index_uni(2),
                 stan::model::index_uni(3)) *
              stan::model::rvalue(prev_prob, "prev_prob",
                stan::model::index_uni(a), stan::model::index_uni(j),
                stan::model::index_uni(g)))), "assigning variable mort_prob",
              stan::model::index_uni(a), stan::model::index_uni(j),
              stan::model::index_uni(g));
            current_statement__ = 177;
            stan::model::assign(mort_prob,
              bound_prob(
                stan::model::rvalue(mort_prob, "mort_prob",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g)), pstream__),
              "assigning variable mort_prob", stan::model::index_uni(a),
              stan::model::index_uni(j), stan::model::index_uni(g));
            current_statement__ = 178;
            stan::model::assign(mort_prob,
              bound_prob(
                stan::model::rvalue(mort_prob, "mort_prob",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g)), pstream__),
              "assigning variable mort_prob", stan::model::index_uni(a),
              stan::model::index_uni(j), stan::model::index_uni(g));
          }
        }
      }
      current_statement__ = 19;
      stan::math::check_greater_or_equal(function__, "inc", inc, 0);
      current_statement__ = 20;
      stan::math::check_greater_or_equal(function__, "cf", cf, 0);
      current_statement__ = 21;
      stan::math::check_greater_or_equal(function__, "dcf", dcf, 0);
      current_statement__ = 22;
      stan::math::check_greater_or_equal(function__, "inc_prob", inc_prob, 0);
      current_statement__ = 23;
      stan::math::check_greater_or_equal(function__, "prev_prob", prev_prob,
        0);
      current_statement__ = 24;
      stan::math::check_greater_or_equal(function__, "mort_prob", mort_prob,
        0);
      current_statement__ = 25;
      stan::math::check_greater_or_equal(function__, "rem", rem, 0);
      current_statement__ = 26;
      stan::math::check_greater_or_equal(function__, "rem_prob", rem_prob, 0);
      current_statement__ = 27;
      stan::math::check_greater_or_equal(function__, "cf_prob", cf_prob, 0);
      current_statement__ = 31;
      stan::math::check_greater_or_equal(function__, "sdint_use", sdint_use,
        0);
      current_statement__ = 32;
      stan::math::check_greater_or_equal(function__, "sdslope_use",
        sdslope_use, 0);
      current_statement__ = 35;
      stan::math::check_greater_or_equal(function__, "lambda_cf_use",
        lambda_cf_use, 0);
      current_statement__ = 36;
      stan::math::check_greater_or_equal(function__, "lambda_cf_male_use",
        lambda_cf_male_use, 0);
      current_statement__ = 37;
      stan::math::check_greater_or_equal(function__, "lambda_inc_use",
        lambda_inc_use, 0);
      current_statement__ = 38;
      stan::math::check_greater_or_equal(function__, "lambda_rem_use",
        lambda_rem_use, 0);
      if (emit_transformed_parameters__) {
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              out__.write(inc[(sym3__ - 1)][(sym2__ - 1)][(sym1__ - 1)]);
            }
          }
        }
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              out__.write(cf[(sym3__ - 1)][(sym2__ - 1)][(sym1__ - 1)]);
            }
          }
        }
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            for (int sym3__ = 1; sym3__ <= dcf_1dim__; ++sym3__) {
              out__.write(dcf[(sym3__ - 1)][(sym2__ - 1)][(sym1__ - 1)]);
            }
          }
        }
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              out__.write(inc_prob[(sym3__ - 1)][(sym2__ - 1)][(sym1__ - 1)]);
            }
          }
        }
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              out__.write(prev_prob[(sym3__ - 1)][(sym2__ - 1)][(sym1__ -
                1)]);
            }
          }
        }
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              out__.write(mort_prob[(sym3__ - 1)][(sym2__ - 1)][(sym1__ -
                1)]);
            }
          }
        }
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              out__.write(rem[(sym3__ - 1)][(sym2__ - 1)][(sym1__ - 1)]);
            }
          }
        }
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            for (int sym3__ = 1; sym3__ <= rem_prob_1dim__; ++sym3__) {
              out__.write(rem_prob[(sym3__ - 1)][(sym2__ - 1)][(sym1__ - 1)]);
            }
          }
        }
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
              out__.write(cf_prob[(sym3__ - 1)][(sym2__ - 1)][(sym1__ - 1)]);
            }
          }
        }
        for (int sym1__ = 1; sym1__ <= 3; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= ng; ++sym2__) {
            for (int sym3__ = 1; sym3__ <= narea; ++sym3__) {
              for (int sym4__ = 1; sym4__ <= state_probs_1dim__; ++sym4__) {
                out__.write(state_probs[(sym4__ - 1)][(sym3__ - 1)][(sym2__ -
                  1)][(sym1__ - 1)]);
              }
            }
          }
        }
        out__.write(tmp);
        out__.write(P);
        out__.write(sdint_use);
        out__.write(sdslope_use);
        out__.write(bareat);
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            for (int sym3__ = 1; sym3__ <= K; ++sym3__) {
              out__.write(beta[(sym3__ - 1)][(sym2__ - 1)][(sym1__ - 1)]);
            }
          }
        }
        out__.write(lambda_cf_use);
        out__.write(lambda_cf_male_use);
        out__.write(lambda_inc_use);
        out__.write(lambda_rem_use);
        out__.write(lcfbase_use);
      }
      if (stan::math::logical_negation(emit_generated_quantities__)) {
        return ;
      }
      Eigen::Matrix<double,-1,1> ll_mort =
        Eigen::Matrix<double,-1,1>::Constant(ll_mort_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> ll_inc =
        Eigen::Matrix<double,-1,1>::Constant(ll_inc_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> ll_prev =
        Eigen::Matrix<double,-1,1>::Constant(ll_prev_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> ll_rem =
        Eigen::Matrix<double,-1,1>::Constant(ll_rem_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> ll_overall =
        Eigen::Matrix<double,-1,1>::Constant(ll_overall_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      int i = std::numeric_limits<int>::min();
      current_statement__ = 45;
      i = 1;
      current_statement__ = 196;
      for (int a = 1; a <= nage; ++a) {
        current_statement__ = 194;
        for (int j = 1; j <= narea; ++j) {
          current_statement__ = 192;
          for (int g = 1; g <= ng; ++g) {
            current_statement__ = 185;
            stan::model::assign(ll_mort,
              stan::math::binomial_lpmf<false>(
                stan::model::rvalue(mort_num, "mort_num",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g)),
                stan::model::rvalue(mort_denom, "mort_denom",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g)),
                stan::model::rvalue(mort_prob, "mort_prob",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g))), "assigning variable ll_mort",
              stan::model::index_uni(i));
            current_statement__ = 186;
            stan::model::assign(ll_inc,
              stan::math::binomial_lpmf<false>(
                stan::model::rvalue(inc_num, "inc_num",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g)),
                stan::model::rvalue(inc_denom, "inc_denom",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g)),
                stan::model::rvalue(inc_prob, "inc_prob",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g))), "assigning variable ll_inc",
              stan::model::index_uni(i));
            current_statement__ = 187;
            stan::model::assign(ll_prev,
              stan::math::binomial_lpmf<false>(
                stan::model::rvalue(prev_num, "prev_num",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g)),
                stan::model::rvalue(prev_denom, "prev_denom",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g)),
                stan::model::rvalue(prev_prob, "prev_prob",
                  stan::model::index_uni(a), stan::model::index_uni(j),
                  stan::model::index_uni(g))), "assigning variable ll_prev",
              stan::model::index_uni(i));
            current_statement__ = 189;
            if (remission) {
              current_statement__ = 188;
              stan::model::assign(ll_rem,
                stan::math::binomial_lpmf<false>(
                  stan::model::rvalue(rem_num, "rem_num",
                    stan::model::index_uni(a), stan::model::index_uni(j),
                    stan::model::index_uni(g)),
                  stan::model::rvalue(rem_denom, "rem_denom",
                    stan::model::index_uni(a), stan::model::index_uni(j),
                    stan::model::index_uni(g)),
                  stan::model::rvalue(rem_prob, "rem_prob",
                    stan::model::index_uni(a), stan::model::index_uni(j),
                    stan::model::index_uni(g))), "assigning variable ll_rem",
                stan::model::index_uni(i));
            }
            current_statement__ = 190;
            i = (i + 1);
          }
        }
      }
      current_statement__ = 197;
      stan::model::assign(ll_overall,
        stan::math::append_row(ll_mort,
          stan::math::append_row(ll_inc,
            stan::math::append_row(ll_prev, ll_rem))),
        "assigning variable ll_overall");
      out__.write(ll_mort);
      out__.write(ll_inc);
      out__.write(ll_prev);
      out__.write(ll_rem);
      out__.write(ll_overall);
      out__.write(i);
    } 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;
    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;
      std::vector<std::vector<std::vector<local_scalar_t__>>> inc_par =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(inc_par_1dim__,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      current_statement__ = 1;
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        current_statement__ = 1;
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          current_statement__ = 1;
          for (int sym3__ = 1; sym3__ <= inc_par_1dim__; ++sym3__) {
            current_statement__ = 1;
            inc_par[(sym3__ - 1)][(sym2__ - 1)][(sym1__ -
              1)] = in__.read<local_scalar_t__>();
          }
        }
      }
      out__.write_free_lb(0, inc_par);
      std::vector<std::vector<local_scalar_t__>> rem_par =
        std::vector<std::vector<local_scalar_t__>>(rem_par_1dim__,
          std::vector<local_scalar_t__>(ng, DUMMY_VAR__));
      current_statement__ = 2;
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        current_statement__ = 2;
        for (int sym2__ = 1; sym2__ <= rem_par_1dim__; ++sym2__) {
          current_statement__ = 2;
          rem_par[(sym2__ - 1)][(sym1__ -
            1)] = in__.read<local_scalar_t__>();
        }
      }
      out__.write_free_lb(0, rem_par);
      Eigen::Matrix<local_scalar_t__,-1,-1> barea =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(barea_1dim__,
          barea_2dim__, DUMMY_VAR__);
      current_statement__ = 3;
      stan::model::assign(barea,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,-1>>(barea_1dim__,
          barea_2dim__), "assigning variable barea");
      out__.write(barea);
      Eigen::Matrix<local_scalar_t__,-1,-1> barea_slope =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(barea_slope_1dim__,
          barea_slope_2dim__, DUMMY_VAR__);
      current_statement__ = 4;
      stan::model::assign(barea_slope,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,-1>>(barea_slope_1dim__,
          barea_slope_2dim__), "assigning variable barea_slope");
      out__.write(barea_slope);
      Eigen::Matrix<local_scalar_t__,-1,-1> barea_inter =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(1,
          barea_inter_2dim__, DUMMY_VAR__);
      current_statement__ = 5;
      stan::model::assign(barea_inter,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,-1>>(1,
          barea_inter_2dim__), "assigning variable barea_inter");
      out__.write(barea_inter);
      Eigen::Matrix<local_scalar_t__,-1,1> bmale =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(bmale_1dim__,
          DUMMY_VAR__);
      current_statement__ = 6;
      stan::model::assign(bmale,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(bmale_1dim__),
        "assigning variable bmale");
      out__.write(bmale);
      Eigen::Matrix<local_scalar_t__,-1,1> lcfbase =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lcfbase_1dim__,
          DUMMY_VAR__);
      current_statement__ = 7;
      stan::model::assign(lcfbase,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(lcfbase_1dim__),
        "assigning variable lcfbase");
      out__.write(lcfbase);
      std::vector<std::vector<std::vector<local_scalar_t__>>> beta_inc =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(beta_inc_1dim__,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      current_statement__ = 8;
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        current_statement__ = 8;
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          current_statement__ = 8;
          for (int sym3__ = 1; sym3__ <= beta_inc_1dim__; ++sym3__) {
            current_statement__ = 8;
            beta_inc[(sym3__ - 1)][(sym2__ - 1)][(sym1__ -
              1)] = in__.read<local_scalar_t__>();
          }
        }
      }
      out__.write(beta_inc);
      std::vector<std::vector<std::vector<local_scalar_t__>>> beta_rem =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(beta_rem_1dim__,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      current_statement__ = 9;
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        current_statement__ = 9;
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          current_statement__ = 9;
          for (int sym3__ = 1; sym3__ <= beta_rem_1dim__; ++sym3__) {
            current_statement__ = 9;
            beta_rem[(sym3__ - 1)][(sym2__ - 1)][(sym1__ -
              1)] = in__.read<local_scalar_t__>();
          }
        }
      }
      out__.write(beta_rem);
      local_scalar_t__ mean_inter = DUMMY_VAR__;
      current_statement__ = 10;
      mean_inter = in__.read<local_scalar_t__>();
      out__.write(mean_inter);
      Eigen::Matrix<local_scalar_t__,-1,1> sd_inter =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(sd_inter_1dim__,
          DUMMY_VAR__);
      current_statement__ = 11;
      stan::model::assign(sd_inter,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(sd_inter_1dim__),
        "assigning variable sd_inter");
      out__.write_free_lb(0, sd_inter);
      Eigen::Matrix<local_scalar_t__,-1,1> mean_slope =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(mean_slope_1dim__,
          DUMMY_VAR__);
      current_statement__ = 12;
      stan::model::assign(mean_slope,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(mean_slope_1dim__),
        "assigning variable mean_slope");
      out__.write(mean_slope);
      Eigen::Matrix<local_scalar_t__,-1,1> sd_slope =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(sd_slope_1dim__,
          DUMMY_VAR__);
      current_statement__ = 13;
      stan::model::assign(sd_slope,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(sd_slope_1dim__),
        "assigning variable sd_slope");
      out__.write_free_lb(0, sd_slope);
      Eigen::Matrix<local_scalar_t__,-1,1> lambda_cf =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lambda_cf_1dim__,
          DUMMY_VAR__);
      current_statement__ = 14;
      stan::model::assign(lambda_cf,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(lambda_cf_1dim__),
        "assigning variable lambda_cf");
      out__.write_free_lb(0, lambda_cf);
      Eigen::Matrix<local_scalar_t__,-1,1> lambda_cf_male =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lambda_cf_male_1dim__,
          DUMMY_VAR__);
      current_statement__ = 15;
      stan::model::assign(lambda_cf_male,
        in__.read<
          Eigen::Matrix<local_scalar_t__,-1,1>>(lambda_cf_male_1dim__),
        "assigning variable lambda_cf_male");
      out__.write_free_lb(0, lambda_cf_male);
      Eigen::Matrix<local_scalar_t__,-1,1> lambda_inc =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lambda_inc_1dim__,
          DUMMY_VAR__);
      current_statement__ = 16;
      stan::model::assign(lambda_inc,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(lambda_inc_1dim__),
        "assigning variable lambda_inc");
      out__.write_free_lb(0, lambda_inc);
      Eigen::Matrix<local_scalar_t__,-1,1> lambda_rem =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lambda_rem_1dim__,
          DUMMY_VAR__);
      current_statement__ = 17;
      stan::model::assign(lambda_rem,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(lambda_rem_1dim__),
        "assigning variable lambda_rem");
      out__.write_free_lb(0, lambda_rem);
      std::vector<std::vector<local_scalar_t__>> prevzero =
        std::vector<std::vector<local_scalar_t__>>(prevzero_1dim__,
          std::vector<local_scalar_t__>(ng, DUMMY_VAR__));
      current_statement__ = 18;
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        current_statement__ = 18;
        for (int sym2__ = 1; sym2__ <= prevzero_1dim__; ++sym2__) {
          current_statement__ = 18;
          prevzero[(sym2__ - 1)][(sym1__ -
            1)] = in__.read<local_scalar_t__>();
        }
      }
      out__.write_free_lub(0, 1, prevzero);
    } 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;
    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", "inc_par",
        "double",
        std::vector<size_t>{static_cast<size_t>(inc_par_1dim__),
          static_cast<size_t>(narea), static_cast<size_t>(ng)});
      current_statement__ = 2;
      context__.validate_dims("parameter initialization", "rem_par",
        "double",
        std::vector<size_t>{static_cast<size_t>(rem_par_1dim__),
          static_cast<size_t>(ng)});
      current_statement__ = 3;
      context__.validate_dims("parameter initialization", "barea", "double",
        std::vector<size_t>{static_cast<size_t>(barea_1dim__),
          static_cast<size_t>(barea_2dim__)});
      current_statement__ = 4;
      context__.validate_dims("parameter initialization", "barea_slope",
        "double",
        std::vector<size_t>{static_cast<size_t>(barea_slope_1dim__),
          static_cast<size_t>(barea_slope_2dim__)});
      current_statement__ = 5;
      context__.validate_dims("parameter initialization", "barea_inter",
        "double",
        std::vector<size_t>{static_cast<size_t>(1),
          static_cast<size_t>(barea_inter_2dim__)});
      current_statement__ = 6;
      context__.validate_dims("parameter initialization", "bmale", "double",
        std::vector<size_t>{static_cast<size_t>(bmale_1dim__)});
      current_statement__ = 7;
      context__.validate_dims("parameter initialization", "lcfbase",
        "double", std::vector<size_t>{static_cast<size_t>(lcfbase_1dim__)});
      current_statement__ = 8;
      context__.validate_dims("parameter initialization", "beta_inc",
        "double",
        std::vector<size_t>{static_cast<size_t>(beta_inc_1dim__),
          static_cast<size_t>(narea), static_cast<size_t>(ng)});
      current_statement__ = 9;
      context__.validate_dims("parameter initialization", "beta_rem",
        "double",
        std::vector<size_t>{static_cast<size_t>(beta_rem_1dim__),
          static_cast<size_t>(narea), static_cast<size_t>(ng)});
      current_statement__ = 10;
      context__.validate_dims("parameter initialization", "mean_inter",
        "double", std::vector<size_t>{});
      current_statement__ = 11;
      context__.validate_dims("parameter initialization", "sd_inter",
        "double", std::vector<size_t>{static_cast<size_t>(sd_inter_1dim__)});
      current_statement__ = 12;
      context__.validate_dims("parameter initialization", "mean_slope",
        "double",
        std::vector<size_t>{static_cast<size_t>(mean_slope_1dim__)});
      current_statement__ = 13;
      context__.validate_dims("parameter initialization", "sd_slope",
        "double", std::vector<size_t>{static_cast<size_t>(sd_slope_1dim__)});
      current_statement__ = 14;
      context__.validate_dims("parameter initialization", "lambda_cf",
        "double", std::vector<size_t>{static_cast<size_t>(lambda_cf_1dim__)});
      current_statement__ = 15;
      context__.validate_dims("parameter initialization", "lambda_cf_male",
        "double",
        std::vector<size_t>{static_cast<size_t>(lambda_cf_male_1dim__)});
      current_statement__ = 16;
      context__.validate_dims("parameter initialization", "lambda_inc",
        "double",
        std::vector<size_t>{static_cast<size_t>(lambda_inc_1dim__)});
      current_statement__ = 17;
      context__.validate_dims("parameter initialization", "lambda_rem",
        "double",
        std::vector<size_t>{static_cast<size_t>(lambda_rem_1dim__)});
      current_statement__ = 18;
      context__.validate_dims("parameter initialization", "prevzero",
        "double",
        std::vector<size_t>{static_cast<size_t>(prevzero_1dim__),
          static_cast<size_t>(ng)});
      int pos__ = std::numeric_limits<int>::min();
      pos__ = 1;
      std::vector<std::vector<std::vector<local_scalar_t__>>> inc_par =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(inc_par_1dim__,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      {
        std::vector<local_scalar_t__> inc_par_flat__;
        current_statement__ = 1;
        inc_par_flat__ = context__.vals_r("inc_par");
        current_statement__ = 1;
        pos__ = 1;
        current_statement__ = 1;
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          current_statement__ = 1;
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            current_statement__ = 1;
            for (int sym3__ = 1; sym3__ <= inc_par_1dim__; ++sym3__) {
              current_statement__ = 1;
              stan::model::assign(inc_par, inc_par_flat__[(pos__ - 1)],
                "assigning variable inc_par", stan::model::index_uni(sym3__),
                stan::model::index_uni(sym2__),
                stan::model::index_uni(sym1__));
              current_statement__ = 1;
              pos__ = (pos__ + 1);
            }
          }
        }
      }
      out__.write_free_lb(0, inc_par);
      std::vector<std::vector<local_scalar_t__>> rem_par =
        std::vector<std::vector<local_scalar_t__>>(rem_par_1dim__,
          std::vector<local_scalar_t__>(ng, DUMMY_VAR__));
      {
        std::vector<local_scalar_t__> rem_par_flat__;
        current_statement__ = 2;
        rem_par_flat__ = context__.vals_r("rem_par");
        current_statement__ = 2;
        pos__ = 1;
        current_statement__ = 2;
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          current_statement__ = 2;
          for (int sym2__ = 1; sym2__ <= rem_par_1dim__; ++sym2__) {
            current_statement__ = 2;
            stan::model::assign(rem_par, rem_par_flat__[(pos__ - 1)],
              "assigning variable rem_par", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            current_statement__ = 2;
            pos__ = (pos__ + 1);
          }
        }
      }
      out__.write_free_lb(0, rem_par);
      Eigen::Matrix<local_scalar_t__,-1,-1> barea =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(barea_1dim__,
          barea_2dim__, DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> barea_flat__;
        current_statement__ = 3;
        barea_flat__ = context__.vals_r("barea");
        current_statement__ = 3;
        pos__ = 1;
        current_statement__ = 3;
        for (int sym1__ = 1; sym1__ <= barea_2dim__; ++sym1__) {
          current_statement__ = 3;
          for (int sym2__ = 1; sym2__ <= barea_1dim__; ++sym2__) {
            current_statement__ = 3;
            stan::model::assign(barea, barea_flat__[(pos__ - 1)],
              "assigning variable barea", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            current_statement__ = 3;
            pos__ = (pos__ + 1);
          }
        }
      }
      out__.write(barea);
      Eigen::Matrix<local_scalar_t__,-1,-1> barea_slope =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(barea_slope_1dim__,
          barea_slope_2dim__, DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> barea_slope_flat__;
        current_statement__ = 4;
        barea_slope_flat__ = context__.vals_r("barea_slope");
        current_statement__ = 4;
        pos__ = 1;
        current_statement__ = 4;
        for (int sym1__ = 1; sym1__ <= barea_slope_2dim__; ++sym1__) {
          current_statement__ = 4;
          for (int sym2__ = 1; sym2__ <= barea_slope_1dim__; ++sym2__) {
            current_statement__ = 4;
            stan::model::assign(barea_slope, barea_slope_flat__[(pos__ - 1)],
              "assigning variable barea_slope",
              stan::model::index_uni(sym2__), stan::model::index_uni(sym1__));
            current_statement__ = 4;
            pos__ = (pos__ + 1);
          }
        }
      }
      out__.write(barea_slope);
      Eigen::Matrix<local_scalar_t__,-1,-1> barea_inter =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(1,
          barea_inter_2dim__, DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> barea_inter_flat__;
        current_statement__ = 5;
        barea_inter_flat__ = context__.vals_r("barea_inter");
        current_statement__ = 5;
        pos__ = 1;
        current_statement__ = 5;
        for (int sym1__ = 1; sym1__ <= barea_inter_2dim__; ++sym1__) {
          current_statement__ = 5;
          for (int sym2__ = 1; sym2__ <= 1; ++sym2__) {
            current_statement__ = 5;
            stan::model::assign(barea_inter, barea_inter_flat__[(pos__ - 1)],
              "assigning variable barea_inter",
              stan::model::index_uni(sym2__), stan::model::index_uni(sym1__));
            current_statement__ = 5;
            pos__ = (pos__ + 1);
          }
        }
      }
      out__.write(barea_inter);
      Eigen::Matrix<local_scalar_t__,-1,1> bmale =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(bmale_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> bmale_flat__;
        current_statement__ = 6;
        bmale_flat__ = context__.vals_r("bmale");
        current_statement__ = 6;
        pos__ = 1;
        current_statement__ = 6;
        for (int sym1__ = 1; sym1__ <= bmale_1dim__; ++sym1__) {
          current_statement__ = 6;
          stan::model::assign(bmale, bmale_flat__[(pos__ - 1)],
            "assigning variable bmale", stan::model::index_uni(sym1__));
          current_statement__ = 6;
          pos__ = (pos__ + 1);
        }
      }
      out__.write(bmale);
      Eigen::Matrix<local_scalar_t__,-1,1> lcfbase =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lcfbase_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> lcfbase_flat__;
        current_statement__ = 7;
        lcfbase_flat__ = context__.vals_r("lcfbase");
        current_statement__ = 7;
        pos__ = 1;
        current_statement__ = 7;
        for (int sym1__ = 1; sym1__ <= lcfbase_1dim__; ++sym1__) {
          current_statement__ = 7;
          stan::model::assign(lcfbase, lcfbase_flat__[(pos__ - 1)],
            "assigning variable lcfbase", stan::model::index_uni(sym1__));
          current_statement__ = 7;
          pos__ = (pos__ + 1);
        }
      }
      out__.write(lcfbase);
      std::vector<std::vector<std::vector<local_scalar_t__>>> beta_inc =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(beta_inc_1dim__,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      {
        std::vector<local_scalar_t__> beta_inc_flat__;
        current_statement__ = 8;
        beta_inc_flat__ = context__.vals_r("beta_inc");
        current_statement__ = 8;
        pos__ = 1;
        current_statement__ = 8;
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          current_statement__ = 8;
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            current_statement__ = 8;
            for (int sym3__ = 1; sym3__ <= beta_inc_1dim__; ++sym3__) {
              current_statement__ = 8;
              stan::model::assign(beta_inc, beta_inc_flat__[(pos__ - 1)],
                "assigning variable beta_inc",
                stan::model::index_uni(sym3__),
                stan::model::index_uni(sym2__),
                stan::model::index_uni(sym1__));
              current_statement__ = 8;
              pos__ = (pos__ + 1);
            }
          }
        }
      }
      out__.write(beta_inc);
      std::vector<std::vector<std::vector<local_scalar_t__>>> beta_rem =
        std::vector<std::vector<std::vector<local_scalar_t__>>>(beta_rem_1dim__,
          std::vector<std::vector<local_scalar_t__>>(narea,
            std::vector<local_scalar_t__>(ng, DUMMY_VAR__)));
      {
        std::vector<local_scalar_t__> beta_rem_flat__;
        current_statement__ = 9;
        beta_rem_flat__ = context__.vals_r("beta_rem");
        current_statement__ = 9;
        pos__ = 1;
        current_statement__ = 9;
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          current_statement__ = 9;
          for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
            current_statement__ = 9;
            for (int sym3__ = 1; sym3__ <= beta_rem_1dim__; ++sym3__) {
              current_statement__ = 9;
              stan::model::assign(beta_rem, beta_rem_flat__[(pos__ - 1)],
                "assigning variable beta_rem",
                stan::model::index_uni(sym3__),
                stan::model::index_uni(sym2__),
                stan::model::index_uni(sym1__));
              current_statement__ = 9;
              pos__ = (pos__ + 1);
            }
          }
        }
      }
      out__.write(beta_rem);
      local_scalar_t__ mean_inter = DUMMY_VAR__;
      current_statement__ = 10;
      mean_inter = context__.vals_r("mean_inter")[(1 - 1)];
      out__.write(mean_inter);
      Eigen::Matrix<local_scalar_t__,-1,1> sd_inter =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(sd_inter_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> sd_inter_flat__;
        current_statement__ = 11;
        sd_inter_flat__ = context__.vals_r("sd_inter");
        current_statement__ = 11;
        pos__ = 1;
        current_statement__ = 11;
        for (int sym1__ = 1; sym1__ <= sd_inter_1dim__; ++sym1__) {
          current_statement__ = 11;
          stan::model::assign(sd_inter, sd_inter_flat__[(pos__ - 1)],
            "assigning variable sd_inter", stan::model::index_uni(sym1__));
          current_statement__ = 11;
          pos__ = (pos__ + 1);
        }
      }
      out__.write_free_lb(0, sd_inter);
      Eigen::Matrix<local_scalar_t__,-1,1> mean_slope =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(mean_slope_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> mean_slope_flat__;
        current_statement__ = 12;
        mean_slope_flat__ = context__.vals_r("mean_slope");
        current_statement__ = 12;
        pos__ = 1;
        current_statement__ = 12;
        for (int sym1__ = 1; sym1__ <= mean_slope_1dim__; ++sym1__) {
          current_statement__ = 12;
          stan::model::assign(mean_slope, mean_slope_flat__[(pos__ - 1)],
            "assigning variable mean_slope", stan::model::index_uni(sym1__));
          current_statement__ = 12;
          pos__ = (pos__ + 1);
        }
      }
      out__.write(mean_slope);
      Eigen::Matrix<local_scalar_t__,-1,1> sd_slope =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(sd_slope_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> sd_slope_flat__;
        current_statement__ = 13;
        sd_slope_flat__ = context__.vals_r("sd_slope");
        current_statement__ = 13;
        pos__ = 1;
        current_statement__ = 13;
        for (int sym1__ = 1; sym1__ <= sd_slope_1dim__; ++sym1__) {
          current_statement__ = 13;
          stan::model::assign(sd_slope, sd_slope_flat__[(pos__ - 1)],
            "assigning variable sd_slope", stan::model::index_uni(sym1__));
          current_statement__ = 13;
          pos__ = (pos__ + 1);
        }
      }
      out__.write_free_lb(0, sd_slope);
      Eigen::Matrix<local_scalar_t__,-1,1> lambda_cf =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lambda_cf_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> lambda_cf_flat__;
        current_statement__ = 14;
        lambda_cf_flat__ = context__.vals_r("lambda_cf");
        current_statement__ = 14;
        pos__ = 1;
        current_statement__ = 14;
        for (int sym1__ = 1; sym1__ <= lambda_cf_1dim__; ++sym1__) {
          current_statement__ = 14;
          stan::model::assign(lambda_cf, lambda_cf_flat__[(pos__ - 1)],
            "assigning variable lambda_cf", stan::model::index_uni(sym1__));
          current_statement__ = 14;
          pos__ = (pos__ + 1);
        }
      }
      out__.write_free_lb(0, lambda_cf);
      Eigen::Matrix<local_scalar_t__,-1,1> lambda_cf_male =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lambda_cf_male_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> lambda_cf_male_flat__;
        current_statement__ = 15;
        lambda_cf_male_flat__ = context__.vals_r("lambda_cf_male");
        current_statement__ = 15;
        pos__ = 1;
        current_statement__ = 15;
        for (int sym1__ = 1; sym1__ <= lambda_cf_male_1dim__; ++sym1__) {
          current_statement__ = 15;
          stan::model::assign(lambda_cf_male, lambda_cf_male_flat__[(pos__ -
            1)], "assigning variable lambda_cf_male",
            stan::model::index_uni(sym1__));
          current_statement__ = 15;
          pos__ = (pos__ + 1);
        }
      }
      out__.write_free_lb(0, lambda_cf_male);
      Eigen::Matrix<local_scalar_t__,-1,1> lambda_inc =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lambda_inc_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> lambda_inc_flat__;
        current_statement__ = 16;
        lambda_inc_flat__ = context__.vals_r("lambda_inc");
        current_statement__ = 16;
        pos__ = 1;
        current_statement__ = 16;
        for (int sym1__ = 1; sym1__ <= lambda_inc_1dim__; ++sym1__) {
          current_statement__ = 16;
          stan::model::assign(lambda_inc, lambda_inc_flat__[(pos__ - 1)],
            "assigning variable lambda_inc", stan::model::index_uni(sym1__));
          current_statement__ = 16;
          pos__ = (pos__ + 1);
        }
      }
      out__.write_free_lb(0, lambda_inc);
      Eigen::Matrix<local_scalar_t__,-1,1> lambda_rem =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(lambda_rem_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> lambda_rem_flat__;
        current_statement__ = 17;
        lambda_rem_flat__ = context__.vals_r("lambda_rem");
        current_statement__ = 17;
        pos__ = 1;
        current_statement__ = 17;
        for (int sym1__ = 1; sym1__ <= lambda_rem_1dim__; ++sym1__) {
          current_statement__ = 17;
          stan::model::assign(lambda_rem, lambda_rem_flat__[(pos__ - 1)],
            "assigning variable lambda_rem", stan::model::index_uni(sym1__));
          current_statement__ = 17;
          pos__ = (pos__ + 1);
        }
      }
      out__.write_free_lb(0, lambda_rem);
      std::vector<std::vector<local_scalar_t__>> prevzero =
        std::vector<std::vector<local_scalar_t__>>(prevzero_1dim__,
          std::vector<local_scalar_t__>(ng, DUMMY_VAR__));
      {
        std::vector<local_scalar_t__> prevzero_flat__;
        current_statement__ = 18;
        prevzero_flat__ = context__.vals_r("prevzero");
        current_statement__ = 18;
        pos__ = 1;
        current_statement__ = 18;
        for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
          current_statement__ = 18;
          for (int sym2__ = 1; sym2__ <= prevzero_1dim__; ++sym2__) {
            current_statement__ = 18;
            stan::model::assign(prevzero, prevzero_flat__[(pos__ - 1)],
              "assigning variable prevzero", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            current_statement__ = 18;
            pos__ = (pos__ + 1);
          }
        }
      }
      out__.write_free_lub(0, 1, prevzero);
    } 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>{"inc_par", "rem_par", "barea",
                "barea_slope", "barea_inter", "bmale", "lcfbase", "beta_inc",
                "beta_rem", "mean_inter", "sd_inter", "mean_slope",
                "sd_slope", "lambda_cf", "lambda_cf_male", "lambda_inc",
                "lambda_rem", "prevzero"};
    if (emit_transformed_parameters__) {
      std::vector<std::string>
        temp{"inc", "cf", "dcf", "inc_prob", "prev_prob", "mort_prob", "rem",
             "rem_prob", "cf_prob", "state_probs", "tmp", "P", "sdint_use",
             "sdslope_use", "bareat", "beta", "lambda_cf_use",
             "lambda_cf_male_use", "lambda_inc_use", "lambda_rem_use",
             "lcfbase_use"};
      names__.reserve(names__.size() + temp.size());
      names__.insert(names__.end(), temp.begin(), temp.end());
    }
    if (emit_generated_quantities__) {
      std::vector<std::string>
        temp{"ll_mort", "ll_inc", "ll_prev", "ll_rem", "ll_overall", "i"};
      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>(
                                                                    inc_par_1dim__),
                                                 static_cast<size_t>(narea),
                                                 static_cast<size_t>(ng)},
                std::vector<size_t>{static_cast<size_t>(rem_par_1dim__),
                  static_cast<size_t>(ng)},
                std::vector<size_t>{static_cast<size_t>(barea_1dim__),
                  static_cast<size_t>(barea_2dim__)},
                std::vector<size_t>{static_cast<size_t>(barea_slope_1dim__),
                  static_cast<size_t>(barea_slope_2dim__)},
                std::vector<size_t>{static_cast<size_t>(1),
                  static_cast<size_t>(barea_inter_2dim__)},
                std::vector<size_t>{static_cast<size_t>(bmale_1dim__)},
                std::vector<size_t>{static_cast<size_t>(lcfbase_1dim__)},
                std::vector<size_t>{static_cast<size_t>(beta_inc_1dim__),
                  static_cast<size_t>(narea), static_cast<size_t>(ng)},
                std::vector<size_t>{static_cast<size_t>(beta_rem_1dim__),
                  static_cast<size_t>(narea), static_cast<size_t>(ng)},
                std::vector<size_t>{},
                std::vector<size_t>{static_cast<size_t>(sd_inter_1dim__)},
                std::vector<size_t>{static_cast<size_t>(mean_slope_1dim__)},
                std::vector<size_t>{static_cast<size_t>(sd_slope_1dim__)},
                std::vector<size_t>{static_cast<size_t>(lambda_cf_1dim__)},
                std::vector<size_t>{static_cast<size_t>(lambda_cf_male_1dim__)},
                std::vector<size_t>{static_cast<size_t>(lambda_inc_1dim__)},
                std::vector<size_t>{static_cast<size_t>(lambda_rem_1dim__)},
                std::vector<size_t>{static_cast<size_t>(prevzero_1dim__),
                  static_cast<size_t>(ng)}};
    if (emit_transformed_parameters__) {
      std::vector<std::vector<size_t>>
        temp{std::vector<size_t>{static_cast<size_t>(nage),
               static_cast<size_t>(narea), static_cast<size_t>(ng)},
             std::vector<size_t>{static_cast<size_t>(nage),
               static_cast<size_t>(narea), static_cast<size_t>(ng)},
             std::vector<size_t>{static_cast<size_t>(dcf_1dim__),
               static_cast<size_t>(narea), static_cast<size_t>(ng)},
             std::vector<size_t>{static_cast<size_t>(nage),
               static_cast<size_t>(narea), static_cast<size_t>(ng)},
             std::vector<size_t>{static_cast<size_t>(nage),
               static_cast<size_t>(narea), static_cast<size_t>(ng)},
             std::vector<size_t>{static_cast<size_t>(nage),
               static_cast<size_t>(narea), static_cast<size_t>(ng)},
             std::vector<size_t>{static_cast<size_t>(nage),
               static_cast<size_t>(narea), static_cast<size_t>(ng)},
             std::vector<size_t>{static_cast<size_t>(rem_prob_1dim__),
               static_cast<size_t>(narea), static_cast<size_t>(ng)},
             std::vector<size_t>{static_cast<size_t>(nage),
               static_cast<size_t>(narea), static_cast<size_t>(ng)},
             std::vector<size_t>{static_cast<size_t>(state_probs_1dim__),
               static_cast<size_t>(narea), static_cast<size_t>(ng),
               static_cast<size_t>(3)},
             std::vector<size_t>{static_cast<size_t>(3)},
             std::vector<size_t>{static_cast<size_t>(3),
               static_cast<size_t>(3)}, std::vector<size_t>{},
             std::vector<size_t>{},
             std::vector<size_t>{static_cast<size_t>(K),
               static_cast<size_t>(narea)},
             std::vector<size_t>{static_cast<size_t>(K),
               static_cast<size_t>(narea), static_cast<size_t>(ng)},
             std::vector<size_t>{}, std::vector<size_t>{},
             std::vector<size_t>{}, std::vector<size_t>{},
             std::vector<size_t>{static_cast<size_t>(lcfbase_use_1dim__)}};
      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>{static_cast<size_t>(ll_mort_1dim__)},
             std::vector<size_t>{static_cast<size_t>(ll_inc_1dim__)},
             std::vector<size_t>{static_cast<size_t>(ll_prev_1dim__)},
             std::vector<size_t>{static_cast<size_t>(ll_rem_1dim__)},
             std::vector<size_t>{static_cast<size_t>(ll_overall_1dim__)},
             std::vector<size_t>{}};
      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__ <= ng; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
        for (int sym3__ = 1; sym3__ <= inc_par_1dim__; ++sym3__) {
          param_names__.emplace_back(std::string() + "inc_par" + '.' +
            std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
            std::to_string(sym1__));
        }
      }
    }
    for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= rem_par_1dim__; ++sym2__) {
        param_names__.emplace_back(std::string() + "rem_par" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= barea_2dim__; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= barea_1dim__; ++sym2__) {
        param_names__.emplace_back(std::string() + "barea" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= barea_slope_2dim__; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= barea_slope_1dim__; ++sym2__) {
        param_names__.emplace_back(std::string() + "barea_slope" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= barea_inter_2dim__; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= 1; ++sym2__) {
        param_names__.emplace_back(std::string() + "barea_inter" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= bmale_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "bmale" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= lcfbase_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "lcfbase" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
        for (int sym3__ = 1; sym3__ <= beta_inc_1dim__; ++sym3__) {
          param_names__.emplace_back(std::string() + "beta_inc" + '.' +
            std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
            std::to_string(sym1__));
        }
      }
    }
    for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
        for (int sym3__ = 1; sym3__ <= beta_rem_1dim__; ++sym3__) {
          param_names__.emplace_back(std::string() + "beta_rem" + '.' +
            std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
            std::to_string(sym1__));
        }
      }
    }
    param_names__.emplace_back(std::string() + "mean_inter");
    for (int sym1__ = 1; sym1__ <= sd_inter_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "sd_inter" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= mean_slope_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "mean_slope" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= sd_slope_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "sd_slope" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= lambda_cf_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "lambda_cf" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= lambda_cf_male_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "lambda_cf_male" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= lambda_inc_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "lambda_inc" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= lambda_rem_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "lambda_rem" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= prevzero_1dim__; ++sym2__) {
        param_names__.emplace_back(std::string() + "prevzero" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    if (emit_transformed_parameters__) {
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "inc" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "cf" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= dcf_1dim__; ++sym3__) {
            param_names__.emplace_back(std::string() + "dcf" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "inc_prob" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "prev_prob" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "mort_prob" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "rem" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= rem_prob_1dim__; ++sym3__) {
            param_names__.emplace_back(std::string() + "rem_prob" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "cf_prob" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= 3; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= ng; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= narea; ++sym3__) {
            for (int sym4__ = 1; sym4__ <= state_probs_1dim__; ++sym4__) {
              param_names__.emplace_back(std::string() + "state_probs" + '.'
                + std::to_string(sym4__) + '.' + std::to_string(sym3__) + '.'
                + std::to_string(sym2__) + '.' + std::to_string(sym1__));
            }
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= 3; ++sym1__) {
        param_names__.emplace_back(std::string() + "tmp" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= 3; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= 3; ++sym2__) {
          param_names__.emplace_back(std::string() + "P" + '.' +
            std::to_string(sym2__) + '.' + std::to_string(sym1__));
        }
      }
      param_names__.emplace_back(std::string() + "sdint_use");
      param_names__.emplace_back(std::string() + "sdslope_use");
      for (int sym1__ = 1; sym1__ <= narea; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
          param_names__.emplace_back(std::string() + "bareat" + '.' +
            std::to_string(sym2__) + '.' + std::to_string(sym1__));
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= K; ++sym3__) {
            param_names__.emplace_back(std::string() + "beta" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      param_names__.emplace_back(std::string() + "lambda_cf_use");
      param_names__.emplace_back(std::string() + "lambda_cf_male_use");
      param_names__.emplace_back(std::string() + "lambda_inc_use");
      param_names__.emplace_back(std::string() + "lambda_rem_use");
      for (int sym1__ = 1; sym1__ <= lcfbase_use_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "lcfbase_use" + '.' +
          std::to_string(sym1__));
      }
    }
    if (emit_generated_quantities__) {
      for (int sym1__ = 1; sym1__ <= ll_mort_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "ll_mort" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ll_inc_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "ll_inc" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ll_prev_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "ll_prev" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ll_rem_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "ll_rem" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ll_overall_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "ll_overall" + '.' +
          std::to_string(sym1__));
      }
      param_names__.emplace_back(std::string() + "i");
    }
  }
  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__ <= ng; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
        for (int sym3__ = 1; sym3__ <= inc_par_1dim__; ++sym3__) {
          param_names__.emplace_back(std::string() + "inc_par" + '.' +
            std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
            std::to_string(sym1__));
        }
      }
    }
    for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= rem_par_1dim__; ++sym2__) {
        param_names__.emplace_back(std::string() + "rem_par" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= barea_2dim__; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= barea_1dim__; ++sym2__) {
        param_names__.emplace_back(std::string() + "barea" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= barea_slope_2dim__; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= barea_slope_1dim__; ++sym2__) {
        param_names__.emplace_back(std::string() + "barea_slope" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= barea_inter_2dim__; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= 1; ++sym2__) {
        param_names__.emplace_back(std::string() + "barea_inter" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    for (int sym1__ = 1; sym1__ <= bmale_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "bmale" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= lcfbase_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "lcfbase" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
        for (int sym3__ = 1; sym3__ <= beta_inc_1dim__; ++sym3__) {
          param_names__.emplace_back(std::string() + "beta_inc" + '.' +
            std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
            std::to_string(sym1__));
        }
      }
    }
    for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
        for (int sym3__ = 1; sym3__ <= beta_rem_1dim__; ++sym3__) {
          param_names__.emplace_back(std::string() + "beta_rem" + '.' +
            std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
            std::to_string(sym1__));
        }
      }
    }
    param_names__.emplace_back(std::string() + "mean_inter");
    for (int sym1__ = 1; sym1__ <= sd_inter_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "sd_inter" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= mean_slope_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "mean_slope" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= sd_slope_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "sd_slope" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= lambda_cf_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "lambda_cf" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= lambda_cf_male_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "lambda_cf_male" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= lambda_inc_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "lambda_inc" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= lambda_rem_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "lambda_rem" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= prevzero_1dim__; ++sym2__) {
        param_names__.emplace_back(std::string() + "prevzero" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    if (emit_transformed_parameters__) {
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "inc" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "cf" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= dcf_1dim__; ++sym3__) {
            param_names__.emplace_back(std::string() + "dcf" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "inc_prob" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "prev_prob" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "mort_prob" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "rem" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= rem_prob_1dim__; ++sym3__) {
            param_names__.emplace_back(std::string() + "rem_prob" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= nage; ++sym3__) {
            param_names__.emplace_back(std::string() + "cf_prob" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= 3; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= ng; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= narea; ++sym3__) {
            for (int sym4__ = 1; sym4__ <= state_probs_1dim__; ++sym4__) {
              param_names__.emplace_back(std::string() + "state_probs" + '.'
                + std::to_string(sym4__) + '.' + std::to_string(sym3__) + '.'
                + std::to_string(sym2__) + '.' + std::to_string(sym1__));
            }
          }
        }
      }
      for (int sym1__ = 1; sym1__ <= 3; ++sym1__) {
        param_names__.emplace_back(std::string() + "tmp" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= 3; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= 3; ++sym2__) {
          param_names__.emplace_back(std::string() + "P" + '.' +
            std::to_string(sym2__) + '.' + std::to_string(sym1__));
        }
      }
      param_names__.emplace_back(std::string() + "sdint_use");
      param_names__.emplace_back(std::string() + "sdslope_use");
      for (int sym1__ = 1; sym1__ <= narea; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= K; ++sym2__) {
          param_names__.emplace_back(std::string() + "bareat" + '.' +
            std::to_string(sym2__) + '.' + std::to_string(sym1__));
        }
      }
      for (int sym1__ = 1; sym1__ <= ng; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= narea; ++sym2__) {
          for (int sym3__ = 1; sym3__ <= K; ++sym3__) {
            param_names__.emplace_back(std::string() + "beta" + '.' +
              std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' +
              std::to_string(sym1__));
          }
        }
      }
      param_names__.emplace_back(std::string() + "lambda_cf_use");
      param_names__.emplace_back(std::string() + "lambda_cf_male_use");
      param_names__.emplace_back(std::string() + "lambda_inc_use");
      param_names__.emplace_back(std::string() + "lambda_rem_use");
      for (int sym1__ = 1; sym1__ <= lcfbase_use_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "lcfbase_use" + '.' +
          std::to_string(sym1__));
      }
    }
    if (emit_generated_quantities__) {
      for (int sym1__ = 1; sym1__ <= ll_mort_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "ll_mort" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ll_inc_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "ll_inc" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ll_prev_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "ll_prev" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ll_rem_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "ll_rem" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ll_overall_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "ll_overall" + '.' +
          std::to_string(sym1__));
      }
      param_names__.emplace_back(std::string() + "i");
    }
  }
  inline std::string get_constrained_sizedtypes() const {
    return std::string("[{\"name\":\"inc_par\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(inc_par_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"parameters\"},{\"name\":\"rem_par\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(rem_par_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}},\"block\":\"parameters\"},{\"name\":\"barea\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(barea_1dim__) + ",\"cols\":" + std::to_string(barea_2dim__) + "},\"block\":\"parameters\"},{\"name\":\"barea_slope\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(barea_slope_1dim__) + ",\"cols\":" + std::to_string(barea_slope_2dim__) + "},\"block\":\"parameters\"},{\"name\":\"barea_inter\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(1) + ",\"cols\":" + std::to_string(barea_inter_2dim__) + "},\"block\":\"parameters\"},{\"name\":\"bmale\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(bmale_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"lcfbase\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(lcfbase_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"beta_inc\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(beta_inc_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"parameters\"},{\"name\":\"beta_rem\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(beta_rem_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"parameters\"},{\"name\":\"mean_inter\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sd_inter\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(sd_inter_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"mean_slope\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(mean_slope_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"sd_slope\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(sd_slope_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"lambda_cf\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(lambda_cf_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"lambda_cf_male\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(lambda_cf_male_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"lambda_inc\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(lambda_inc_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"lambda_rem\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(lambda_rem_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"prevzero\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(prevzero_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}},\"block\":\"parameters\"},{\"name\":\"inc\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"cf\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"dcf\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(dcf_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"inc_prob\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"prev_prob\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"mort_prob\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"rem\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"rem_prob\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(rem_prob_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"cf_prob\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"state_probs\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(state_probs_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(3) + "}}}},\"block\":\"transformed_parameters\"},{\"name\":\"tmp\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(3) + "},\"block\":\"transformed_parameters\"},{\"name\":\"P\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(3) + ",\"cols\":" + std::to_string(3) + "},\"block\":\"transformed_parameters\"},{\"name\":\"sdint_use\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"sdslope_use\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"bareat\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(K) + ",\"cols\":" + std::to_string(narea) + "},\"block\":\"transformed_parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"lambda_cf_use\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"lambda_cf_male_use\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"lambda_inc_use\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"lambda_rem_use\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"lcfbase_use\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(lcfbase_use_1dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"ll_mort\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ll_mort_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"ll_inc\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ll_inc_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"ll_prev\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ll_prev_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"ll_rem\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ll_rem_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"ll_overall\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ll_overall_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"i\",\"type\":{\"name\":\"int\"},\"block\":\"generated_quantities\"}]");
  }
  inline std::string get_unconstrained_sizedtypes() const {
    return std::string("[{\"name\":\"inc_par\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(inc_par_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"parameters\"},{\"name\":\"rem_par\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(rem_par_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}},\"block\":\"parameters\"},{\"name\":\"barea\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(barea_1dim__) + ",\"cols\":" + std::to_string(barea_2dim__) + "},\"block\":\"parameters\"},{\"name\":\"barea_slope\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(barea_slope_1dim__) + ",\"cols\":" + std::to_string(barea_slope_2dim__) + "},\"block\":\"parameters\"},{\"name\":\"barea_inter\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(1) + ",\"cols\":" + std::to_string(barea_inter_2dim__) + "},\"block\":\"parameters\"},{\"name\":\"bmale\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(bmale_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"lcfbase\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(lcfbase_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"beta_inc\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(beta_inc_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"parameters\"},{\"name\":\"beta_rem\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(beta_rem_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"parameters\"},{\"name\":\"mean_inter\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sd_inter\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(sd_inter_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"mean_slope\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(mean_slope_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"sd_slope\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(sd_slope_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"lambda_cf\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(lambda_cf_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"lambda_cf_male\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(lambda_cf_male_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"lambda_inc\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(lambda_inc_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"lambda_rem\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(lambda_rem_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"prevzero\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(prevzero_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}},\"block\":\"parameters\"},{\"name\":\"inc\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"cf\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"dcf\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(dcf_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"inc_prob\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"prev_prob\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"mort_prob\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"rem\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"rem_prob\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(rem_prob_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"cf_prob\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(nage) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"state_probs\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(state_probs_1dim__) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(3) + "}}}},\"block\":\"transformed_parameters\"},{\"name\":\"tmp\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(3) + "},\"block\":\"transformed_parameters\"},{\"name\":\"P\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(3) + ",\"cols\":" + std::to_string(3) + "},\"block\":\"transformed_parameters\"},{\"name\":\"sdint_use\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"sdslope_use\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"bareat\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(K) + ",\"cols\":" + std::to_string(narea) + "},\"block\":\"transformed_parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(narea) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(ng) + ",\"element_type\":{\"name\":\"real\"}}}},\"block\":\"transformed_parameters\"},{\"name\":\"lambda_cf_use\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"lambda_cf_male_use\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"lambda_inc_use\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"lambda_rem_use\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"lcfbase_use\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(lcfbase_use_1dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"ll_mort\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ll_mort_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"ll_inc\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ll_inc_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"ll_prev\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ll_prev_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"ll_rem\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ll_rem_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"ll_overall\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ll_overall_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"i\",\"type\":{\"name\":\"int\"},\"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__ = (((((((((((((((((((inc_par_1dim__ * narea) *
      ng) + (rem_par_1dim__ * ng)) + (barea_1dim__ * barea_2dim__)) +
      (barea_slope_1dim__ * barea_slope_2dim__)) + (1 * barea_inter_2dim__))
      + bmale_1dim__) + lcfbase_1dim__) + ((beta_inc_1dim__ * narea) * ng)) +
      ((beta_rem_1dim__ * narea) * ng)) + 1) + sd_inter_1dim__) +
      mean_slope_1dim__) + sd_slope_1dim__) + lambda_cf_1dim__) +
      lambda_cf_male_1dim__) + lambda_inc_1dim__) + lambda_rem_1dim__) +
      (prevzero_1dim__ * ng));
    const size_t num_transformed = emit_transformed_parameters *
      (((((((((((((((((((((((nage * narea) * ng) + ((nage * narea) * ng)) +
      ((dcf_1dim__ * narea) * ng)) + ((nage * narea) * ng)) + ((nage * narea)
      * ng)) + ((nage * narea) * ng)) + ((nage * narea) * ng)) +
      ((rem_prob_1dim__ * narea) * ng)) + ((nage * narea) * ng)) +
      (((state_probs_1dim__ * narea) * ng) * 3)) + 3) + (3 * 3)) + 1) + 1) +
      (K * narea)) + ((K * narea) * ng)) + 1) + 1) + 1) + 1) +
      lcfbase_use_1dim__));
    const size_t num_gen_quantities = emit_generated_quantities *
      ((((((ll_mort_1dim__ + ll_inc_1dim__) + ll_prev_1dim__) +
      ll_rem_1dim__) + ll_overall_1dim__) + 1));
    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__ = (((((((((((((((((((inc_par_1dim__ * narea) *
      ng) + (rem_par_1dim__ * ng)) + (barea_1dim__ * barea_2dim__)) +
      (barea_slope_1dim__ * barea_slope_2dim__)) + (1 * barea_inter_2dim__))
      + bmale_1dim__) + lcfbase_1dim__) + ((beta_inc_1dim__ * narea) * ng)) +
      ((beta_rem_1dim__ * narea) * ng)) + 1) + sd_inter_1dim__) +
      mean_slope_1dim__) + sd_slope_1dim__) + lambda_cf_1dim__) +
      lambda_cf_male_1dim__) + lambda_inc_1dim__) + lambda_rem_1dim__) +
      (prevzero_1dim__ * ng));
    const size_t num_transformed = emit_transformed_parameters *
      (((((((((((((((((((((((nage * narea) * ng) + ((nage * narea) * ng)) +
      ((dcf_1dim__ * narea) * ng)) + ((nage * narea) * ng)) + ((nage * narea)
      * ng)) + ((nage * narea) * ng)) + ((nage * narea) * ng)) +
      ((rem_prob_1dim__ * narea) * ng)) + ((nage * narea) * ng)) +
      (((state_probs_1dim__ * narea) * ng) * 3)) + 3) + (3 * 3)) + 1) + 1) +
      (K * narea)) + ((K * narea) * ng)) + 1) + 1) + 1) + 1) +
      lcfbase_use_1dim__));
    const size_t num_gen_quantities = emit_generated_quantities *
      ((((((ll_mort_1dim__ + ll_inc_1dim__) + ll_prev_1dim__) +
      ll_rem_1dim__) + ll_overall_1dim__) + 1));
    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 = model_disbayes_hier_namespace::model_disbayes_hier;
#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 model_disbayes_hier_namespace::profiles__;
}
#endif
#endif
