You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can use simulate_serosurvey(), introduced in #199, to simulate statistically consistent seropositive counts n_seropositive for each age group, according to our set of serological models. In this case, I use the time-varying model:
Note that the model estimating the seroreversion rate (right panel in the image), no only is a better fit for this serological survey according to the elpd value, but it also accurately estimates both the FOI and seroreversion rate we used to simulate the serosurvey.
Another difference with previous versions lies in how we visualize the estimated parameters. Since the constant model is estimating a single FOI value, we only show the estimated value with its corresponding credible interval (we use to plot it instead). However, for the time and age varying models we estimate several values of the FOI in the time/age span of the survey, which we visualize graphically. Take for instance the time varying model with seroreversion:
# implementing the time-varying model with seroreversionseromodel_time_serorev<- fit_seromodel(
serosurvey=serosurvey,
model="time",
foi_prior= sf_uniform(0, 10),
is_seroreversion=TRUE,
seroreversion_prior= sf_uniform(0, 1),
init=init,
iter=4000
)
# plottingplot_time_serorev<- plot_seromodel(
seromodel=seromodel_time_serorev,
serosurvey=serosurvey
)
Here we plot the estimated values of the FOI as a function of time (blue line and shadow) and the R-hat estimates for each estimated value (black dots). Note that, even though we ran the model for a large number of iterations - 4000, the model did not converged (since there are R-hat values over 1.01). We can improve the convergence of the model by estimating less values of the FOI. To specify the time intervals for which FOI values will be estimated, we index them by means of get_foi_index():
This function returns a list of indexes that labels each year (or age, for age-varying models). The idea is that a single FOI value will be estimated for each index, meaning that 10 FOI values will be estimated in this particular case:
Now the model converges. As long as foi_index length covers the whole time/age span of the serological survey, less regular indexations foi_index can be specified.
This example shows how to use the seroreversion rate estimation features of the package using a simulated dataset as benchmark, which allows to validate the results.
The text was updated successfully, but these errors were encountered:
In #200 @ben18785 suggested we should add an article about fitting models with seroreversion using the example wrote in the PR description:
This example shows how to use the seroreversion rate estimation features of the package using a simulated dataset as benchmark, which allows to validate the results.
The text was updated successfully, but these errors were encountered: