For simulation purposes, how long samples to draw from distributions?

E.g. if I want something to follow an exponential distribution with mean 25, then upon trialing in scipy I found that expon.rvs(size=10000, scale=25) seems to have its mean withint $25 \pm 0.5$. I guess this could be enough in this case.

However, this means that I must use data of length 10000, even when I could do with much less (e.g. the runs I do are 1000 time units and drawing 10000 inter-arrival times means that I get much more times than I need).

Or maybe I should do:

expon.rvs(size=10000, scale=25)

and then draw as many samples I need from this?

  • $\begingroup$ What do you mean by "simulation purposes"? The number of samples needed will depend on your application - e.g. if you needed to estimate the mean of $\log(X)$, where $X$ is some distribution, the number of simulations needed would depend on how accurate you needed your estimate to be. $\endgroup$ – Alex Nov 24 '18 at 20:33
  • $\begingroup$ @Alex Perhaps my idea was regarding that if one only needs, say, 20 rvs, then simulating 10000 only in order to meet accuracy in some CLT sense is waste of computation power. Since technically one could simulate only 20 rvs that obey the required params? Or is this not possible? If one truncates the domain of the generating function? So rather than drawing from all $\mathbb{R}$, draw only from, say, $[2,5]$? $\endgroup$ – mavavilj Nov 24 '18 at 20:42
  • $\begingroup$ I'm not sure I understand, but I agree that if you only need 20 RVs then simulating more than that is a waste. If you want a sample from a region, e.g. [2, 5] then you can use rejection sampling: keep drawing from the entire distribution but only keep the observations that fall in the region/interval that you want samples from. $\endgroup$ – Alex Nov 24 '18 at 20:55
  • $\begingroup$ @Alex In order to e.g. get expon.rvs(scale=25) have desired mean (25) one must take 100000 samples or so to be within $25 \pm 0.2$ or so. With 100 samples the accuracy is maybe $25 \pm 9$. $\endgroup$ – mavavilj Nov 25 '18 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.