Learn R Programming

plgp (version 1.1-12)

papply: Extending apply to particles

Description

Applies a user-specified function to each particle contained in the global variables peach and pall, collecting the output in a data.frame

Usage

papply(fun, verb = 1, pre = "", ...)

Value

Returns a data frame with the collected output of the user-specified function fun

Arguments

fun

a user-defined function which which takes a particle as its first input; the output of fun should be a vector, matrix or data.frame

verb

a scalar logical indicating whether progress statements should be printed to the screen

pre

an optional character prefix used in the progress print statements; ignored if verb = 0

...

these ellipses arguments are used to pass extra optional arguments to the user-supplied function fun

Author

Robert B. Gramacy, rbg@vt.edu

Details

This is a extension to the built-in apply family of function to particles, intended to be used with the particles created by PL. Perhaps the most common use of this function is in obtaining samples form the posterior predictive distribution, i.e., with the user supplied fun = pred.GP

The particles applied over must be present in the global variables pall, containing sufficient information common to all particles, peach, containing sufficient information particular to each particle, as constructed by PL

References

Carvalho, C., Johannes, M., Lopes, H., and Polson, N. (2008). “Particle Learning and Smoothing.” Discussion Paper 2008-32, Duke University Dept. of Statistical Science.

https://bobby.gramacy.com/r_packages/plgp/

See Also

PL, pred.GP

Examples

Run this code
## See the demos via demo(package="plgp") and the examples
## section of ?plgp

Run the code above in your browser using DataLab