dists.product: Distribution of product of several discrete random variables

Description Usage Arguments Value Examples

Description

Distribution of product of several discrete random variables

Usage

1
dists.product(dists, n.max = 1e+08, return.cumdist = FALSE)

Arguments

dists

a list of distributions

n.max

memory limit, distribution will not be obtained when number of mass points exceeds n.max

return.cumdist

when TRUE, returns the cumulative distribution

Value

list with named numeric vectors x and fx (or Fx when return.cumdist==TRUE), denoting respectively the events and probabilities of the discrete distribution.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# x is a fair die, i.e. has probability distribution:
die <- list(x=1:6,fx=rep(1/6,6))

# we have 5 of them
dists <- replicate(5,die,simplify=FALSE)

# what is the distribution of x1*x2*x3*x4*x5?
prod.dist <- dists.product(dists)

plot(prod.dist$x,prod.dist$fx,xlab="x1*x2*x3*x4*x5",ylab="fx",type="h")

DNAprofiles documentation built on Jan. 15, 2017, 9:27 p.m.