Next: samplesize() Up: MacAnova Help File Previous: run()   Contents

runi()

Usage:
runi(n), n a positive integer



Keywords: random numbers
runi(count) generates a vector of count pseudo-random uniforms on the
interval 0 to 1.

If the random number generator has not been initialized by setseeds(),
setoptions() or previous use of rbin(), rnorm(), rpoi() or runi(), the
generator's "seeds" will be initialized automatically using the current
time and date, and their values will be printed out.

You can generate uniform random variables on the interval (a,b), a < b
by
  Cmd> x <- a + (b - a)*runi(n)

You can generate the discrete uniform distribution on the integers 1, 2,
..., m by
  Cmd> x <- ceiling(m*runi(n))

This is helpful when sampling with replacement from the rows of a data
vector of matrix.

When Q() is a macro or function computing the quantile function (inverse
cumulative distribution function) of a continuous random variable
(invnor() or invchi()) for example), Q(runi(n) [,parameters]) generates
a random sample from that distribution.

  Cmd> invstu(runi(5),3) # Student's t on 3 d.f.
  (1)     0.43734     0.34297    0.054439  -0.0017229    -0.32894

  Cmd> invF(runi(5),5,30) # F on 5 and 30 d.f.
  (1)     0.45207      2.2247     0.52716     0.29218       1.506

The functions that you can use directly this way are invbeta(),
invchi(), invF(), invgamma(), invnor(), and invstu().  In principle you
could also use invdunnett() and invstudrng(), but that is not advisable
because they are so computationally intensive.

See also topics setseeds(), getseeds(), setoptions(), rnorm(), rbin(),
rpoi(), subtopic 'options:"seeds"'


Gary Oehlert 2003-01-15