rprobdist | R Documentation |
Wrapper functions to quickly generate discrete joint (or conditional) distributions using Dirichlets
rprobdist(dim, d, cond, alpha = 1)
dim |
the joint dimension of the probability table |
d |
number of dimensions |
cond |
optionally, vertices to condition upon |
alpha |
Dirichlet hyper parameter, defaults to 1 (flat density). |
rprobdist
gives an array of dimension dim
(recycled as necessary to have length d
, if this is
supplied) whose entries are probabilities drawn from a Dirichlet
distribution whose parameter vector has entries equal to
alpha
(appropriately recycled).
an array of appropriate dimensions
Uses as many gamma random variables as cells in the table, so will alter the random seed accordingly.
Robin Evans
rprobdist(2, 4) # 2x2x2x2 table rprobdist(c(2,3,2)) # 2x3x2 table rprobdist(2, 4, alpha=1/16) # using unit information prior # get variables 2 and 4 conditioned upon rprobdist(2, 4, cond=c(2,4), alpha=1/16)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.