sample_from_density {YEAB} | R Documentation |
Sample from a density estimate
Description
Sample from a density estimate
Usage
sample_from_density(x, n)
Arguments
x |
A numeric variable from a (un)known distribution |
n |
Number of samples to return |
Value
A sample with distribution close to x
Examples
x <- rnorm(1000)
y <- sample_from_density(x, 1000)
hist(x,
breaks = 30,
freq = FALSE,
col = "grey",
main = "Original data"
)
[Package YEAB version 1.0.6 Index]