resample {tabula} | R Documentation |
Resample
Description
Simulates observations from a multinomial distribution.
Usage
resample(object, ...)
## S4 method for signature 'numeric'
resample(object, do, n, size = sum(object), ..., f = NULL)
Arguments
object |
A |
... |
Extra arguments passed to |
do |
A |
n |
A non-negative |
size |
A non-negative |
f |
A |
Value
If f
is NULL
, resample()
returns the n
values of do
. Else,
returns the result of f
applied to the n
values of do
.
Author(s)
N. Frerebeau
See Also
Other resampling methods:
bootstrap()
,
jackknife()
Examples
## 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)
[Package tabula version 3.1.0 Index]