Learn R Programming

joker (version 0.14.2)

calculus: Distributional Calculus

Description

Arithmetic operators and functions for probability distribution objects. These methods define how standard operations like +, -, *, and / behave when applied to random variables, returning the resulting distribution based on known properties of common distribution families.

Usage

# S4 method for Norm,Norm
+(e1, e2)

# S4 method for numeric,Norm +(e1, e2)

# S4 method for Norm,numeric +(e1, e2)

# S4 method for Norm,Norm -(e1, e2)

# S4 method for numeric,Norm -(e1, e2)

# S4 method for Norm,numeric -(e1, e2)

# S4 method for numeric,Norm *(e1, e2)

# S4 method for Norm,numeric *(e1, e2)

# S4 method for Norm,numeric /(e1, e2)

# S4 method for Norm,logical sum(x, ..., na.rm = FALSE)

# S4 method for Norm exp(x)

Value

All calculations return Distribution objects (specifically, objects of a class that is a subclass of Distribution), according to the property at hand.

Arguments

x, e1, e2

objects of subclass Distribution.

...

extra arguments.

na.rm

logical. Should missing values be removed?

Examples

Run this code
# -----------------------------------------------------
# Distribution Calculus Example
# -----------------------------------------------------

# Normal location - scale transformation
x <- Norm(2, 3)
y <- 3 * x + 1 # Norm(7, 9)

# Addition of two independent Normal random variables
x1 <- Norm(1, 3)
x2 <- Norm(2, 4)
x3 <- x1 + x2 # Norm(3, 5)

Run the code above in your browser using DataLab