epidist 0.5.0
Features
Added
delay_summary_draws(), which wraps the three usual post-processing steps into one call. It builds one row per unique combination of the predictors withepidist_strata(), draws the delay distribution parameters for each withdelay_parameter_draws(), and adds the natural scale mean and standard deviation, and any quantiles asked for, withadd_summaries(). Each step is still available on its own. See?delay_summary_drawsand #667.Added
epidist_newdata(), which builds thenewdataneeded to predict from a fitted model. It expands the variables you give it into a grid and adds the response and observation process variables the model uses, so you no longer have to know the column names each model expects. The defaults give the delay distribution with no censoring and no truncation, and arguments set the censoring windows, the relative observation time and the minimum delay. The result works withbrms::posterior_epred(),delay_summary_draws()and thetidybayesdraw functions. See?epidist_newdataand #280.Added
delay_parameter_draws()andadd_delay_parameter_draws(), which return posterior draws of the delay distribution parameters in the long format used bytidybayes.Added
delay_parameter_draws()andadd_delay_parameter_draws(), which return posterior draws of the delay distribution parameters in the long format used bytidybayes. The draws come back with.row,.chain,.iterationand.drawcolumns alongside the columns ofnewdata.predict_delay_parameters()andpredict_dpar()are removed in their favour. See #471.Added
add_summaries(), which adds the mean, the standard deviation and quantiles of the delay distribution implied by each draw of its parameters. It uses the analytic solution for the lognormal, gamma and Weibull families, and simulates from any other family, so it works for every familybrmscan predict from.add_mean_sd()is removed in its favour. See #471.Added
epidist_strata(), which returns one row of the model data per unique combination of the variables that predict the delay distribution parameters. Passing it toadd_delay_parameter_draws()draws each set of parameters once rather than once per observation. See #471.epidistdata objects now check themselves when they are modified. Every object also carries a sharedepidist_dataclass with methods for subsetting, replacement,rbind()and thedplyrverbs. These re-check the object and drop anyepidistclass whose requirements it no longer meets, warning about what was dropped and why. An object that still carries anepidistclass is therefore a valid object of that class.dplyr::group_by()and results with no columns are exceptions, both documented in?epidist_data. See?epidist_dataand #399.Dropped the checks in
epidist_stancode()and in the conversions between linelist and aggregate data, which ran on objects that had already been checked. The conversions from linelist data to a model still check their input, becausenew_epidist_linelist_data()does not. See #399.epidist_transform_data_model()now checks the object it builds for the marginal and naive models. That object was never checked before, which only showed once the check inepidist_stancode()was removed. See #399. ## PackageReworded the message
as_epidist_marginal_model()gives when it sets relative observation times toInf. The message now namesrelative_obs_timeandorig_relative_obs_time. It explains that the impact on accuracy is small because these observation times cause very limited right truncation. It also points atobs_time_thresholdfor users who do not want the behaviour. See #536.epidist_prior()no longer warns about user priors on parameters that are in the model but not in theepidistdefault set. The warning now checks user priors against thebrmsdefault priors for the model as well as theepidistones, so a prior on a regression coefficient no longer looks unmatched. See #483.Simplified the internals of prior handling.
.replace_prior()now only merges priors, with the warning about unmatched priors moved to.warn_unmatched_prior()and themergeargument handled inepidist_prior(). The latent model checks of the event window priors moved toR/latent_model.Rand dispatch on the data class, so a model can now state its own prior requirements. The returned priors, and the Stan code they produce, are unchanged. See #483.The warning about unmatched priors now lists each prior with the parameter it applies to, rather than printing the internal join it came from. See #483.
Documented the return value of every exported function.
Declared
scalesinSuggests, which the FAQ vignette loads but nothing declared.Fixed four typos that
inst/WORDLISTwas masking, corrected two moved URLs, title cased theTitlefield, and setLanguage: en-GB.Fixed
inst/CITATIONrendering the year asNULL.epidist()now restores thePKG_CPPFLAGSandPKG_LIBSenvironment variables it found before fitting. Therstanbackend sets both while compiling and never restores them. The leakedPKG_CPPFLAGSmade the nextpkgbuild::has_build_tools()check fail, which printed a spuriousfatal error: cmath: No such file or directorybefore the model compiled and fitted successfully. See #532.Added
simulate_dates(), which turns simulated event times into the censored dates an analyst would receive.Removed the calls to unexported
brmsfunctions thatR CMD check --as-cranflags.R/brms-compat.Rnow holds small internal helpers reproducing the narrow behaviourepidistrelied on frombrms:::validate_family(),brms:::validate_formula(),brms:::validate_data(),brms:::dpar_bounds()andbrms:::log_lik_weight(). The helpers are written against the publicbrmsinterface rather than copied frombrms.tests/testthat/test-brms-compat.Rchecks each one against thebrmsinternal it replaces. Those checks are skipped on CRAN, since they reach intobrmsinternals. Credit for the original behaviour goes to thebrmsauthors. See #420 and paul-buerkner/brms#1676.Removed the
Remotesfield fromDESCRIPTIONso dependencies resolve from CRAN.cmdstanris now found throughAdditional_repositoriesand the development version ofbrmsis no longer used. See #592.Turned off evaluation of the approximate inference vignette. It uses
pathfinder, which needs an unreleasedbrmsfix. This release resolvesbrmsfrom CRAN. See #579.Added a
brms (>= 2.23.0)floor, the version the compatibility helpers were checked against.Pointed the CI workflows at the Stan r-universe with
extra-repositories. DroppingRemotesmeanspakcan no longer resolvecmdstanr.pakdoes not readAdditional_repositories.Raised the minimum R version to 4.1.0. The package uses the native pipe and the lambda shorthand. Both need R 4.1.0.
Added the copyright holder role to Sam Abbott in
DESCRIPTION.Guarded the shared test fits and the tests that use them so the suite runs without
cmdstanr.Wrapped the
epidist()andepidist_diagnostics()examples in\donttest{}. Both fit a model. They ran for 118 and 110 seconds against CRAN’s 5 second guidance.Anchored the
brmslinks in the documentation soR CMD checkno longer reports Rd cross-references with missing package anchors.Dropped a stale
fixentry from the declared global variables.Updated the
brmsdocumentation URL, which had moved.Added
cran-comments.md.Rewrote the generic
epidist_gen_log_lik()method so it evaluates thebrmslog likelihood once per delay rather than once per delay per posterior draw. A singlebrmscall already returns the cdf for every draw, so the results are cached and reused. The method also callsprimarycensored::pcens_cdf()directly instead ofprimarycensored::dpcens(), which revalidates the distribution function at random points on every call and so would defeat the cache. Cost is now linear rather than quadratic in the number of draws. For 500 draws this is around 80 times faster, and the log likelihoods are unchanged. The guard thatdpcens()applied when the delay upper bound exceeds the relative observation time is reproduced explicitly, since this no longer goes throughdpcens(). Left truncation is carried through the rewritten path: the density is normalised over the interval fromdelay_minto the relative observation time. See #476.
Documentation
- Added an
extending-epidistvignette covering why you might build your own model type, the six generics a model type implements, a worked example, and a table of the packages that already extendepidist. - Precomputed the
ebola,faqandapprox-inferencevignettes. All three fit models and needcmdstanr, so they were excluded from the build by.Rbuildignoreand never reached anyone who installed the package. They are now knitted from a.Rmd.origsource into a committed.Rmdholding static output, so they ship without needingcmdstanror a model fit at build time. - Gave each precomputed vignette its own figure prefix.
ebolaandapprox-inferenceboth wrote tofigures/epidist-, which would collide once more than one is precomputed.
Package
- Made
epidist_family_param()internal. It is reached throughepidist_family(), and a custom model supplies its family throughepidist_family_model()instead. See #79. - Exported
epidist_gen_log_lik(), which was the only one of the three post-processing generators not exported. See #79. - Made
epidist_transform_data()internal. It is a wrapper that dispatches toepidist_transform_data_model(), which is the generic an extension implements and which remains exported. See #79.
Models
- Added left truncation support via a
delay_minparameter inas_epidist_marginal_model(). This passes theL(left truncation) argument through to theprimarycensoredlikelihood. The default of 0 reproduces the previous behaviour. See #588 and #596.
CI
- Added a
render-vignettesworkflow that rebuilds the precomputed vignettes and opens a pull request with the result.
Models
- Added the meta model, for fitting to summarised and potentially biased published estimates, jointly with individual level data. Published estimates are forward modelled from the study’s own estimation procedure, so summaries that did not adjust for right truncation or that treated interval censored data as continuous can still contribute unbiased information, given correct metadata describing what each study did. The meta model is experimental and its interface may still change. See
as_epidist_meta_model(). See #620. - Added
as_epidist_estimates_data()for preparing published summary estimates, with documentation of the study metadata the meta model needs. See #620. - The meta model supports studies that stopped collecting at a calendar date through the
trunc_designfield ofas_epidist_estimates_data(), which weights the estimand by the follow up available to each delay rather than conditioning on a single cohort cutoff. See #620. - The meta model supports midpoint imputation, where a study assigned each delay to the centre of the interval it was observed in, as
cens_adjustedcode 3. See #620. - A standard error supplied for a quantile row of
as_epidist_estimates_data()is now interpreted on the delay scale, as studies report it, and the row is fitted on that scale against the implied quantile. See #620. -
as_epidist_estimates_data()now rejects a reported quantile at or beyond the largest delay its study could have seen, which would otherwise contribute a constant to the likelihood rather than information. See #620. - The meta model now fits the summaries a study computed from the same delays jointly rather than as independent terms. A mean with a standard deviation uses the asymptotic bivariate normal of the pair, and a set of quantiles uses the multinomial mass of the delays falling between them. This removes the over-weighting of a study reporting a median with an interquartile range. One observation is now a group of summaries, so
log_lik()andloo()work at that level. See #620. - A quantile reported by a study that took integer date differences from a cohort now costs three distribution function evaluations rather than one per grid cell, because the grid is normalised by the distribution function at its top. On the quantile reporting studies of the meta vignette this cuts the evaluations they need per gradient from 480 to 36. The shortcut does not apply to a study that stopped collecting at a calendar date, which reweights each cell before renormalising and so keeps the full grid. See #620.
- The implied quantile of a continuous estimand is inverted exactly where the family quantile function exists and refined by Newton steps otherwise, so covariance rows with quantile members and quantile rows with a delay scale standard error are no longer limited by the quadrature spacing. See #620.
- The meta model gained several further speed ups. Softmax normalisation of the cohort grid mass is replaced by division where the normaliser is already known. A zero growth rate accrual design skips its exponential terms. R post-processing batches and caches implied summaries across grouped rows sharing a design. See #620.
- The quadrature resolution used for truncated continuous moments is now set by
options(epidist.meta_n_quad = ), defaulting to 100 intervals. This is the floor of the resolution chosen per study, see below. See #620. - Added
as_epidist_multivariate(), which summarises draws of a set of parameters by their mean vector and covariance matrix, over an optional trajectory index. Passing the result toas_epidist_estimates_data()gives a vector of reported summaries with the covariance between them, fitted as a multivariate normal. This is the format we recommend when a study cannot share its delays, because it keeps the correlation between the quantities it reports. Draws of the natural parameters of a fitted distribution are pushed through to the summaries the distribution implies, so no linearisation is used. See #620. - Added
epidist_estimates_summaries()andepidist_estimates_parameters(), which take one study’s contribution in the shape it reported it.epidist_estimates_parameters()converts the parameters of a distribution a study fitted into the summaries that distribution implies, carrying any reported parameter standard errors onto that scale by the delta method as a covariance over the summaries, which is fitted jointly and carries the study’s information about its parameters exactly. The family a study fitted need not match the family being fitted to it. See #620. -
as_epidist_estimates_data()combines contributions passed in a list, so studies reporting in different shapes assemble into one object. See #620. - The meta model gained a fifth censoring adjustment code,
cens_adjusted = 4, for a study that placed the primary event at the midpoint of its window and integrated the secondary interval. Its estimand is that ofcens_adjusted = 2moved down the delay axis by half a primary window, so its reported mean loses the half window bias while its spread keeps the primary window’s variance. See #620. - The meta model supports left truncation through
delay_min, on both individual level rows and summary rows. A study that only counted delays above a minimum has every implied summary conditioned on the delay exceeding it. See #596 and #620. - A single quantile reported by a study that summarised integer day delays is now fitted as the cell in which the empirical distribution function crossed its probability, the exact event a rounded quantile stands for, rather than with a multinomial on the continuity corrected grid whose claimed precision keeps growing with the sample size. Two quantiles reported at the same value are accepted and merged into one cell, and
as_epidist_estimates_data()warns when a large study reports several such quantiles, whose joint likelihood is still overconfident. See #620. - A multinomial cell that underflows is floored rather than sent to zero, so the R and Stan log likelihoods are both finite for a badly misfitting draw and
loo()keeps working. See #620. -
as_epidist_estimates_data()refuses more summaries from a fitted family than it has parameters, and a covariance over reported summaries that is singular to within a relative eigenvalue of 1e-4, because such a row charges any error in the implied summaries against a vanishing eigenvalue. See #620. -
as_epidist_estimates_data()warns when the relative standard error of a reported standard deviation, at the kurtosis its mean and standard deviation imply under a lognormal delay, exceeds a quarter, which is where the normal sampling likelihood of a standard deviation stops being calibrated. See #620. - The meta model takes a
primaryargument for its individual level rows, as the marginal model does. Withprimary = "expgrowth"the growth rate of primary events is estimated as thepgrowthdistributional parameter. Summary rows are unchanged and keep thegrowth_ratemetadata of their study as a known tilt. See #620. - Added an
epidist_model_prior()method for the meta model, which puts anormal(1, 1)prior on the intercept ofmuwhere it is on the log scale, the scale of the lognormal family prior. The centre is fixed rather than taken from the reported values, because a prior chosen from the data would put the posterior of a small review where the data already sit. The same method puts a half normal prior with a standard deviation of 0.25 on the between study standard deviation of any group level term, where thebrmsdefault is a half Student t with scale 2.5. Closes #683. Without it a Gamma or Weibull fit to summaries alone took thebrmsdefault, which is centred on the response column and so on a delay of zero, because that column is a placeholder on summary rows. See #620. - Added an
epidist_newdata()method for the meta model, which builds an individual level row with the same arguments as the marginal model method, so predicting from a meta model fit no longer means copying a summary row out of the model data. See #620. -
as_epidist_estimates_data()now rejects a reported mean at or beyond the observation time of a study that did not adjust for right truncation, a standard error of zero, a standard deviation of zero, and acens_adjustedcode that is not a whole number from 0 to 4. It warns, rather than messages, when notrunc_adjustedcolumn is supplied and a study is therefore assumed to have adjusted for right truncation. Thegrowth_ratedocumentation now separates its within window tilt from the accrual weight it applies undertrunc_design = "accrual", and points to theprimary = "expgrowth"option of the marginal model for individual level data. See #620. -
as_epidist_estimates_data()acceptsNAcensoring windows for a study that fully adjusted for censoring (cens_adjusted = 1), since none of its estimands read them, and rejects them with a message naming the study for every other code. See #620. - The advisory messages of
as_epidist_estimates_data()are now two short sentences naming the studies, and the input row where a single summary is meant, and point at a new Checks section of its documentation that carries the reasoning. They run once, when the estimates are built, rather than again when the object is passed toas_epidist_meta_model(). See #620. - The advisory messages of
as_epidist_estimates_data()now say what each problem is in plain language, run once on the studies combined in a list rather than once per study, and are followed by a single pointer to the Checks section, withsimulate_study()leaving them to the combined object andadvise = FALSEskipping them. See #620. - The midpoint imputation codes of the meta model (
cens_adjusted3 and 4) now movedelay_minwith the midpoint shift, so a study that dropped reported delays below a minimum is left truncated at the right point. Before this the implied mean was 5 to 15% low for code 4 and up to 24% high for code 3 with a wide secondary window. See #620. - A study that adjusted for right truncation and counted only delays above
delay_minnow has its moments left truncated analytically, so they describe the same estimand as its quantile rows and no longer depend onmax_delay. For a heavy tailed delay the implied standard deviation was 6 to 17% low before this. See #620. - The accrual weight on the discrete grid now cuts each reporting cell at the primary windows it spans, so it is exact for unequal censoring windows whenever the collection window is a multiple of
pwindow. Weighting at the cell’s lower edge put the implied mean 12 to 36% low for a daily primary and weekly secondary window. See #620. - The meta model now chooses its quadrature resolution per study from the spread the study reported, so that the node spacing is at most a quarter of that spread, with
options(epidist.meta_n_quad)as the floor and 2000 intervals as a cap the option lifts when set above it. The number travels with each summary row as itsn_quadslot rather than being compiled into the Stan code. Before this a fixed 100 intervals over the defaultmax_delayput the implied standard deviation of a delay with a coefficient of variation of 0.05 out by a factor of two and pinned its kurtosis at the floor, which made a reported standard deviation almost infinitely precise.as_epidist_estimates_data()now warns only when the cap leaves a study unresolved. See #620. - A draw whose implied moments overflow is rejected on every meta model moment row rather than returning
NaNfor an ungrouped standard deviation. The analytic moments themselves now reject such a draw in Stan and return the failure vector in R, so a covariance row rejects a very wide draw instead of carrying an infinite gradient, and the posterior predictive of such a draw isNArather than aNaNstandard error. See #620. - The meta model no longer evaluates the primary censored distribution function at grid or quadrature nodes deep in the lower tail of a narrow delay, where the Stan function of
primarycensoredhas a finite value with aNaNgradient. A node whose log distribution function is certainly below -100, decided from a closed form bound on the parameters, is treated as holding no mass in both implementations. CmdStan’s gradient diagnostic now passes on every design of the meta vignette at a log standard deviation of 0.03, where four of them could not start before. See #620. - Fixed two gaps in the Stan mirror of a left truncated midpoint code: the delay scale quantile path sized its nodes from the unshifted
delay_min, and the Newton refinement of an implied quantile normalised fromdelay_minrather than the moved left truncation point of a code 4 study. The Stan crossing cell of a single integer day quantile also takes its binomial upper tail through the accurate side, which had put it 5e-3 away from R at a poorly fitting draw. See #620. - The crossing cell likelihood of a single integer day quantile is now taken as the difference of two binomial tails on the side where both are small, with each tail summed term by term once it is far out, and as a sum over the count below the cell where the difference still underflows, in R and in Stan. Before this the difference cancelled or underflowed to
-Infwhen the implied distribution put the reported quantile far into its tail, which stopped chains initialising on the Ebola fit of the meta vignette, and Stan’s binomial distribution function had non finite partial derivatives in the same region, which trapped a chain of the shared test fixture in one run in four. CmdStan’s gradient diagnostic now matches finite differences at every probed point. See #620. -
as_epidist_estimates_data()rejects acens_adjusted = 4study whosedelay_minplus half itspwindowreaches the grid cutoff. See #620. - The meta model intercept prior for the lognormal family is now on the log scale, as it is for a log link. The lognormal
muhas an identity link but ismeanlog, so it was treated as the delay itself. A calibration check of a study reporting a mean with its standard error from 25 delays found it, where the 90% intervals covered the truth about half of the time. See #620. - Added opt in simulation checks of the meta model:
EPIDIST_META_RECOVERY=truefits one meta model per censoring adjustment code and truncation design, andEPIDIST_META_CALIBRATION=truefits forty replicates of two study designs and checks interval coverage and the rank of the truth. See #620. - Added
simulate_study(), which applies the observation and estimation procedure of one published study to a simulated line list and returns the summaries that study would have reported as anepidist_estimates_dataobject. It covers every censoring adjustment code, both truncation designs, a minimum delay and a subsample, and reports a mean and standard deviation, quantiles, a mean with a standard error, or a multivariate mean and standard deviation with their bootstrap covariance. Closes #672.
Documentation
- Added a “The meta model” section to the model guide vignette, with the forward model and sampling likelihoods used for published summary estimates. See #620.
- Added a vignette showcasing the meta model on simulated data. Its case study builds nine studies, each applying a different estimation procedure to the same line list, so the recovery result tests every bias the model adjusts for. See #620.
- The meta vignette is now precomputed from a
.Rmd.origsource, so it ships with the package. See #619 and #620. - The meta vignette now works through the published Ebola onset to death estimates collated by
epireview. It adjusts for the phase of the outbreak each estimate was made in, taking the retrospective studies as the reference so the population level estimate is the one least affected by right truncation, and reports the phase bias as a marginal effect. It reports the population level posterior of the Gamma shape and scale alongside the natural mean and standard deviation, and compares the result with a modern re-analysis of one of the same line lists. See #620.
Bug fixes
-
.delay_family()now strips themeta_prefix alongsidelatent_andmarginal_. Without itadd_summaries()could not find the delay distribution of a meta model fit, because the family is namedmeta_gammarather thangamma. See #620. - Meta model objects now carry the shared
epidist_dataclass, as the latent and marginal model objects do, so they are re-checked when modified and the helpers that dispatch on that class no longer skip them. Closes #684. - The coarse quantile warning of
as_epidist_estimates_data()now keys on the smallest quantile a study reported rather than the largest, because that is the one nearest the edge of the discrete grid and it biased the fitted spread of a midpoint study that escaped the warning. Closes #682. - The short grid cutoff warning of
as_epidist_estimates_data()now judgesmax_delayby a lognormal matched to the reported mean and standard deviation, or to the median and largest quantile where only quantiles are reported, and fires when more than 2% of its second moment lies beyond the cutoff. The previousmean + 10 sdyardstick missed a heavy tailed study whose implied standard deviation was 6.5% low at the default cutoff. Closes #681. - The default
max_delayofas_epidist_estimates_data()is now the delay beyond which one percent of the second moment of a lognormal matched to the study’s summaries lies, rounded up to a whole number of secondary windows with a floor of ten, in place of twenty times the largest reported value. This is the yardstick of the short cutoff check, so the default never trips it, and it gives a delay of mean 7 and standard deviation 3.6 a cutoff of 31 days rather than 140. A study reporting a single quantile or a mean with a standard error, where nothing can be matched, gets five times its largest reported value. See #620. - Added a missing Jacobian adjustment to the latent model for observations whose primary and secondary censoring windows overlap. Without it the latent model did not target the same likelihood as the marginal model. Under daily censoring the affected observations are the zero-delay cases. See #606.
- Declared
reformulasinSuggestsand skipped themarginaleffectsintegration test when it is absent.insightneedsreformulasto read the formula of abrmsfit, but only suggests it, so the test failed on a clean library. See #601.
Documentation
- Added a
left-truncationvignette showing how to usedelay_min. See #596.
CI
- Passed the coverage report to
codecov/codecov-actionthroughfilesrather thanfile.fileis not an input the action accepts, so withdisable_searchset it found no report and thetest-coveragejob failed onmain. - Pinned the
precommithooks to a revision whose lockfile usesdigest0.6.39. The tagged v0.4.3 lockfile pinsdigest0.6.36, which callsCallocandFree. Those were removed from the R API in R 4.5, so the hook environment failed to build and thepre-commitjob failed on every pull request. See #578.
epidist 0.4.1
Bug fixes
- Fixed Stan compilation failure with primarycensored >= 1.4.0 by adding the new
L(left truncation) parameter to theprimarycensored_lpmfcall in the marginal model. See #583. - Added
primarycensored (>= 1.4.0)version bound to DESCRIPTION. - Updated test expectations for changed primarycensored error handling.
- Re-enabled approximate inference vignette evaluation using dev brms with pathfinder path fix. See #579.
Package
- Load only required primarycensored Stan functions (
primarycensored_lpmfand ODE/distribution helpers) withpcd_load_stan_functions(dependencies = TRUE)instead of loading all functions. See #582.
epidist 0.4.0
Package
- Enforce line length and use cli for latent prior checks. See #580.
- Removed CodeDepends from DESCRIPTION dependencies.
Documentation
- Restructured pkgdown reference with higher-level categories. See #574.
- Updated FAQ to recommend pp_check with expanded data. See #575.
- Clarified weight parameter documentation in
as_epidist_marginal_model(). See #565. - Fixed pathfinder parameter usage in approximate inference vignette. See #573.
epidist 0.3.1
Hotfix release to patch a change in how the grepl function works in new versions of R.
epidist 0.3.0
This release adds support for a wider range of distributions in the marginal model, improves documentation with new vignettes and FAQ sections, enhances the getting started guide with clearer examples of model comparison, and fixes several bugs related to parameter bounds and likelihood calculations.
Package
- Remove caching of vignettes. See #533.
Documentation
- Added a new vignette “Guide to the statistical models implemented in epidist”. See #514.
- Added a new FAQ section showcasing how to use the
posteriorpackage withepidistmodels, particularly for working with random variables (rvars) to propagate uncertainty in calculations. See #547. - Added a new FAQ section on how to use the
marginaleffectspackage withepidistmodels. See #547. - Reduced the focus on simulating data in the getting started vignette to make it more accessible. See #549.
- Made the entry to the package friendlier with clearer examples and improved documentation. See #549.
- Added a schematic to explain right truncation more clearly to the getting started vignette. See #549.
- Added a comparison of fitting naive and marginal models in the getting started vignette to highlight the importance of accounting for biases. See #549.
- Added examples showing how to extract estimated parameters and plot them against true values to evaluate model performance. See #549.
Bugs
- Fixed a vector length issue for censoring that was causing problems in some likelihood calls. See #540.
- Fixed a bug in the preprocessing of the Weibull family. See #540.
- Fixed a bug where bounds were not set for mu parameters in custom families. See #549.
- Fixed a bug in
predict_delay_parameters()where it couldn’t detect brms families when used directly. See #549.
epidist 0.2.0
This release adds a new marginal model based on primarycensored which provides a more efficient approach for fitting delay distributions compared to the existing latent model. We’ve also improved data handling by adding support for aggregated data across all models, added comprehensive examples using real world data, and enhanced documentation based on user feedback. The package has also undergone significant internal improvements including generalised Stan reparameterisation and improved data transformation methods.
As part of this release we have moved from @athowes maintaining the package (who led the initial package development, implementation of the S3 infrastructure, implementation of the core models, and wrote the first versions of the getting started vignette, Ebola case study, FAQ section, and the approximate inference vignette) to @seabbs maintaining the package.
Models
- Added a marginalised likelihood model based on
primarycensored. This can be specified usingas_epidist_marginal_model(). This is currently limited to Weibull, log-normal, and gamma distributions with uniform primary censoring but this will be generalised in future releases. See #426. - Added user settable primary event priors to the latent model. See #474.
- Added a marginalised likelihood to the latent model. See #474.
- Added a
weightargument toas_epidist_marginal_model()to allow for weighted data (for example count data) to be used in the marginal model. See #509. - Added a
epidist_aggregate_datamethod toas_epidist_marginal_model()to allow straightforward use of the marginal model with aggregated data. See #510. - Added a
epidist_aggregate_datamethod toas_epidist_latent_model()to allow straightforward use of the latent model with aggregated data. See #510. - Added a
epidist_aggregate_datamethod toas_epidist_naive_model()to allow straightforward use of the naive model with aggregated data. See #510. - Updated the naive model to internally transform the data to be optimally aggregated as for the marginal model. See #510.
Package
- Remove the default method for
epidist(). See #473. - Added
enforce_presenceargument toepidist_prior()to allow for priors to be specified if they do not match existing parameters. See #474. - Added a
mergeargument toepidist_prior()to allow for not merging user and package priors. See #474. - Generalised the Stan reparametrisation feature to work across all distributions without manual specification by generating Stan code with
brmsand then extracting the reparameterisation. See #474. - Added a
transform_dataS3 method to allow for data to be transformed for specific models. This is specifically useful for the marginal model at the moment as it allows reducing the data to its unique strata. See #474. - Added new
epidist_aggregate_dataclass to handle pre-aggregated line list data. See #510. - Added a
as_epidist_aggregate_data()method forepidist_linelist_dataobjects to allow for easy conversion to aggregate data. See #510. - Added a
as_epidist_linelist_data()method forepidist_aggregate_dataobjects to allow for easy conversion to linelist data. See #510. - Added an example dataset
sierra_leone_ebola_datato the package. See #510. - Added examples to most functions to show usage of the package. See #510.
- Added improved documentation explaining how the
epidist_transform_data()methods work for the marginal and naive models. See #510.
Documentation
- Brings the README into line with
epinowcaststandards. See #467. - Switched over to using the marginal model as default in the documentation. See #426.
- Added a helper functions for new variables to avoid code duplication in vignettes. See #426.
- Improved the Ebola case study vignette to use truncated data and to reduce the focus on exploratory data analysis. See #510.
Bugs
- Switched to using a patched of
primarycensoredthat doesn’t make use ofsize(). This fixes some Mac compilation edge cases. See #524.
epidist 0.1.0
This is the first minor release of epidist intended for early test users of the package. As some features may change, the package is marked as experimental. We expect to release a stable 1.0.0 version shortly.
The epidist package implements models for epidemiological delay distributions. It uses brms to perform Bayesian inference.
One data format is currently available:
- The linelist data format
Two statistical models are currently available:
- The naive model: which models the delay directly using
brms - The latent model: which implements a latent variable model to correct for biases in the data
The package is readily extensible to additional models via an S3 class based system. In particular, model fitting with [epidist()] is possible using S3 classes for custom:
We provide functionality for post-processing. Alternatively, users may directly use tidybayes for specific families.
Three vignettes are available. There is also a frequently asked questions section.
