Hi all,
I am having trouble getting the chains to mix properly in this model. I have posted some issues earlier which are related to this model. The model can be described mathematically as:
β ~ logistic link(b_0,b_1)
w ~ log-normal(,μ,σ)
Q ~ Weibull(α,λ)
With appropriate priors on b_0,b_1,μ,σ,α,λ
Briefly, I am trying to estimate above six parameters using HMC algorithm of patinets. I assume that, β is same for all individuals in one age group. Here,I have replaced my uniform priors as mentioned in the below model. Have I misspecified my model, or do I need to use more informative priors?
data{
int n;
int m;
matrix[n,m] MT;
int K;
real tstar;
}
parameters{
real<lower=0.001> b0;
real<lower=-0.1> b1;
real<lower=4.5> mu;
real<lower=0.01> sigma2;
real<lower=0.01> lambda;
real<lower=1.5> alpha;
}
model{
b0 ~ normal(2,10);
b1 ~ normal(0.001,10);
mu ~ normal(4.2,10);
sigma2 ~ gamma(0.00016,0.004);
lambda ~ gamma(0.007968,0.0282269);
alpha ~ gamma(0.24025,0.155);
.
.
.
target += (MT[i,(k*3)]*log(V[k])) + ((MT[i,((k*2)+k-1)]- MT[i,((k*3)+1)])*(log(1)-log(V[k]))) + (MT[i,((k*3)+1)]*log(I[k]))+ ((MT[i,((k*2)+k-1)]-MT[i,(k*3)]-MT[i,((k*3)+1)])*(log(1)-log(V[k])-log(I[k])));
}
inits = list(list(b0=runif(1,0,4)),
list(b1=runif(1,-0.1,0.1)),
list(mu=runif(1,4,4.5)),
list(sigma2=runif(1,0.01,0.05)),
list(lambda=runif(1,0.01,0.5)),
list(alpha=runif(1,1.5,4)))
fit<-stan(model_code = cancer_code,
data = cancer_data,
iter = 10000,
warmup = 5000,
init = inits,
init_r = 0.1,
chains = 4,
refresh = 0,
control=list(max_treedepth=10))
This gives me several warnings as model chains are not well mixed, I am confused here, I want to know that is it an error of initial parameter values or error of defining prior distributions?
Thank you.
Edit: @maxbiostat edited this post for syntax highlighting and code formatting