Apply.RV: Transform a random variable by a function.

Description Usage Arguments Examples

Description

Transform a random variable by a function.

Usage

1
2
## S3 method for class 'RV'
apply(self, func, ...)

Arguments

func:

function to apply to the random variable

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
X = RV(Exponential(1))
Y = X.apply(log)

Note: For most standard functions, you can apply the function to
the random variable directly. For example, in the example above,
Y = log(X) would have been equivalent and more readable.

User defined functions can also be applied.

g <- function(x)
  return log(x ** 2)
Y = X %>% apply(g)

hayate0304/Rsymbulate documentation built on May 17, 2019, 8:20 a.m.