Learn R Programming

distr6 (version 1.0.0)

rand: Random Simulation Function

Description

Returns a given number of points sampled from the distribution.

Usage

rand(object, n, simplify = TRUE)

Arguments

object

Distribution.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

simplify

if TRUE (default) returns results in simplest form (vector or data.table) otherwise as data.table.

Value

Simulated draws from the distribution as either a numeric if simplify is TRUE or as a data.table.

R6 Usage

$rand(n, simplify = TRUE)

Details

If available a rand will be returned without warning using an analytic expression. Otherwise, if the distribution has not been decorated with FunctionImputation, NULL is returned. To impute the rand, use decorate(distribution, FunctionImputation), this will provide a numeric calculation for the rand with warning.

Additional named arguments can be passed, which are required for composite distributions such as ProductDistribution and ArrayDistribution.

See Also

pdf, cdf, quantile for other statistical functions. FunctionImputation, decorate for imputing missing functions.