epiverse-trace / episoap

[Not published - under active development] A Store of Outbreak Analytics Pipelines Provided as Rmarkdown Report Templates
https://epiverse-trace.github.io/episoap/
Other
4 stars 2 forks source link

evaluate to replace `$qf()` by `$q()` to use the output of a discretised function #129

Closed avallecam closed 4 months ago

avallecam commented 4 months ago

When we use si$prob_dist$qf() from a discretised function we are using the output from the continuous function. I reported this in https://github.com/epiverse-trace/epiparameter/issues/233. I copied here the reprex:

Line in {episoap} of issue: https://github.com/epiverse-trace/episoap/blob/fe73f6bd4395c2b349034568881f53f08edc60b5/inst/rmarkdown/templates/transmissibility/skeleton/skeleton.Rmd#L408-L409

Reprex from {epiparameter}:

library(epiparameter)

covid_serialint <-
  epiparameter::epidist_db(
    disease = "covid",
    epi_dist = "serial",
    author = "Nishiura",
    single_epidist = TRUE
  )
#> Using Nishiura H, Linton N, Akhmetzhanov A (2020). "Serial interval of novel
#> coronavirus (COVID-19) infections." _International Journal of
#> Infectious Diseases_. doi:10.1016/j.ijid.2020.02.060
#> <https://doi.org/10.1016/j.ijid.2020.02.060>.. 
#> To retrieve the short citation use the 'get_citation' function

covid_serialint_discrete <-
  epiparameter::discretise(covid_serialint)

# get quantiles
# for discrete distribution
# from discretised distribution object
covid_serialint_discrete$prob_dist$q(0.6)
#> [1] 4

# get quantiles 
# for continuous distribution
# (but)
# from the discretise distribution object
covid_serialint_discrete$prob_dist$qf(0.6)
#> [1] 4.618906

# as in
quantile(covid_serialint,0.6)
#> [1] 4.618906

Created on 2024-02-01 with reprex v2.0.2

Tagging @joshwlambert @Degoot-AM @adamkucharski @jamesmbaazam as interest group from devday and as devs of this @Bisaloo @CarmenTamayo

CarmenTamayo commented 4 months ago

This was resolved in #100 so closing the issue- thanks @avallecam !