I am having trouble with an observation error model that won’t compile correctly in rstan despite being syntactically correct. The error I keep getting is:

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

It doesn’t even create a .RDS file

Here is the associated stan file (also attached):

data {

//provided data for a sample

int<lower = 1> N; //number of individuals

int<lower = 1> Sites; // number of sites

int<lower = 1> N_Msres; //number of measurements

int<lower = 1> Msre_Types; //number of different measurement types

int<lower = 1, upper = Sites> Site[N]; //what site is the individual from?

real msre_obs[N_Msres];

real<lower = 0> msre_sd[N_Msres];

real ref_obs[Msre_Types]; //reference values for the measurements

real<lower = 0> ref_sd[Msre_Types];

int<lower = 1, upper = Msre_Types> msre_num[N_Msres];

int<lower = 1, upper = N> msre_Indiv[N_Msres];

}

parameters {

vector<lower = 0>[N_Msres] Msre;

vector<lower = 0>[Msre_Types] Ref;

vector[N] LSI;

real<lower = 0> LSI_sd; //variation of LSI values within an individual

//modeling average LSI for a site

real mu_LSI;

vector<lower = 0>[Sites] site_sigma;

}

model {

real LSI_msre;

//measurement error

msre_obs ~ normal(Msre, msre_sd);

ref_obs ~ normal(Ref, ref_sd);

LSI_sd ~ normal(0, 0.05);

for(i in 1:N_Msres) {

LSI_msre = log(Msre[i] / Ref[msre_num[i]]);

LSI_msre ~ normal(LSI[msre_Indiv[i]], LSI_sd);

}

//modeling average LSI for a site

mu_LSI ~ normal(0, 1);

site_sigma ~ normal(0, 1);

for(i in 1:N) {

LSI[i] ~ normal(mu_LSI, site_sigma[Site[i]]);

}

}

Thank you!

Here is the script and an attached R script and associated data file.LSI_observationerror.stan (1.3 KB)

R Script for Error in Observation Model.R (1.2 KB)

Bos Size Dataset.csv (137.3 KB)