Learn R Programming

discreteRV (version 1.2.2)

marginal: Marginal distribution of a joint random variable

Description

Extracts the marginal probability mass functions from a joint distribution.

Usage

marginal(X, num)

Arguments

X
A random variable
num
Number indicating which marginal distribution to extract

Examples

Run this code
AandB <- jointRV(outcomes = list(1:3, 0:2), probs = 1:9 / sum(1:9))
marginal(AandB, 1)
marginal(AandB, 2)

Run the code above in your browser using DataLab