mardi 24 mai 2016

R "random" distributions

I have been seeing series of generated data with too much similarity between near entries from runif

Here is a short session from RStudio

1:5 * runif(1,-1,1)

This will give us five "randomly" distributed entries between (-1,1) .. well .. so I had understood.. The reality is different:

> 1:5 * runif(1,-1,1)
[1] -0.1534864 -0.3069729 -0.4604593 -0.6139458 -0.7674322
> 1:5 * runif(1,-1,1)
[1] 0.01084729 0.02169457 0.03254186 0.04338915 0.05423643
> 1:5 * runif(1,-1,1)
[1] -0.003854265 -0.007708529 -0.011562794 -0.015417058 -0.019271323
> 1:5 * runif(1,-1,1)
[1] -0.8809448 -1.7618896 -2.6428343 -3.5237791 -4.4047239
> 1:5 * runif(1,-1,1)
[1] -0.768577 -1.537154 -2.305731 -3.074308 -3.842885
> 1:5 * runif(1,-1,1)
[1] 0.03255907 0.06511815 0.09767722 0.13023629 0.16279537

Notice:

  • the first series range is (-.767,-.15)
  • the second series range is (.01,.05)
  • the third series range is (-.0038,-.019)

etc. Clearly these are not truly random series. So:

  • what are these series representing
  • how do we get more realistic randomly distributed series.



Aucun commentaire:

Enregistrer un commentaire