I attempt to run survival models with interval-censored data.
#War Data from Morrison and Schmittlein 1980
Dropped <- c(165, 46, 33, 22, 11, 11, 5, 4, 4, 3)
Tstart <- c(0:9);
Tend <- Tstart+1;
data_list <- list(
Dropped = Dropped,
Tstart = Tstart,
Tend = Tend,
T = 10,
N = 315,
R = 315-sum(Dropped)
)
I tried the Gamma distribution which runs well:
// Fit a Gamma model with interval censored data
//
data {
int<lower=0> T; // calibration period
vector[T] Tstart;
vector[T] Tend;
vector[T] Dropped;
int<lower=0> N;
int<lower=0> R; // remaining buyers
}
parameters {
real<lower=0> lambda;
real<lower=0> c;
}
model {
lambda ~ normal(10,10);
c ~ normal(1,10);
for (i in 1:T) {
target += Dropped[i] * log(gamma_cdf(Tend[i] | c, lambda) -
gamma_cdf(Tstart[i] | c, lambda) );
}
target += R * gamma_lccdf(T | c, lambda) ;
}
generated quantities{
vector[11] predicted;
for (i in 1:10) {
predicted[i]=N*(gamma_cdf(Tend[i] | c, lambda) -
gamma_cdf(Tstart[i] | c, lambda) );
}
predicted[11]=N*(1-gamma_cdf(10 | c, lambda));
}
I omitted the convergence diagnostics but they are really good. The fit of the Gamma, using the posterior mean of each histogram bar, is also good.
But when I tried to use the Weibull, the sampling cannot even get started. The code is nearly identical so that cannot be the issue.
// Fit a Weibull model with interval censored data
//
data {
int<lower=0> T; // calibration period
vector[T] Tstart;
vector[T] Tend;
vector[T] Dropped;
int<lower=0> N;
int<lower=0> R; // remaining buyers
}
parameters {
real<lower=0> lambda;
real<lower=0> c;
}
model {
lambda ~ normal(10,10);
c ~ normal(1,10);
for (i in 1:T) {
target += Dropped[i] * log(weibull_cdf(Tend[i] | c, lambda) -
weibull_cdf(Tstart[i] | c, lambda) );
}
target += R * weibull_lccdf(T | c, lambda) ;
}
Can someone try and see if they can determine the reason?