Open llorracc opened 4 years ago
Oups, I wanted to create a pull request for this one. Ended up pushing to master instead. Anyway the new class is implemented in this commit: https://github.com/EconForge/dolo.py/commit/3755c8b077ef98b6d011683879e811a4e2a33238
Great, thanks!
Currently we don't use the uniform property so we draw from a uniform distribution in [0,1] and compare to cumulative thresholds). It's a actually a good example of a DiscreteDistribution that is not a FiniteDistribution (i.e. defined by a matrix of points and a vector of weights). Maybe naming needs to be adjusted.
(below is a condensed version of the motivation)
Suppose that our assumption for the “Process” (in your sense) is that each period there is a draw from a Normally distributed random variable.
Suppose further that we approximate that variable with the equiprobable discretization, of, say, N=100; we store the list of probability masses in a vector P of length 100.
And we want to simulate a population of size 100.
The normal way to simulate would be, for each of our 100 consumers, to pick randomly one of the 100 entries in P (with replacement).
What works much better is to pick randomly but without replacement. That is equivalent just to randomly reshuffling the order of the point-masses in the P vector.
The reason this works well is that ex ante (that is, before the arrival of period t), the expected distribution of shocks for any individual agent is identical to the distribution in the case without replacement; so with respect to the experience of any individual consumer there is no difference between with-replacement and without.
But for the population as a whole, in every period, the mean, variance, and any other statistics are guaranteed to be exactly the mean, variance, etc of the DiscretizedDistribution. That is, there’s no “sampling error” in the aggregate numbers.