probs: Probability mass function of random variable X

Description Usage Arguments Value Examples

Description

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

Usage

1
probs(X)

Arguments

X

random variable

Value

named vector of probablities for each element of the random variable

Examples

1
2
3
4
5
6
7
8
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)

Example output

Attaching package: 'discreteRV'

The following object is masked from 'package:base':

    %in%

  1   0 
0.5 0.5 
        1         2         3         4         5         6 
0.1666667 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667 
  1   2   3   4   5   6 
0.1 0.1 0.1 0.1 0.2 0.4 

discreteRV documentation built on May 2, 2019, 11:04 a.m.