simulateEmpiricalDistribution: Sample Empirical Distribution Without Replacement

View source: R/simulateEmpiricalDistribution.R

simulateEmpiricalDistributionR Documentation

Sample Empirical Distribution Without Replacement

Description

Function to sample Empirical Distributions without replacement, as opposed to the rand method which samples with replacement.

Usage

simulateEmpiricalDistribution(EmpiricalDist, n, seed = NULL)

Arguments

EmpiricalDist

Empirical Distribution

n

Number of samples to generate. See Details.

seed

Numeric passed to set.seed. See Details.

Details

This function can only be used to sample from the Empirical distribution without replacement, and will return an error for other distributions.

The seed param ensures that the same samples can be reproduced and is more convenient than using the set.seed() function each time before use. If set.seed is NULL then the seed is left unchanged (NULL is not passed to the set.seed function).

If n is of length greater than one, then n is taken to be the length of n. If n is greater than the number of observations in the Empirical distribution, then n is taken to be the number of observations in the distribution.

Value

A vector of length n with elements drawn without replacement from the given Empirical distribution.


distr6 documentation built on March 28, 2022, 1:05 a.m.