Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.11 KB | None | 0 0
  1. Last login: Tue Jun 28 15:06:37 on ttys003
  2. Mikes-MacBook-Air:~ mike$ R
  3.  
  4. R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
  5. Copyright (C) 2015 The R Foundation for Statistical Computing
  6. Platform: x86_64-apple-darwin13.4.0 (64-bit)
  7.  
  8. R is free software and comes with ABSOLUTELY NO WARRANTY.
  9. You are welcome to redistribute it under certain conditions.
  10. Type 'license()' or 'licence()' for distribution details.
  11.  
  12. Natural language support but running in an English locale
  13.  
  14. R is a collaborative project with many contributors.
  15. Type 'contributors()' for more information and
  16. 'citation()' on how to cite R or R packages in publications.
  17.  
  18. Type 'demo()' for some demos, 'help()' for on-line help, or
  19. 'help.start()' for an HTML browser interface to help.
  20. Type 'q()' to quit R.
  21.  
  22. > setwd("~/_/Programming/bayes_days/01_one_group1")
  23. > model = rstan::stan_model(file='01_one_group1.stan')
  24. In file included from file404625e1dd5.cpp:8:
  25. In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
  26. In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math.hpp:4:
  27. In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:8:
  28. In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/mat.hpp:232:
  29. In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/arr.hpp:33:
  30. /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/arr/functor/integrate_ode_rk45.hpp:81:37: error: no member named 'max_step_checker' in namespace 'boost::numeric::odeint'
  31. using boost::numeric::odeint::max_step_checker;
  32. ~~~~~~~~~~~~~~~~~~~~~~~~^
  33. /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/arr/functor/integrate_ode_rk45.hpp:136:23: error: use of undeclared identifier 'max_step_checker'
  34. max_step_checker(max_num_steps));
  35. ^
  36. 2 errors generated.
  37. make: *** [file404625e1dd5.o] Error 1
  38.  
  39. ERROR(s) during compilation: source code errors or compiler configuration errors!
  40.  
  41. Program source:
  42. 1:
  43. 2: // includes from the plugin
  44. 3:
  45. 4:
  46. 5: // user includes
  47. 6: #define STAN__SERVICES__COMMAND_HPP// Code generated by Stan version 2.10
  48. 7:
  49. 8: #include <stan/model/model_header.hpp>
  50. 9:
  51. 10: namespace model4046f818d37_01_one_group1_namespace {
  52. 11:
  53. 12: using std::istream;
  54. 13: using std::string;
  55. 14: using std::stringstream;
  56. 15: using std::vector;
  57. 16: using stan::io::dump;
  58. 17: using stan::math::lgamma;
  59. 18: using stan::model::prob_grad;
  60. 19: using namespace stan::math;
  61. 20:
  62. 21: typedef Eigen::Matrix<double,Eigen::Dynamic,1> vector_d;
  63. 22: typedef Eigen::Matrix<double,1,Eigen::Dynamic> row_vector_d;
  64. 23: typedef Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> matrix_d;
  65. 24:
  66. 25: static int current_statement_begin__;
  67. 26:
  68. 27: class model4046f818d37_01_one_group1 : public prob_grad {
  69. 28: private:
  70. 29: int nY;
  71. 30: vector_d Y;
  72. 31: public:
  73. 32: model4046f818d37_01_one_group1(stan::io::var_context& context__,
  74. 33: std::ostream* pstream__ = 0)
  75. 34: : prob_grad(0) {
  76. 35: current_statement_begin__ = -1;
  77. 36:
  78. 37: static const char* function__ = "model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1";
  79. 38: (void) function__; // dummy call to supress warning
  80. 39: size_t pos__;
  81. 40: (void) pos__; // dummy call to supress warning
  82. 41: std::vector<int> vals_i__;
  83. 42: std::vector<double> vals_r__;
  84. 43: context__.validate_dims("data initialization", "nY", "int", context__.to_vec());
  85. 44: nY = int(0);
  86. 45: vals_i__ = context__.vals_i("nY");
  87. 46: pos__ = 0;
  88. 47: nY = vals_i__[pos__++];
  89. 48: validate_non_negative_index("Y", "nY", nY);
  90. 49: Y = vector_d(static_cast<Eigen::VectorXd::Index>(nY));
  91. 50: context__.validate_dims("data initialization", "Y", "vector_d", context__.to_vec(nY));
  92. 51: vals_r__ = context__.vals_r("Y");
  93. 52: pos__ = 0;
  94. 53: size_t Y_i_vec_lim__ = nY;
  95. 54: for (size_t i_vec__ = 0; i_vec__ < Y_i_vec_lim__; ++i_vec__) {
  96. 55: Y[i_vec__] = vals_r__[pos__++];
  97. 56: }
  98. 57:
  99. 58: // validate data
  100. 59:
  101. 60: double DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  102. 61: (void) DUMMY_VAR__; // suppress unused var warning
  103. 62:
  104. 63:
  105. 64: // initialize transformed variables to avoid seg fault on val access
  106. 65:
  107. 66: try {
  108. 67: } catch (const std::exception& e) {
  109. 68: stan::lang::rethrow_located(e,current_statement_begin__);
  110. 69: // Next line prevents compiler griping about no return
  111. 70: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
  112. 71: }
  113. 72:
  114. 73: // validate transformed data
  115. 74:
  116. 75: // set parameter ranges
  117. 76: num_params_r__ = 0U;
  118. 77: param_ranges_i__.clear();
  119. 78: ++num_params_r__;
  120. 79: }
  121. 80:
  122. 81: ~model4046f818d37_01_one_group1() { }
  123. 82:
  124. 83:
  125. 84: void transform_inits(const stan::io::var_context& context__,
  126. 85: std::vector<int>& params_i__,
  127. 86: std::vector<double>& params_r__,
  128. 87: std::ostream* pstream__) const {
  129. 88: stan::io::writer<double> writer__(params_r__,params_i__);
  130. 89: size_t pos__;
  131. 90: (void) pos__; // dummy call to supress warning
  132. 91: std::vector<double> vals_r__;
  133. 92: std::vector<int> vals_i__;
  134. 93:
  135. 94: if (!(context__.contains_r("mu")))
  136. 95: throw std::runtime_error("variable mu missing");
  137. 96: vals_r__ = context__.vals_r("mu");
  138. 97: pos__ = 0U;
  139. 98: context__.validate_dims("initialization", "mu", "double", context__.to_vec());
  140. 99: double mu(0);
  141. 100: mu = vals_r__[pos__++];
  142. 101: try {
  143. 102: writer__.scalar_unconstrain(mu);
  144. 103: } catch (const std::exception& e) {
  145. 104: throw std::runtime_error(std::string("Error transforming variable mu: ") + e.what());
  146. 105: }
  147. 106:
  148. 107: params_r__ = writer__.data_r();
  149. 108: params_i__ = writer__.data_i();
  150. 109: }
  151. 110:
  152. 111: void transform_inits(const stan::io::var_context& context,
  153. 112: Eigen::Matrix<double,Eigen::Dynamic,1>& params_r,
  154. 113: std::ostream* pstream__) const {
  155. 114: std::vector<double> params_r_vec;
  156. 115: std::vector<int> params_i_vec;
  157. 116: transform_inits(context, params_i_vec, params_r_vec, pstream__);
  158. 117: params_r.resize(params_r_vec.size());
  159. 118: for (int i = 0; i < params_r.size(); ++i)
  160. 119: params_r(i) = params_r_vec[i];
  161. 120: }
  162. 121:
  163. 122:
  164. 123: template <bool propto__, bool jacobian__, typename T__>
  165. 124: T__ log_prob(vector<T__>& params_r__,
  166. 125: vector<int>& params_i__,
  167. 126: std::ostream* pstream__ = 0) const {
  168. 127:
  169. 128: T__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  170. 129: (void) DUMMY_VAR__; // suppress unused var warning
  171. 130:
  172. 131: T__ lp__(0.0);
  173. 132: stan::math::accumulator<T__> lp_accum__;
  174. 133:
  175. 134: // model parameters
  176. 135: stan::io::reader<T__> in__(params_r__,params_i__);
  177. 136:
  178. 137: T__ mu;
  179. 138: (void) mu; // dummy to suppress unused var warning
  180. 139: if (jacobian__)
  181. 140: mu = in__.scalar_constrain(lp__);
  182. 141: else
  183. 142: mu = in__.scalar_constrain();
  184. 143:
  185. 144:
  186. 145: // transformed parameters
  187. 146:
  188. 147: // initialize transformed variables to avoid seg fault on val access
  189. 148:
  190. 149: try {
  191. 150: } catch (const std::exception& e) {
  192. 151: stan::lang::rethrow_located(e,current_statement_begin__);
  193. 152: // Next line prevents compiler griping about no return
  194. 153: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
  195. 154: }
  196. 155:
  197. 156: // validate transformed parameters
  198. 157:
  199. 158: const char* function__ = "validate transformed params";
  200. 159: (void) function__; // dummy to suppress unused var warning
  201. 160:
  202. 161: // model body
  203. 162: try {
  204. 163: current_statement_begin__ = 10;
  205. 164: lp_accum__.add(normal_log<propto__>(mu, 100, 20));
  206. 165: current_statement_begin__ = 11;
  207. 166: lp_accum__.add(normal_log<propto__>(Y, mu, 15));
  208. 167: } catch (const std::exception& e) {
  209. 168: stan::lang::rethrow_located(e,current_statement_begin__);
  210. 169: // Next line prevents compiler griping about no return
  211. 170: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
  212. 171: }
  213. 172:
  214. 173: lp_accum__.add(lp__);
  215. 174: return lp_accum__.sum();
  216. 175:
  217. 176: } // log_prob()
  218. 177:
  219. 178: template <bool propto, bool jacobian, typename T_>
  220. 179: T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r,
  221. 180: std::ostream* pstream = 0) const {
  222. 181: std::vector<T_> vec_params_r;
  223. 182: vec_params_r.reserve(params_r.size());
  224. 183: for (int i = 0; i < params_r.size(); ++i)
  225. 184: vec_params_r.push_back(params_r(i));
  226. 185: std::vector<int> vec_params_i;
  227. 186: return log_prob<propto,jacobian,T_>(vec_params_r, vec_params_i, pstream);
  228. 187: }
  229. 188:
  230. 189:
  231. 190: void get_param_names(std::vector<std::string>& names__) const {
  232. 191: names__.resize(0);
  233. 192: names__.push_back("mu");
  234. 193: }
  235. 194:
  236. 195:
  237. 196: void get_dims(std::vector<std::vector<size_t> >& dimss__) const {
  238. 197: dimss__.resize(0);
  239. 198: std::vector<size_t> dims__;
  240. 199: dims__.resize(0);
  241. 200: dimss__.push_back(dims__);
  242. 201: }
  243. 202:
  244. 203: template <typename RNG>
  245. 204: void write_array(RNG& base_rng__,
  246. 205: std::vector<double>& params_r__,
  247. 206: std::vector<int>& params_i__,
  248. 207: std::vector<double>& vars__,
  249. 208: bool include_tparams__ = true,
  250. 209: bool include_gqs__ = true,
  251. 210: std::ostream* pstream__ = 0) const {
  252. 211: vars__.resize(0);
  253. 212: stan::io::reader<double> in__(params_r__,params_i__);
  254. 213: static const char* function__ = "model4046f818d37_01_one_group1_namespace::write_array";
  255. 214: (void) function__; // dummy call to supress warning
  256. 215: // read-transform, write parameters
  257. 216: double mu = in__.scalar_constrain();
  258. 217: vars__.push_back(mu);
  259. 218:
  260. 219: if (!include_tparams__) return;
  261. 220: // declare and define transformed parameters
  262. 221: double lp__ = 0.0;
  263. 222: (void) lp__; // dummy call to supress warning
  264. 223: stan::math::accumulator<double> lp_accum__;
  265. 224:
  266. 225:
  267. 226: try {
  268. 227: } catch (const std::exception& e) {
  269. 228: stan::lang::rethrow_located(e,current_statement_begin__);
  270. 229: // Next line prevents compiler griping about no return
  271. 230: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
  272. 231: }
  273. 232:
  274. 233: // validate transformed parameters
  275. 234:
  276. 235: // write transformed parameters
  277. 236:
  278. 237: if (!include_gqs__) return;
  279. 238: // declare and define generated quantities
  280. 239:
  281. 240: double DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  282. 241: (void) DUMMY_VAR__; // suppress unused var warning
  283. 242:
  284. 243:
  285. 244: // initialize transformed variables to avoid seg fault on val access
  286. 245:
  287. 246: try {
  288. 247: } catch (const std::exception& e) {
  289. 248: stan::lang::rethrow_located(e,current_statement_begin__);
  290. 249: // Next line prevents compiler griping about no return
  291. 250: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
  292. 251: }
  293. 252:
  294. 253: // validate generated quantities
  295. 254:
  296. 255: // write generated quantities
  297. 256: }
  298. 257:
  299. 258: template <typename RNG>
  300. 259: void write_array(RNG& base_rng,
  301. 260: Eigen::Matrix<double,Eigen::Dynamic,1>& params_r,
  302. 261: Eigen::Matrix<double,Eigen::Dynamic,1>& vars,
  303. 262: bool include_tparams = true,
  304. 263: bool include_gqs = true,
  305. 264: std::ostream* pstream = 0) const {
  306. 265: std::vector<double> params_r_vec(params_r.size());
  307. 266: for (int i = 0; i < params_r.size(); ++i)
  308. 267: params_r_vec[i] = params_r(i);
  309. 268: std::vector<double> vars_vec;
  310. 269: std::vector<int> params_i_vec;
  311. 270: write_array(base_rng,params_r_vec,params_i_vec,vars_vec,include_tparams,include_gqs,pstream);
  312. 271: vars.resize(vars_vec.size());
  313. 272: for (int i = 0; i < vars.size(); ++i)
  314. 273: vars(i) = vars_vec[i];
  315. 274: }
  316. 275:
  317. 276: static std::string model_name() {
  318. 277: return "model4046f818d37_01_one_group1";
  319. 278: }
  320. 279:
  321. 280:
  322. 281: void constrained_param_names(std::vector<std::string>& param_names__,
  323. 282: bool include_tparams__ = true,
  324. 283: bool include_gqs__ = true) const {
  325. 284: std::stringstream param_name_stream__;
  326. 285: param_name_stream__.str(std::string());
  327. 286: param_name_stream__ << "mu";
  328. 287: param_names__.push_back(param_name_stream__.str());
  329. 288:
  330. 289: if (!include_gqs__ && !include_tparams__) return;
  331. 290:
  332. 291: if (!include_gqs__) return;
  333. 292: }
  334. 293:
  335. 294:
  336. 295: void unconstrained_param_names(std::vector<std::string>& param_names__,
  337. 296: bool include_tparams__ = true,
  338. 297: bool include_gqs__ = true) const {
  339. 298: std::stringstream param_name_stream__;
  340. 299: param_name_stream__.str(std::string());
  341. 300: param_name_stream__ << "mu";
  342. 301: param_names__.push_back(param_name_stream__.str());
  343. 302:
  344. 303: if (!include_gqs__ && !include_tparams__) return;
  345. 304:
  346. 305: if (!include_gqs__) return;
  347. 306: }
  348. 307:
  349. 308: }; // model
  350. 309:
  351. 310: } // namespace
  352. 311:
  353. 312: typedef model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1 stan_model;
  354. 313:
  355. 314: #include <rstan/rstaninc.hpp>
  356. 315: /**
  357. 316: * Define Rcpp Module to expose stan_fit's functions to R.
  358. 317: */
  359. 318: RCPP_MODULE(stan_fit4model4046f818d37_01_one_group1_mod){
  360. 319: Rcpp::class_<rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1,
  361. 320: boost::random::ecuyer1988> >("stan_fit4model4046f818d37_01_one_group1")
  362. 321: // .constructor<Rcpp::List>()
  363. 322: .constructor<SEXP, SEXP>()
  364. 323: // .constructor<SEXP, SEXP>()
  365. 324: .method("call_sampler",
  366. 325: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::call_sampler)
  367. 326: .method("param_names",
  368. 327: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::param_names)
  369. 328: .method("param_names_oi",
  370. 329: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::param_names_oi)
  371. 330: .method("param_fnames_oi",
  372. 331: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::param_fnames_oi)
  373. 332: .method("param_dims",
  374. 333: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::param_dims)
  375. 334: .method("param_dims_oi",
  376. 335: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::param_dims_oi)
  377. 336: .method("update_param_oi",
  378. 337: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::update_param_oi)
  379. 338: .method("param_oi_tidx",
  380. 339: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::param_oi_tidx)
  381. 340: .method("grad_log_prob",
  382. 341: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::grad_log_prob)
  383. 342: .method("log_prob",
  384. 343: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::log_prob)
  385. 344: .method("unconstrain_pars",
  386. 345: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::unconstrain_pars)
  387. 346: .method("constrain_pars",
  388. 347: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::constrain_pars)
  389. 348: .method("num_pars_unconstrained",
  390. 349: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::num_pars_unconstrained)
  391. 350: .method("unconstrained_param_names",
  392. 351: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::unconstrained_param_names)
  393. 352: .method("constrained_param_names",
  394. 353: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::constrained_param_names)
  395. 354: ;
  396. 355: }
  397. 356:
  398. 357: // declarations
  399. 358: extern "C" {
  400. 359: SEXP file404625e1dd5( ) ;
  401. 360: }
  402. 361:
  403. 362: // definition
  404. 363:
  405. 364: SEXP file404625e1dd5( ){
  406. 365: return Rcpp::wrap("01_one_group1");
  407. 366: }
  408. 367:
  409. 368:
  410. Error in compileCode(f, code, language = language, verbose = verbose) :
  411. Compilation ERROR, function(s)/method(s) not created! In file included from file404625e1dd5.cpp:8:
  412. In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
  413. In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math.hpp:4:
  414. In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:8:
  415. In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/mat.hpp:232:
  416. In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/arr.hpp:33:
  417. /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/arr/functor/integrate_ode_rk45.hpp:81:37: error: no member named 'max_step_checker' in namespace 'boost::numeric::odeint'
  418. using bo
  419. In addition: Warning message:
  420. running command '/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file404625e1dd5.cpp 2> file404625e1dd5.cpp.err.txt' had status 1
  421. >
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement