I have a big complicated model that successfully builds and
when I do Rmodel$calculate(), I get a finite value as expected. But while I
compile, I get Error: Failed to create the shared library.
When I do printErrors(), it displays error: cannot convert
'NimArr<1, double>' to 'double'. It seems the problem might be related to
initializing a vector parameter where I want the first values to be fixed to
zero, values 3:7 to be informed by a prior, and vale 3 to be the mean of values
3:7.
In the model I specify the parameter as (note that the first
value is not filled in - also there are other similar prameters, but I think if I solve this one, I solve them all):
mu_m_gun ~ dgamma(1,1)
var_mf ~ dgamma(1,1)
for (k in 3:7) {
beta_m_gun[k] ~ dgamma(mu_m_gun**2 * var_mf, mu_m_gun/var_mf)
}
beta_m_gun[2] <- mean(beta_m_gun[3:7])
In inits and
data, following Daniel's recommendation in this post, I do:
inits = list(beta_m_gun = c(NA, rgamma(6,1,1)),
…, other stuff)
data = list(beta_m_gun
= c(0, rep(6,NA)), …, other stuff)
I'd appreciate if anyone can point out how or if I'm not specifiying this parameter correctly, or if something else might be going one.
Below is the relevant output from printErrors(), if it is helpful. Also this parameter is used insdie a nimble fuction, and I do correctly specify the type as double(1).
Thanks,
Glenn
> printErrors()
P_15_modelcode_nfCode.cpp: In member function 'virtual void y_icap_L78_UID_733::simulate(const indexedNodeInfo&) const':
P_15_modelcode_nfCode.cpp:13830:167: error: cannot convert 'NimArr<1, double>' to 'double'
13830 | (**model_y_icap)[0] = rcFun_R_GlobalEnv14(1, 63, Interm_4152, Interm_4153, Interm_4154, Interm_4155, Interm_4156, Interm_4157, Interm_4158, Interm_4159, Interm_4160, Interm_4161, Interm_4162, Interm_4163, Interm_4164, Interm_4165, Interm_4166, Interm_4167, Interm_4168, Interm_4169, Interm_4170, Interm_4171, Interm_4172, Interm_4173, Interm_4174, Interm_4175, Interm_4176, Interm_4177);
| ^~~~~~~~~~~
| |
| NimArr<1, double>
P_15_modelcode_nfCode.cpp:13250:326: note: initializing argument 12 of 'int rcFun_R_GlobalEnv14(int, int, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, double, double, double, double, double, double, double, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, NimArr<1, double>&, double)'
13250 | int rcFun_R_GlobalEnv14 ( int ARG1_n_, int ARG2_n_samples_, NimArr<1, double> & ARG3_e_, NimArr<1, double> & ARG4_r_, NimArr<1, double> & ARG5_s_, NimArr<1, double> & ARG6_z_, NimArr<1, double> & ARG7_sex_, NimArr<1, double> & ARG8_age2date_, double ARG9_beta0_sus_, double ARG10_beta0_inf_, double ARG11_beta_male_, double ARG12_beta_m_gun_, double ARG13_beta_f_gun_, double ARG14_beta_m_ng_, double ARG15_beta_f_ng_, NimArr<1, double> & ARG16_age_effect_surv_, NimArr<1, double> & ARG17_period_effect_surv_f_, NimArr<1, double> & ARG18_period_effect_surv_m_, NimArr<1, double> & ARG19_period_lookup_, NimArr<1, double> & ARG20_gun_lookup_, NimArr<1, double> & ARG21_ng_lookup_, NimArr<1, double> & ARG22_f_age_foi_, NimArr<1, double> & ARG23_m_age_foi_, NimArr<1, double> & ARG24_age_lookup_f_, NimArr<1, double> & ARG25_age_lookup_m_, NimArr<1, double> & ARG26_sect_, NimArr<1, double> & ARG27_space_, double ARG28_p_sens_ ) {
|