Hello,
I am newer to bayesian modeling and even newer to Stan specifically. I am working on a power survival model and would like to incorporate measurement error - specifically measurement error related to the observation of the death event, not measurement error of any covariates. The specific use-case is when the death event is observed by another model (statistical or machine learning) leading to error in the recorded death event. I have started from the Weibull model on the Stan user guide:
data {
int<lower=0> N;
array[N] <lower=0> observed_times;
}
parameters {
real<lower=0> alpha;
real<lower=0> sigma;
}
model {
alpha ~ lognormal(0,1);
sigma ~ lognormal(0,1);
obs_times ~ weibull(alpha, sigma);
}
I am simulating data from an inverse survival function to try to fit using this code;
functions {
real inv_survival(real u, real alpha, real sigma) {
return sigma * pow(-log(u), 1 / alpha)
}
}
data {
int<lower=1> N;
real<lower=0> alpha;
real<lower=0> beta;
}
generated quantities {
array[N] real<lower=0> observed_times;
for (n in 1:N) {
real_u = uniform_rng(0,1);
observed_times[n] = inv_survival(u, alpha, sigma);
}
}
All of which works as expected. I can properly fit my simulated data and extract the parameters used. What is lacking is my ability to model any error in my data. After generating some “ground truth” survival observation times, I add some random noise to the observed times to simulate the effect of uncertainty in the event-observing model (while still restricting observed_time
< 0). How can I add to this model to incorporate this error specifically? My mental model suggests that when you know generally how much measurement error is added, you should be able to recover the same parameters with wider HDI bounds. Instead, I get a totally different parameter back (when fitting alpha = 2.5, sigma = 3, adding noise returned alpha = 2.9, sigma = … 9.5). Any ideas how to work measurement error in the event observation into my model?