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

Mode share sampling for PM and CO2 emissions #89

Open
AnnaKS123 opened this issue Mar 18, 2022 · 0 comments
Open

Mode share sampling for PM and CO2 emissions #89

AnnaKS123 opened this issue Mar 18, 2022 · 0 comments

Comments

@AnnaKS123
Copy link
Contributor

Sampling the mode shares for PM and CO2 emissions uses a Gamma function which creates Dirichlet distributed parameters. This Gamma function does not work properly for small mode shares and low confidence in the mode shares.

In ithim_setup_parameters.R (line 149 for PM and CO2 starts after PM)

if(PM_EMISSION_INVENTORY_CONFIDENCE<1){
total <- sum(unlist(PM_EMISSION_INVENTORY))
parameters$PM_EMISSION_INVENTORY <- list()
for(n in 1:NSAMPLES){
samples <- lapply(PM_EMISSION_INVENTORY,function(x) rgamma(1,shape=x/total*dirichlet_pointiness(PM_EMISSION_INVENTORY_CONFIDENCE),scale=1))
new_total <- sum(unlist(samples))
parameters$PM_EMISSION_INVENTORY[[n]] <- lapply(samples,function(x)x/new_total)
}
}

Gamma function needs updating.

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

No branches or pull requests

1 participant