r: Random Generation

Description Usage Arguments Details Value Examples

View source: R/standist.R

Description

r is a generic function that generates random deviates of a distribution object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

mistr documentation built on Dec. 10, 2018, 5:05 p.m.