Learn R Programming

discreteRV (version 1.2.2)

probs: Probability mass function of random variable X

Description

Obtain the list of probabilities from a random variable: p(x)

Usage

probs(X)

Arguments

X
random variable

Value

named vector of probablities for each element of the random variable

Examples

Run this code
X.Bern <- RV(c(1,0), c(.5,.5))
probs(X.Bern)

X.fair.die <- RV(1:6, rep(1/6,6))
probs(X.fair.die)

X.loaded.die <- RV(1:6, odds = c(1,1,1,1,2,4))
probs(X.loaded.die)

Run the code above in your browser using DataLab