Skip to content

Commit

Permalink
BUG: handle small numerical error creating negative micro weights
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffgortmaker committed Apr 22, 2022
1 parent 73568be commit 6b07292
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyblp/markets/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,9 @@ def compute_micro_dataset_contributions(
assert eliminated_outside_probabilities is not None
dataset_weights[:, -self.J:, 0] *= eliminated_outside_probabilities.T

# truncate numerical errors from below by zero
dataset_weights[dataset_weights < 0] = 0

weights_mapping[dataset] = dataset_weights

if compute_jacobians:
Expand Down

0 comments on commit 6b07292

Please sign in to comment.