papply: Extending apply to particles

View source: R/pl.R

papplyR Documentation

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 = "", ...)

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

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

Value

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

Author(s)

Robert B. Gramacy, rbg@vt.edu

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

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

plgp documentation built on Oct. 19, 2022, 5:20 p.m.