Hello,
I am writing a custom sampler and I get the following error message when trying to compile the MCMC,
> printErrors()
P_6_MCMC.cpp: In member function 'virtual void nfRefClass_R_GlobalEnv60::run()':
P_6_MCMC.cpp:1108:59: error: cannot convert 'NimArr<1, double>' to 'double' for argument '2' to 'double Rf_dnbinom(double, double, double, int)'
llen = dnbinom(Interm_763, (**model_r0), Interm_764, true);
^
P_6_MCMC.cpp:1116:59: error: cannot convert 'NimArr<1, double>' to 'double' for argument '2' to 'double Rf_dnbinom(double, double, double, int)'
llep = dnbinom(Interm_765, (**model_r1), Interm_766, true);
^
At global scope:
cc1plus.exe: warning: unrecognized command line option "-Wno-ignored-attributes"
cc1plus.exe: warning: unrecognized command line option "-Wno-misleading-indentation"
make: *** [C:/PROGRA~1/R/R-36~1.3/etc/x64/Makeconf:215: P_6_MCMC.o] Error 1
This seems to imply the issue is with the following two lines of the sampler,
llen <- dnbinom(x=model$y[loc,ct],size = model$r0 ,
prob = model$r0/(model$r0+model$lambda_en[loc,ct]),log =TRUE)
llep <- dnbinom(x=model$y[loc,ct],size = model$r1 ,
prob = model$r1/(model$r1+model$lambda_ep[loc,ct]),log =TRUE)
I need to do some density calculations for the sampler. It works fine uncompiled. I could just try to calculate the densities manually but I am worried about numerical errors as I am not sure how to calculate these densities safely. Any idea how to get the distribution functions to work?
Thanks!