jpmf: Calculate the joint distribution

Description Usage Arguments Details Value Author(s) References Examples

View source: R/jpmf.R

Description

Calculate the joint probability mass function (joint distribution) from a two-way table of frequencies.

Usage

1
jpmf(m)

Arguments

m

A matrix of numeric values in the form of a two-way table of frequencies:

Fr
40 38 37 ...
To 89 89 87 ...
75 74 89 ...
... ... ... ...

m can be constructed using xt.

Details

jpmf calculates the joint distribution from a matrix M of frequencies. The joint distribution for discrete variables X and Y contained in M is denoted by p(x,y), which is defined as:

P(X = x, Y = y) = p(x,y)

The joint probability at any intersection i,j in M is calculated as:

p(x_i,y_j) = M_i,j / ∑ M

Further, across all i and j the Axioms of probability indicate that

∑ p(x_i,y_j) = p(1,1) + p(1,2) + … + p(i,j) = 1

Value

Returns a matrix with the same dimensions as input M indicating the joint distribution across all interactions of X and Y in the form:

p(x,y) Y
0.06 0.06 0.06 ...
X 0.14 0.14 0.14 ...
0.12 0.12 0.14 ...
... ... ... ...

Author(s)

Bjorn J. Brooks, Lars Y. Pomara, Danny C. Lee

References

PAPER TITLE.

Examples

1
2
3
4
5
6
7
8
data(transitions)             # Load example data
b <- brkpts(transitions$phenofr, # Find 10 probabilistically
            10)                  #  equivalent breakpoints
m <- xt(transitions,          # Make transition matrix
        fr.col=2, to.col=3,
        cnt.col=4, brk=b)
pxy=jpmf(m)                   # Joint distribution
sum(pxy)                      # Check that the joint distribution (PAB) sum to 1

bjornbrooks/landat documentation built on May 17, 2019, 7:32 p.m.