R/rgendiri.R

Defines functions rgendiri

Documented in rgendiri

rgendiri <- function(n, a, b) {
  ##  n is the sample size
  ##  a is the parameters vector
  D <- length(a)
  y <- matrix( rgamma(n * D, a, b), ncol = D, byrow = TRUE )
  y / Rfast::rowsums(y)  ## Dirichlet simulated values
}

Try the Compositional package in your browser

Any scripts or data that you put into this service are public.

Compositional documentation built on Oct. 23, 2023, 5:09 p.m.