Skip to content

Instantly share code, notes, and snippets.

@herbps10
Last active September 22, 2022 16:51
Show Gist options
  • Save herbps10/219f08e93239a00c727482deb15cb1b1 to your computer and use it in GitHub Desktop.
Save herbps10/219f08e93239a00c727482deb15cb1b1 to your computer and use it in GitHub Desktop.
Minimum Reproducible Example: Stan Include File
Compiling Stan program...
Syntax error in '/var/folders/mw/nw_yn9hs0wd6flz32fwr81sh0000gn/T/RtmphVRHT8/model-9541147ec224.stan', line 2, column 0, include error:
-------------------------------------------------
1: functions {
2: #include multiply.stan
^
3: }
4: data {
-------------------------------------------------
Could not find include file multiply.stan in specified include paths.
make: *** [/var/folders/mw/nw_yn9hs0wd6flz32fwr81sh0000gn/T/RtmphVRHT8/model-9541147ec224.hpp] Error 1
Error: An error occured during compilation! See the message above for more information.
library(cmdstanr)
cmdstan_model("./model.stan")
cmdstan_model("./model.stan", include_paths = ".")
cmdstan_model("./model.stan", include_paths = "~/stanmre")
cmdstan_model("./model.stan", include_paths = "~/stanmre/")
cmdstan_model("./model.stan", include_paths = "/Users/herb/stanmre")
cmdstanr::cmdstan_version()
sessionInfo()
functions {
#include multiply.stan
}
data {
int<lower=0> N;
vector[N] y;
}
parameters {
real mu;
real<lower=0> sigma;
}
model {
y ~ normal(mu, sigma);
}
real multiply(real x, real y) {
return x * y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment