rdirichlet: Random draws from a Dirichlet distribution

Description Usage Arguments Value Author(s) Examples

Description

Simulates a sample from a Dirichlet distribution

Usage

1

Arguments

n

number of simulations required

par

vector of parameters of the Dirichlet distribution

Value

matrix of simulated draws where each row corresponds to a single draw

Author(s)

Jim Albert

Examples

1
2
3
par=c(2,5,4,10)
n=10
rdirichlet(n,par)

Example output

            [,1]      [,2]      [,3]      [,4]
 [1,] 0.21952131 0.2466717 0.1242365 0.4095704
 [2,] 0.18434133 0.2221150 0.2266919 0.3668517
 [3,] 0.11157557 0.2836092 0.1202020 0.4846132
 [4,] 0.07593030 0.1319607 0.1214024 0.6707066
 [5,] 0.03212380 0.2743756 0.3123550 0.3811455
 [6,] 0.07724463 0.2952056 0.1250986 0.5024512
 [7,] 0.02313663 0.3423821 0.1786582 0.4558231
 [8,] 0.06999285 0.1401169 0.1921575 0.5977327
 [9,] 0.01076557 0.1620229 0.1813367 0.6458749
[10,] 0.02548046 0.1591122 0.2752975 0.5401098

LearnBayes documentation built on May 1, 2019, 7:03 p.m.