Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix is_continuous() bug for normal distributions #422

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

joshwlambert
Copy link
Member

The PR addresses #421 by correcting a typo in the character string matching in is_continuous(). This bug was leading to is_continuous() incorrectly returning FALSE for normal distributions in <epiparameter> objects. This impacted the <epiparameter> plot method, see reprex in #421.

This PR resolves the issue:

library(epiparameter)
db <- epiparameter_db()
#> Returning 125 results that match the criteria (100 are parameterised). 
#> Use subset to filter by entry variables or single_epiparameter to return a single entry. 
#> To retrieve the citation for each use the 'get_citation' function
fam <- sapply(db, family)
norm_idx <- which(fam == "norm")
norm_ep <- db[norm_idx][[1]]
norm_ep
#> Disease: COVID-19
#> Pathogen: SARS-CoV-2
#> Epi Parameter: serial interval
#> Study: Yang L, Dai J, Zhao J, Wang Y, Deng P, Wang J (2020). "Estimation of
#> incubation period and serial interval of COVID-19: analysis of 178
#> cases and 131 transmission chains in Hubei province, China."
#> _Epidemiology and Infection_. doi:10.1017/S0950268820001338
#> <https://doi.org/10.1017/S0950268820001338>.
#> Distribution: norm (days)
#> Parameters:
#>   mean: 4.600
#>   sd: 4.400
norm_ep$prob_distribution
#> <distribution[1]>
#> [1] N(4.6, 19)
is_continuous(norm_ep)
#> [1] TRUE
plot(norm_ep)

Created on 2024-11-27 with reprex v2.1.0

@joshwlambert joshwlambert changed the title Fix is_continuous() bug for for normal distributions Fix is_continuous() bug for normal distributions Nov 27, 2024
@joshwlambert joshwlambert merged commit 1c94e67 into main Nov 27, 2024
8 checks passed
@joshwlambert joshwlambert deleted the fix-is_continuous branch November 27, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant