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

Add explicit guide for truncated distributions #63

Merged
merged 1 commit into from
Aug 13, 2022

Conversation

eirikbrandsaas
Copy link
Contributor

It wasn't obvious that I could truncate the distributions so I added that to the documentation, to the ArgumentError, and a test.

Somewhat related to #40

@eirikbrandsaas
Copy link
Contributor Author

While I did add tests, I didn't see any change in the number of tests when I ran ] test locally. Don't know what's up with that.

@eirikbrandsaas
Copy link
Contributor Author

Or maybe this wasn't a great idea:

E = expectation(truncated(Pareto(),0.0,1000.0))
sum(E.weights) # ≈ 1.0

E = expectation(truncated(Pareto(),0.0,1000.0),n=50)
sum(E.weights) # ≈ 0.97

Or maybe it isn't a problem that the weights don't sum to one for the algorithms in expectations?

@arnavs
Copy link
Member

arnavs commented Aug 13, 2022

@eirikbrandsaas Thanks for this!

Not sure what's up with tests. I'm guessing that the package manager wasn't actually testing the changed package for some reason.

I think the weights should sum to 1, but I'm more flexible when the user is specifying the number of nodes instead of using the defaults.

@arnavs arnavs merged commit 9d8189b into QuantEcon:master Aug 13, 2022
@arnavs
Copy link
Member

arnavs commented Aug 13, 2022

(i.e., drawing 500 nodes once might still be an improvement over repeated Monte Carlo sampling, and drawing 50 nodes once might be acceptable with "3% error")

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