powered by
f
univariate_dist
x
Assumes the support is a contiguous interval that has operations for retrieving the lower and upper bounds.
# S3 method for univariate_dist expectation(x, g, ..., control = list())
The expected value (numeric scalar), or the full integrate() result if compute_stats = TRUE.
integrate()
compute_stats = TRUE
The distribution object.
The function to take the expectation of.
Additional arguments to pass into g.
g
An (optional) list of control parameters for integrate or expectation_data (if x is not continuous)
integrate
expectation_data
x <- normal(3, 4) # E[X] for Normal(3, 4) is 3 expectation(x, function(t) t) # E[X^2] for Exp(1) is 2 expectation(exponential(1), function(t) t^2)
Run the code above in your browser using DataLab