random: Quantiles or empirically based generic random number...

Description Usage Arguments Methods (by class) Examples

View source: R/random.R

Description

These functions generate random numbers for parametric distributions, parameters of which are determined by given quantiles or for distributions purely defined empirically.

The default method generates univariate random numbers specified by arbitrary quantiles.

random.vector generates univariate random numbers drawn from a distribution purely defined empirically.

random.data.frame generates multivariate random numbers drawn from a distribution purely defined empirically.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
random(rho, n, method, relativeTolerance, ...)

## Default S3 method:
random(rho = list(distribution = "norm", probabilities =
  c(0.05, 0.95), quantiles = c(-qnorm(0.95), qnorm(0.95))), n, method = "fit",
  relativeTolerance = 0.05, ...)

## S3 method for class 'vector'
random(rho = runif(n = n), n, method = NULL,
  relativeTolerance = NULL, ...)

## S3 method for class 'data.frame'
random(rho = data.frame(uniform = runif(n = n)), n,
  method = NULL, relativeTolerance = NULL, ...)

Arguments

rho

Distribution to be randomly sampled.

n

integer: Number of observations to be generated

method

character: Particular method to be used for random number generation.

relativeTolerance

numeric: the relative tolerance level of deviation of the generated confidence interval from the specified interval. If this deviation is greater than relativeTolerance a warning is given.

...

Optional arguments to be passed to the particular random number generating function.

Methods (by class)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 x<-random(n=10000)
 hist(x,breaks=100)
 mean(x)
 sd(x)
  
 rho<-list(distribution="norm", 
           probabilities=c(0.05,0.4,0.8), 
           quantiles=c(-4, 20, 100))
 x<-random(rho=rho, n=10000, tolConv=0.01)
 hist(x,breaks=100)
 quantile(x,p=rho[["probabilities"]])

decisionSupport documentation built on May 29, 2017, 6:39 p.m.