Learn R Programming

algebraic.dist (version 0.9.1)

*.dist: Multiplication of distribution objects.

Description

Handles scalar * dist, dist * scalar, and dist * dist.

Usage

# S3 method for dist
*(x, y)

Value

A simplified distribution or edist

Arguments

x

first operand

y

second operand

Examples

Run this code
# Scalar multiplication simplifies for normal
z <- 2 * normal(0, 1)
z  # Normal(mu = 0, var = 4)

# Product of two distributions yields an edist
w <- normal(0, 1) * exponential(1)
is_edist(w)  # TRUE

Run the code above in your browser using DataLab