resample | R Documentation |
Simulates observations from a multinomial distribution.
resample(object, ...)
## S4 method for signature 'numeric'
resample(object, do, n, size = sum(object), ..., f = NULL)
object |
A |
... |
Extra arguments passed to |
do |
A |
n |
A non-negative |
size |
A non-negative |
f |
A |
If f
is NULL
, resample()
returns the n
values of do
. Else,
returns the result of f
applied to the n
values of do
.
N. Frerebeau
stats::rmultinom()
Other resampling methods:
bootstrap()
,
jackknife()
## Sample observations from a multinomial distribution
x <- sample(1:100, 50, TRUE)
resample(x, do = median, n = 100)
## Estimate the 25th, 50th and 95th percentiles
quant <- function(x) { quantile(x, probs = c(0.25, 0.50, 0.75)) }
resample(x, n = 100, do = median, f = quant)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.