Learn R Programming

arkhe (version 1.11.0)

resample_multinomial: Draw Multinomial Random Sample

Description

Draws a random (sub)sample from a multinomial distribution.

Usage

resample_multinomial(object, ...)

# S4 method for numeric resample_multinomial(object, n, size = sum(object), ...)

Value

A numeric

matrix with n rows and k columns.

Arguments

object

A length-\(k\) integer vector, specifying the probability for the \(k\) classes; is internally normalized to sum to 1.

...

Currently not used.

n

A non-negative integer specifying the number of random vector to draw.

size

A non-negative integer specifying the sample size.

Author

N. Frerebeau

See Also

stats::rmultinom()

Other resampling methods: bootstrap(), jackknife(), resample_uniform()

Examples

Run this code
## Uniform distribution
x <- rnorm(20)
resample_uniform(x, n = 10)

## Multinomial distribution
x <- sample(1:100, 20, TRUE)
resample_multinomial(x, n = 10)

Run the code above in your browser using DataLab