Fit Dirichlet parameters

fit.dirichlet(X, type = "mm")

fit.genDirichlet(X, type = "mm")

Arguments

X

samples from a dirichlet distribution

type

mm for Method of Moments estimation or ml for Maximum Likelihood estimation.

Value

A list giving the k value or vector of k values for the Generalized Dirichlet and vector of p estimates. The normal Dirichlet parameterization can be obtained by k*p. The fit.dirichlet function returns two estimates of k. One based on the most likely parameter in the distribution, the other based on a weighted mean of the k estimates for each parameter.

Examples

fit.dirichlet(matrix(c(.1, .9, .2, .8, .3, .7), nrow=3, ncol=2, byrow=TRUE), type="mm")
#> $most.likely.k #> [1] 15 #> #> $weighted.k #> [1] 15 #> #> $p #> [1] 0.2 0.8 #>
Z <- rdirichlet(100, c(4,3,2)) fit.dirichlet(Z)
#> $most.likely.k #> [1] 7.579004 #> #> $weighted.k #> [1] 7.176388 #> #> $p #> [1] 0.4292165 0.3230508 0.2477327 #>
fit.dirichlet(Z, "ml")
#> $k #> [1] 7.253508 #> #> $p #> [1] 0.4312446 0.3301110 0.2386444 #>
Z2 <- rGenDirichlet(100, c(0.7, 0.2, 0.1), c(10, 20, 20)) fit.genDirichlet(Z2)
#> $k #> [1] 10.66755 23.13743 23.13743 #> #> $p #> [1] 0.71556371 0.19311422 0.09132207 #>