# dirichlet.simul: Simulation of a Dirichlet Distributed Vectors In sirt: Supplementary Item Response Theory Models

## Description

This function makes random draws from a Dirichlet distribution.

## Usage

 `1` ```dirichlet.simul(alpha) ```

## Arguments

 `alpha` A matrix with \bold{α} parameters of the Dirichlet distribution

## Value

A data frame with Dirichlet distributed responses

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51``` ```############################################################################# # EXAMPLE 1: Simulation with two components ############################################################################# set.seed(789) N <- 2000 probs <- c(.7, .3) # define (extremal) class probabilities #*** alpha0=.2 -> nearly crisp latent classes alpha0 <- .2 alpha <- alpha0*probs alpha <- matrix( alpha, nrow=N, ncol=length(alpha), byrow=TRUE ) x <- sirt::dirichlet.simul( alpha ) htitle <- expression(paste( alpha[0], "=.2, ", p[1], "=.7" ) ) hist( x[,1], breaks=seq(0,1,len=20), main=htitle) #*** alpha0=3 -> strong deviation from crisp membership alpha0 <- 3 alpha <- alpha0*probs alpha <- matrix( alpha, nrow=N, ncol=length(alpha), byrow=TRUE ) x <- sirt::dirichlet.simul( alpha ) htitle <- expression(paste( alpha[0], "=3, ", p[1], "=.7" ) ) hist( x[,1], breaks=seq(0,1,len=20), main=htitle) ## Not run: ############################################################################# # EXAMPLE 2: Simulation with three components ############################################################################# set.seed(986) N <- 2000 probs <- c( .5, .35, .15 ) #*** alpha0=.2 alpha0 <- .2 alpha <- alpha0*probs alpha <- matrix( alpha, nrow=N, ncol=length(alpha), byrow=TRUE ) x <- sirt::dirichlet.simul( alpha ) htitle <- expression(paste( alpha[0], "=.2, ", p[1], "=.7" ) ) miceadds::library_install("ade4") ade4::triangle.plot(x, label=NULL, clabel=1) #*** alpha0=3 alpha0 <- 3 alpha <- alpha0*probs alpha <- matrix( alpha, nrow=N, ncol=length(alpha), byrow=TRUE ) x <- sirt::dirichlet.simul( alpha ) htitle <- expression(paste( alpha[0], "=3, ", p[1], "=.7" ) ) ade4::triangle.plot(x, label=NULL, clabel=1) ## End(Not run) ```

### Example output

```- sirt 3.4-64 (2019-05-03 18:33:11)
```

sirt documentation built on Feb. 18, 2020, 1:08 a.m.