Learn R Programming

discreteRV (version 1.2.2)

SofI: Sum of independent random variables

Description

Sum of independent random variables

Usage

SofI(..., fractions = attr(list(...)[[1]], "fractions"))

Arguments

...
Arbitrary number of random variables
fractions
If TRUE, return the probabilities as fractions

Examples

Run this code
X.Bern <- RV(c(1,0), c(.5,.5))
X.fair.die <- RV(1:6, rep(1/6,6))

S5 <- SofI(X.Bern, X.Bern, X.Bern, X.Bern, X.Bern)
S.mix <- SofI(X.Bern, X.fair.die)  # Independent but not IID

Run the code above in your browser using DataLab