Hi Staners,

I am new to Stan and I have been having problems running my model. I am trying to apply the a spatial model using the model constructed for the lip cancer dataset.

When I apply the model to my own dataset, it works. However, when I copy, paste and save the codes of the model into a new stan file and run the model with the file, RStudio aborts. I have tried to figured out why but still in vain. I am hoping that someone here could please help me with this…

Here are the structure of these two model (stancar_prec works but not m_s1, which is my copy of it)

Formal class ‘stanmodel’ [package “rstan”] with 5 slots

…@ model_name : chr “stancar_prec”

…@ model_code : chr “data {\n int<lower = 1> n;\n int<lower = 1> p;\n matrix[n, p] X;\n int<lower = 0> y[n];\n vector[n] log_of”| **truncated**

… …- attr(*, “model_name2”)= chr “stancar_prec”

…@ model_cpp :List of 2

… … model_cppname: chr “model14e06b995cb9_stancar_prec”

… … model_cppcode: chr “// Code generated by Stan version 2.14\n\n#include <stan/model/model_header.hpp>\n\nnamespace model14e06b995cb9”| *truncated*

…@ mk_cppmodule:function (object)

…@ dso :Formal class ‘cxxdso’ [package “rstan”] with 7 slots

… … …@ sig :List of 1

… … … … file14e07e174f10: chr(0)

… … …@ dso_saved : logi TRUE

… … …@ dso_filename: chr “file14e07e174f10”

… … …@ modulename : chr “stan_fit4model14e06b995cb9_stancar_prec_mod”

… … …@ system : chr “x86_64, mingw32”

… … …@ cxxflags : chr “CXXFLAGS = -O2 -Wall $(DEBUGFLAG) -mtune=core2”

… … …@ .CXXDSOMISC :<environment: 0x00000217512ba7d8>

Formal class ‘stanmodel’ [package “rstan”] with 5 slots

…@ model_name : chr “m_s1”

…@ model_code : chr “data {\n int<lower = 1> n;\n int<lower = 1> p;\n matrix[n, p] X;\n int<lower = 0> y[n];\n vector[n] log_of”| *truncated*

… …- attr(*, “model_name2”)= chr “m_s1”

…@ model_cpp :List of 2

… … model_cppname: chr “model30287eaf4c0a_m_s1”

… … model_cppcode: chr “// Code generated by Stan version 2.18.1\n\n#include <stan/model/model_header.hpp>\n\nnamespace model30287eaf4c”| **truncated**

…@ mk_cppmodule:function (object)

…@ dso :Formal class ‘cxxdso’ [package “rstan”] with 7 slots

… … …@ sig :List of 1

… … … … file3028666915dc: chr(0)

… … …@ dso_saved : logi TRUE

… … …@ dso_filename: chr “file3028666915dc”

… … …@ modulename : chr “stan_fit4model30287eaf4c0a_m_s1_mod”

… … …@ system : chr “x86_64, mingw32”

… … …@ cxxflags : chr “CXXFLAGS = -O2 -Wall $(DEBUGFLAG) -mtune=generic”

… … …@ .CXXDSOMISC :<environment: 0x000002176e55a6f8>

I noticed that they have different cxxflags: mtune=core2 in stancar_prec and mtune=generic in m_s1. Can that be the reason? If yes, how can I resolve it? If not, what are other possibilities?

I really appreciate your help!

Regards

Kendy