Creates an expression distribution and automatically simplifies to closed form when possible (e.g., normal + normal = normal, normal + scalar = normal with shifted mean).

# S3 method for class 'dist'
x + y

Arguments

x

A dist object or numeric scalar

y

A dist object or numeric scalar

Value

A simplified distribution or edist if no closed form exists

Examples

# Sum of two normals simplifies to a normal
z <- normal(0, 1) + normal(2, 3)
z  # Normal(mu = 2, var = 4)
#> Normal distribution (mu = 2, var = 4) 

# Shift a distribution by a constant
normal(0, 1) + 5  # Normal(mu = 5, var = 1)
#> Normal distribution (mu = 5, var = 1)