Open AugustHao opened 3 months ago
working with simulated infections and the follow code to back calculate a GP that would fit to the data, seems like a very short lengthscale is required
log_N_t <- log(N_t)
log_N_t_init <- log(100)
round(exp(log_N_t-log_N_t_init)*100) == round(N_t)
x <- log_N_t-log_N_t_init
discum_x <- eufmdis.adapt:::discumulate_data(x)
discum_discum_x <- eufmdis.adapt:::discumulate_data(discum_x)
k_l <- lognormal(3,1)
k_var <- normal(0, 1, truncation = c(0, Inf))
gp_k <- mat52(k_l, k_var)
gp <- gp(
x = 1:(n_times),
kernel = gp_k,
n = 1,
#inducing = days_sparse,
tol = .Machine$double.eps
)
distribution(discum_discum_x) <- normal(gp,sd = 0.003)
m <- model(gp)
fit <- mcmc(m,warmup = 100,n_samples = 100)
calculate(k_l,values = fit,nsim = 1e3)[[1]] %>% summary()
calculate(k_var,values = fit,nsim = 1e3)[[1]] %>% summary()
update, deriv works with ACEFA covid data, if backing out DoW model, but still does not work on simulated SIRS data
edit: nvm still unidentifiable but can initiate
update: init helper overcomes the issue, but working on implementing with epiwave as need to give init to one of class attribute of gp and that doesn't seem to get passed successfully
init helper doesn't get around another obs type (eg sero, need to debug init stability further)
when
growth_rate_deriv
effect is selected in https://github.com/idem-lab/epiwave/blob/main/R/create_infection_timeseries.Rmodel loses traction over GP hyperparameters, leading to model failing to initiate or non-convergence. I suspect this is because only a narrow region of hyperparameter values can produce a GP that fits with growth rate derivative, depending on features of the data. May need to consider changing kernel choice