simapply | R Documentation |
simapply
applies a given function FUN
to each row of the
simulation matrix, returning an rv object.
simapply(x, FUN, ...)
x |
a random vector. |
FUN |
a function. |
... |
further arguments passed to |
simapply
applies a given function to the rows of the
simulation matrix of the given random vector.
If the function accepts arrays, use rvmapply
instead.
If the function is to be applied to each component of the random vector
separately (such as in rvmean
), use rvsimapply
instead.
Usually used in functions that implement an 'rv'-compatible numeric function.
An rv
object, representing the distribution of FUN(x,
...)
.
Jouni Kerman jouni@kerman.com
Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.
See also vignette("rv")
.
# x <- rvnorm(10) simapply(x, mean) # Same result as that of mean(x).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.