r.compdist {mistr} | R Documentation |
Random Generation
Description
r
is a generic function that generates random deviates of a distribution object.
Usage
## S3 method for class 'compdist'
r(O, n)
## S3 method for class 'mixdist'
r(O, n)
r(O, n)
## S3 method for class 'standist'
r(O, n)
## S3 method for class 'hyperdist'
r(O, n)
## S3 method for class 'wilcoxdist'
r(O, n)
## S3 method for class 'trans_univdist'
r(O, n)
Arguments
O |
distribution object. |
n |
number of observations. |
Details
Methods of r
function generates random deviates of offered
distribution from the package mistr
. The function makes use of the r[sufix] functions
as rnorm
or rbeta
and thus, if a new distribution is added,
these functions must be reachable through the search path.
For more complicated composite distributions, where one of the components is a mixture distribution, the function performs a rejection sampling of mixture random numbers to improve the speed.
Value
Vector of computed results.
Examples
N <- normdist(1, 3)
r(N, 5)
C <- cauchydist()
M <- mixdist(N, C, weights = c(0.5, 0.5))
r(M, 5)
CC <- compdist(N, C, weights = c(0.5, 0.5), breakpoints = 1)
CCC <- 2*C+5
r(CCC, 5)
[Package mistr version 0.0.6 Index]