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

create_random_distribution: add new option "log10_norm" #14

Closed
mrustl opened this issue Feb 12, 2019 · 1 comment
Closed

create_random_distribution: add new option "log10_norm" #14

mrustl opened this issue Feb 12, 2019 · 1 comment
Assignees
Labels
backend Calculation engine "kwb.qmra" enhancement
Milestone

Comments

@mrustl
Copy link
Member

mrustl commented Feb 12, 2019

After discussion of @wseis with @PatrickSmeetsKWR it was decided to use a log10 normal distribution with a standard deviation (based on the 90th percentile) and mean as defined in the example code below:

inflow_pathogens_per_litre_min <- 0
inflow_pathogens_per_litre_max <- 1000

inflow_log10_mean <- (log10(inflow_pathogens_per_litre_min) + log10(inflow_pathogens_per_litre_max))/2

inflow_log10_sdev <- (log10(inflow_pathogens_per_litre_max) - inflow_log10_mean)/qnorm(0.9)

hist(10^rnorm(10000, mean = inflow_log10_mean , sd= inflow_log10_sdev))

This function should be only used for the inflow concentrations.

@mrustl mrustl added enhancement backend Calculation engine "kwb.qmra" labels Feb 12, 2019
@mrustl mrustl added this to the v0.2.0 milestone Feb 12, 2019
@mrustl mrustl self-assigned this Feb 12, 2019
@mrustl mrustl closed this as completed in 61e0381 Feb 12, 2019
@mrustl
Copy link
Member Author

mrustl commented Feb 12, 2019

Now the new functionality is in the R package @daniel-wicke @PatrickSmeetsKWR @wseis

Checkout the documentation for details: https://kwb-r.github.io/kwb.qmra/reference/create_random_distribution.html

@wseis please check whether it is correctly implemented:

remotes::install_github("kwb-r/kwb.qmra")
inflow <- kwb.qmra::create_random_distribution(type = "log10_norm", min = 0, max = 1000)
Create 1 random distribution(s): 10^rnorm(with parameters n: 365, mean: 0.500000, sd: 1.950760)
summary(inflow$events$values)
     Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
      0.0       0.2       4.1   10616.1     112.0 2440307.9 

grafik

mrustl added a commit that referenced this issue Feb 13, 2019
previous sdev only covered 80%

after QA of Wolfgang #14
mrustl added a commit that referenced this issue Feb 13, 2019
leading to NAs generation. Thanks to @wseis this is now fixed

#14
mrustl added a commit that referenced this issue Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Calculation engine "kwb.qmra" enhancement
Projects
None yet
Development

No branches or pull requests

1 participant