dot-dist: Method for negation or subtraction of 'dist' objects.

-.distR Documentation

Method for negation or subtraction of dist objects.

Description

Unary: returns negated distribution (e.g., -N(mu, var) = N(-mu, var)) Binary: creates expression distribution and simplifies to closed form when possible (e.g., normal - normal = normal, normal - scalar = normal).

Usage

## S3 method for class 'dist'
x - y

Arguments

x

A dist object or numeric scalar

y

A dist object or numeric scalar (optional for unary negation)

Value

A simplified distribution or edist if no closed form exists

Examples

# Difference of normals simplifies to a normal
z <- normal(5, 2) - normal(1, 3)
z  # Normal(mu = 4, var = 5)

# Unary negation
-normal(3, 1)  # Normal(mu = -3, var = 1)

algebraic.dist documentation built on Feb. 27, 2026, 5:06 p.m.