Skip to content

Commit

Permalink
Fixed bug that caps the limit of the indicators.
Browse files Browse the repository at this point in the history
  • Loading branch information
oguerrer committed Sep 17, 2023
1 parent daeb9c7 commit 065f157
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ It can also be consulted in the working paper:
* Guerrero O., Guariso D., and Castañeda G. (2023) *Aid effectiveness in sustainable development: A multidimensional approach.* World Development (https://doi.org/10.1016/j.worlddev.2023.106256).


Previous further information on PPI and support materials visit its <a href="http://policypriority.org" target="_blank">homepage</a> .
Previous further information on publications, impact, media coverage, and supporting materials visit its <a href="http://policypriority.org" target="_blank">homepage</a> .

4 changes: 2 additions & 2 deletions source_code/policy_priority_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,13 @@ def run_ppi(I0, alphas, alphas_prime, betas, A=None, R=None, bs=None, qm=None, r
# if theoretical maximums are provided, make sure the indicators do not surpass them
if Imax is not None:
with_bound = ~np.isnan(Imax)
newI[with_bound & (newI[with_bound] > Imax[with_bound])] = Imax[with_bound & (newI[with_bound] > Imax[with_bound])]
newI[with_bound & (newI > Imax)] = Imax[with_bound & (newI > Imax)]
assert np.sum(newI[with_bound] > Imax[with_bound])==0, 'some indicators have surpassed their theoretical upper bound!'

# if theoretical minimums are provided, make sure the indicators do not become lower than them
if Imin is not None:
with_bound = ~np.isnan(Imin)
newI[with_bound & (newI[with_bound] < Imin[with_bound])] = Imin[with_bound & (newI[with_bound] < Imin[with_bound])]
newI[with_bound & (newI < Imin)] = Imin[with_bound & (newI < Imin)]
assert np.sum(newI[with_bound] < Imin[with_bound])==0, 'some indicators have surpassed their theoretical lower bound!'

# if governance parameters are endogenous, make sure they are not larger than 1
Expand Down

0 comments on commit 065f157

Please sign in to comment.