simapply {rv}R Documentation

Apply a Function to Rows of Simulations of Random Vectors

Description

simapply applies a given function FUN to each row of the simulation matrix, returning an rv object.

Usage

simapply(x, FUN, ...)

Arguments

x a random vector
FUN a function
... further arguments passed to FUN

Details

simapply applies a given function to the rows of the simulation matrix of the given random vector.

If the function accepts arrays, use mapply.rv instead.

If the function is to be applied to columns of the simulation matrix, use rvsimapply instead.

Usually used in functions that implement an 'rv'-compatible routine.

Value

Author(s)

Jouni Kerman kerman@stat.columbia.edu http://www.stat.columbia.edu/~kerman

References

Kerman, Jouni and Gelman, Andrew. Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Technical report, Columbia University, New York.

Examples

  #
  x <- rvnorm(10)
  simapply(x, mean) # Same result as that of mean(x).

[Package rv version 0.949 Index]