Learn R Programming

lestat (version 1.9)

mdiscretedistribution: Create Object Representing a Multivariate Discrete Distribution

Description

An object representing a multivariate discrete distribution is created, based on explicitly given possible values and probabilities for these.

Usage

mdiscretedistribution(probs, nms=NULL)

Arguments

probs

This must be a matrix, or more generally an array with the same number of dimensions as the desired variable. The values in the matrix must be non-negative and represent the probabilities of the variable.

nms

If given, nms should be a list with the same number of items as there are dimensions of probs. Each item in the list should be a vector with the names of the possible values of the variable representing this dimension of the multivariate variable. If not given, integers are used as variable names.

Value

A multivariate discrete probability distribution.

Examples

Run this code
# NOT RUN {
dist <- mdiscretedistribution(array(1:24, c(2,3,4)))
expectation(dist)
variance(dist)
# }

Run the code above in your browser using DataLab