ra_sample: Sample from different distributions

View source: R/ra_sample.R

ra_sampleR Documentation

Sample from different distributions

Description

This function samples random values from probability distributions. The function, conveniently, wraps other functions to provide multiple distributions under a single function. Some of the distributions currently supported includes: normal, poisson, triangular, uniform, gamma, inverse gamma, log normal, pert.

Usage

ra_sample(x, n, full = F)

Arguments

x

Distribution specification, must specify the name of the distribution and parameters, e.g. Normal (10, 0.4) .Current distributions supported include: uniform, binomial, triangle, poisson, normal and pert. If no distribution specified. the value will be assumed to be fixed.

n

Number of observations to be sampled from the distribution

full

TRUE/FALSE. If TRUE a list with the samples, and distribution specified will be returned, Only a vector of the observations will be returned otherwise.

Value

A numeric vector containing values sampled from the distribution specified.

Examples

ra_sample(x = 'pert(0.01,  0.03, 0.64)', n = 10)

jpablo91/QuantRRA documentation built on July 3, 2024, 10:46 p.m.