Learn R Programming

algebraic.dist (version 0.9.1)

expectation.poisson_dist: Exact expectation for a Poisson distribution.

Description

Computes \(E[g(X)]\) using truncated summation over the support. The summation is truncated at the \(1 - 10^{-12}\) quantile to ensure negligible truncation error.

Usage

# S3 method for poisson_dist
expectation(x, g, ...)

Value

The expected value \(E[g(X)]\).

Arguments

x

A poisson_dist object.

g

A function to take the expectation of.

...

Additional arguments passed to g.

Examples

Run this code
x <- poisson_dist(5)
expectation(x, identity)
expectation(x, function(k) k^2)

Run the code above in your browser using DataLab