Hello. I’m trying to compile my model after removing the ‘generate quantities’ block and it will not compile now.
The code of the model is below.
data {
int<lower=0> N; // number policy term years
int<lower=0> NonCatcvrcnt[N]; // claims
vector[N] alertflag; //alert flag
}
parameters {
real<lower=0> mu;
real beta;
}
model {
mu ~ normal(0,3);
beta ~ normal(0,1);
NonCatcvrcnt ~ poisson_log(mu + alertflag*beta);
}
The code to compile the model is below.
reinstatement_model = os.path.join(cmdstan_path(), 'examples', 'poisson', 'reinstatement.stan')
my_model = CmdStanModel(stan_file=reinstatement_model)
my_model.name
my_model.stan_file
my_model.exe_file
my_model.code()
The error being thrown is below.
my_model = CmdStanModel(stan_file=reinstatement_model)
INFO:cmdstanpy:compiling stan program, exe file: C:/Users/JORDAN.HOWELL.GITDIR/AppData/Local/Continuum/anaconda3/envs/cmdstan/Library/bin/cmdstan/examples/poisson/reinstatement.exe
INFO:cmdstanpy:compiler options: stanc_options={}, cpp_options={}
ERROR:cmdstanpy:file C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\cmdstan\Library\bin\cmdstan\examples\poisson\reinstatement.stan, exception Command: ['mingw32-make', 'C:/Users/JORDAN.HOWELL.GITDIR/AppData/Local/Continuum/anaconda3/envs/cmdstan/Library/bin/cmdstan/examples/poisson/reinstatement.exe']
failed, returncode: 2, error: No such file or directory, stderr: expr: syntax error
/usr/bin/sh: cl.exe: command not found
process_begin: CreateProcess(NULL, cl.exe -std=c++1y -m64 -D_REENTRANT -Wall -Wno-unused-function -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-variable -Wno-sign-compare -Wno-unused-local-typedefs -Wno-int-in-bool-context -Wno-attributes -Wno-ignored-attributes -I stan/lib/stan_math/lib/tbb_2020.3/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_5.7.0/include -D_USE_MATH_DEFINES -DBOOST_DISABLE_ASSERTS -c -x c++ -o C:/Users/JORDAN.HOWELL.GITDIR/AppData/Local/Continuum/anaconda3/envs/cmdstan/Library/bin/cmdstan/examples/poisson/reinstatement.o C:/Users/JORDAN.HOWELL.GITDIR/AppData/Local/Continuum/anaconda3/envs/cmdstan/Library/bin/cmdstan/examples/poisson/reinstatement.hpp, ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make: *** [C:/Users/JORDAN.HOWELL.GITDIR/AppData/Local/Continuum/anaconda3/envs/cmdstan/Library/bin/cmdstan/examples/poisson/reinstatement.exe] Error 2
ERROR:cmdstanpy:model compilation failed
Traceback (most recent call last):
File "C:\Users\JORDAN~1.GIT\AppData\Local\Temp/ipykernel_9424/3325553376.py", line 1, in <module>
my_model = CmdStanModel(stan_file=reinstatement_model)
File "C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\cmdstan\lib\site-packages\cmdstanpy\model.py", line 188, in __init__
raise ValueError(
ValueError: Unable to compile Stan model file: C:\Users\JORDAN.HOWELL.GITDIR\AppData\Local\Continuum\anaconda3\envs\cmdstan\Library\bin\cmdstan\examples\poisson\reinstatement.stan.
Is this a STAN syntax error? It compiled fine when I had the generated quantities block.