Learn R Programming

bayesboot (version 0.2.2)

rudirichlet: Produce random draws from a uniform Dirichlet distribution

Description

rudirichlet produces n draws from a d-dimensional uniform Dirichlet distribution. Here "uniform" implies that any combination of values on the support of the distribution is equally likely, that is, the \(\alpha\) parameters to the Dirichlet distribution are all set to 1.0.

Usage

rudirichlet(n, d)

Arguments

n

the number of draws.

d

the dimension of the Dirichlet distribution.

Value

An n by d matrix.

Details

In the context of the Bayesian bootstrap rudirichlet is used to produces the bootstrap weights. Therefore, rudirichlet can be used if you directly want to generate Bayesian bootstrap weights.

Examples

Run this code
# NOT RUN {
set.seed(123)
rudirichlet(2, 3)
# Should produce the following matrix:
#       [,1]   [,2]   [,3]
# [1,] 0.30681 0.2097 0.4834
# [2,] 0.07811 0.1390 0.7829

# The above could be seen as a sample of two Bayesian bootstrap weights for a
# dataset of size three.
# }

Run the code above in your browser using DataLab