Hi,
I have the following stan model and running code but got the error messages. Would anyone please take a look and give some advice? Thank you very much!
trying deprecated constructor; please alert package maintainer
Error in new_CppObject_xp(fields$.module, fields$.pointer, …) :
no valid constructor available for the argument list
In addition: Warning message:
In if (nchar(CXX) > 0) return(TRUE) :
the condition has length > 1 and only the first element will be used
failed to create the sampler; sampling not done
’Data and running code’
stan_data <- list(
C = 2,
N = c(7,3),
DLT = c(1,0),
Dose = c(800,200),
Dose0 = 400,
D = 5,
Dose_set = c(100,200,400,600,800),
X1 = c(0,1),
X2 = c(0,1),
Mn = c(-3.025, 0.023),
SD_loga = 1.810,
SD_logb = 1.023,
Rho = -0.450,
Gamma_mu1 = 0,
Gamma_mu2 = -1.374,
Gamma_SD1 = 0.255,
Gamma_SD2 = 0.837
)
stanmodel <- stan_model(file=‘BLRM-mono-covariate-cohort.stan’)
fit <- sampling(stanmodel, data=stan_data, iter=6000, warmup=1000, seed=1234)
’BLRM-mono-covariate-cohort.stan’
data {
int<lower=1> C; // number of cohorts
int<lower=1> N[C]; // number of Subjects by cohort
int<lower=0> DLT[C]; // number of DLTs by cohort
real<lower=0> Dose[C]; // dose amount by cohort
real<lower=0> Dose0; // standard dose
int<lower=1> D; // number of all doses
real<lower=0> Dose_set[D]; // dose amount of all doses
int X1[C] ; // number of all doses
int X2[C] ; // number of all doses
vector[2] Mn;
real<lower=0> SD_loga;
real<lower=0> SD_logb;
real<lower=-1, upper=1> Rho;
real Gamma_mu1;
real Gamma_mu2;
real<lower=0> Gamma_SD1;
real<lower=0> Gamma_SD2;
}
transformed data {
matrix[2, 2] Cov;
Cov[1, 1] = square(SD_loga);
Cov[1, 2] = SD_loga * SD_logb * Rho;
Cov[2, 1] = SD_loga * SD_logb * Rho;
Cov[2, 2] = square(SD_logb);
}
parameters {
vector[2] log_ab;
real log_gamma1;
real log_gamma2;
}
transformed parameters {
real log_a = log_ab[1];
real log_b = log_ab[2];
real b = exp(log_b);
real gamma1 = exp(log_gamma1);
real gamma2 = exp(log_gamma2);
real q[C];
for (c in 1:C)
q[c] = inv_logit(log_a + b*log(Dose[c]/Dose0) + gamma1*X1[c] + gamma2*X2[c]);
}
model {
for (c in 1:C) {
DLT[c] ~ binomial(N[c], q[c]);
}
log_ab ~ multi_normal(Mn, Cov);
log_gamma1 ~ normal(Gamma_mu1, Gamma_SD1);
log_gamma2 ~ normal(Gamma_mu2, Gamma_SD2);
}
generated quantities {
real p[D];
for (d in 1:D)
p[d] = inv_logit(log_a + b*log(Dose[d]/Dose0) + gamma1*X1[d] + gamma2*X2[d]);
}