Compiling problems for model of discretely observed continuous time Markov chain


#1

Operating System: Mac 10.12.6
Interface Version: Rstan 2.16.2
Using Rstudio: 1.0.153
Output of writeLines(readLines(file.path(Sys.getenv(“HOME”), “.R/Makevars”))):
CXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function

CC=clang
CXX=clang++ -arch x86_64 -ftemplate-depth-256

CXXFLAGS+=-flto -ffat-lto-objects -Wno-unused-local-typedefs

CXXFLAGS += -Wno-ignored-attributes -Wno-deprecated-declarations

Hi all,
New Stan user here. I am able to compile and run other people’s example STAN models, but am running into some trouble with my own.

The model fit to panel data generated by discrete observations from a continuous time Markov chain and has a custom likelihood function. I’ve linked the code to simulate data and the Rstan code below

To simulate data:
https://pastebin.com/embed_js/pMzQshxt
To run model in rstan:
https://pastebin.com/embed_js/ZeNXiGAe

When I run the model I get the following messages:

clang: warning: optimization flag ‘-ffat-lto-objects’ is not supported [-Wignored-optimization-argument]
In file included from file185f31d46b8c2.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:12:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/StanHeaders/include/stan/math/rev/core/gevv_vvv_vari.hpp:5:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/StanHeaders/include/stan/math/rev/core/var.hpp:7:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/BH/include/boost/math/tools/config.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/BH/include/boost/config.hpp:39:
/Library/Frameworks/R.framework/Versions/3.4/Resources/library/BH/include/boost/config/compiler/clang.hpp:200:11: warning: ‘BOOST_NO_CXX11_RVALUE_REFERENCES’ macro redefined [-Wmacro-redefined]

define BOOST_NO_CXX11_RVALUE_REFERENCES

      ^

:6:9: note: previous definition is here
#define BOOST_NO_CXX11_RVALUE_REFERENCES 1
^
1 warning generated.
trying deprecated constructor; please alert package maintainer
Error in new_CppObject_xp(fields$.module, fields$.pointer, …) :
no valid constructor available for the argument list
failed to create the sampler; sampling not done

Any idea what’s wrong?
Best,
Jane


#2

I’d suggest trying again with RStan 2.17. A bunch of the header stuff was cleaned up in 2.17. You have to make sure to use dependencies=TRUE to get the latest version of all the dependent libraries, too.