Learn R Programming

rv (version 0.949)

simapply: 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

Value

    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.

    References

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

    Examples

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

    Run the code above in your browser using DataLab