On Thu, 15 Dec 2005, Phineas wrote:
> How many distinct values can rnorm return?
2^32-1. This is described in help(Random)
> I assume that rnorm manipulates runif in some way, runif uses the Mersenne
> Twister, which has a period of 2^19937 - 1. Given that runif returns a 64
> bit precision floating point number in [0,1], the actual period of the
> Mersenne Twister in a finite precision world must be significantly less.
No. Not at all. Consider a sequence of 1-bit numbers: individual values
will repeat fairly frequently but the sequence need not be periodic with
any period
1101001000100001000001
is the start of one fairly obvious non-periodic sequence.
There are reasons that a longer period than 2^32 is useful. The most
obvious is that you can construct higher-resolution numbers from several
runif()s. The Mersenne Twister was designed so that quite long
subsequences (623 elements) would be uniformly distributed.
Less obvious is that fact that a periodic pseudorandom sequence is likely
to show a frequency distribution of repeat values that differs from the
random sequence once you get beyond about the square root of the period.
This means that a 32-bit PRNG should really have a period of at least
2^64.
The randaes package provides a runif() that uses 64 bits to construct a
double, providing about 53 bits of randomness.
> One of the arguments for Monte Carlo over the bootstrap is that for a
sample
> size n the bootstrap can return at most 2^n distinct resamples, however for
> even for relatively small sample sizes there may be no increase in
precision
> in using Monte Carlo.
I don't get this at all. What technique are you comparing to the bootstrap
and for what purpose?
-thomas