Join us for
RADAR: AI Edition

VGAM (version 1.0-4)

dirichlet: Fitting a Dirichlet Distribution

Description

Fits a Dirichlet distribution to a matrix of compositions.

Usage

dirichlet(link = "loge", parallel = FALSE, zero = NULL, imethod = 1)

Arguments

link

Link function applied to each of the M (positive) shape parameters αj. See Links for more choices. The default gives ηj=log(αj).

parallel, zero, imethod

See CommonVGAMffArguments for more information.

Value

An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm, rrvglm and vgam.

When fitted, the fitted.values slot of the object contains the M-column matrix of means.

Details

In this help file the response is assumed to be a M-column matrix with positive values and whose rows each sum to unity. Such data can be thought of as compositional data. There are M linear/additive predictors ηj.

The Dirichlet distribution is commonly used to model compositional data, including applications in genetics. Suppose (Y1,,YM)T is the response. Then it has a Dirichlet distribution if (Y1,,YM1)T has density Γ(α+)j=1MΓ(αj)j=1Myjαj1 where α+=α1++αM, αj>0, and the density is defined on the unit simplex ΔM={(y1,,yM)T:y1>0,,yM>0,j=1Myj=1}. One has E(Yj)=αj/α+, which are returned as the fitted values. For this distribution Fisher scoring corresponds to Newton-Raphson.

The Dirichlet distribution can be motivated by considering the random variables (G1,,GM)T which are each independent and identically distributed as a gamma distribution with density f(gj)=gjαj1egj/Γ(αj). Then the Dirichlet distribution arises when Yj=Gj/(G1++GM).

References

Lange, K. (2002) Mathematical and Statistical Methods for Genetic Analysis, 2nd ed. New York: Springer-Verlag.

Forbes, C., Evans, M., Hastings, N. and Peacock, B. (2011) Statistical Distributions, Hoboken, NJ, USA: John Wiley and Sons, Fourth edition.

See Also

rdiric, dirmultinomial, multinomial, simplex.

Examples

Run this code
# NOT RUN {
ddata <- data.frame(rdiric(n = 1000,
                           shape = exp(c(y1 = -1, y2 = 1, y3 = 0))))
fit <- vglm(cbind(y1, y2, y3)  ~ 1, dirichlet,
            data = ddata, trace = TRUE, crit = "coef")
Coef(fit)
coef(fit, matrix = TRUE)
head(fitted(fit))
# }

Run the code above in your browser using DataLab