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

adding distributeParams #692

Merged
merged 5 commits into from
May 21, 2020
Merged

adding distributeParams #692

merged 5 commits into from
May 21, 2020

Conversation

sbenthall
Copy link
Contributor

See #669

HARK/core.py Outdated
while j < len(self.agents):
for n in range(replication_factor):
self.agents[j](AgentCount = int(self.Population*param_dist[0][b]*self.TypeWeight[n]))
exec('self.agents[j](' + param_name + '= param_dist[1][b])')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines, copied from what I assume is ancient cstwMPC code, scare me.
It hardly looks like valid Python to me.

I think also it's using [0] and [1] to access the distribution values, which I'll need to fix for sure.

@sbenthall sbenthall changed the title adding distributeParams to Market class. adding distributeParams May 15, 2020
@sbenthall
Copy link
Contributor Author

This PR now does something a little different from the original method.

  • It's a standalone function in core, not a method on Market.
  • Rather than make any assumptions about the total population in the market, it now works by cloning and splitting an AgentType, given in an argument, into N ex ante heterogeneous copies.
  • It takes a (continuous) distribution as an argument.
  • the AgentCount of the original agent is divided between the new types in proportion given by the discretized distribution.

@sbenthall sbenthall requested a review from mnwhite May 15, 2020 19:23
@mnwhite
Copy link
Contributor

mnwhite commented May 15, 2020 via email

@mnwhite
Copy link
Contributor

mnwhite commented May 20, 2020

This is on my task list to merge.

@mnwhite mnwhite merged commit 9f1c19f into econ-ark:master May 21, 2020
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.

2 participants