fitdirichlet: Fitting a Dirichlet distribution In compositions: Compositional Data Analysis

Description

Fits a Dirichtlet Distribution to a dataset by maximum likelihood.

Usage

 1 fitDirichlet(x,elog=mean(ult(x)),alpha0=rep(1,length(elog)),maxIter=20,n=nrow(x))

Arguments

 x a dataset of compositions (acomp) elog the expected log can provided instead of the dataset itself. alpha0 the start value for alpha parameter in the iteration maxIter The maximum number of iterations in the Fischer scoring method. n the number of datapoints used to estimate elog

Details

The fitting is done using a modified version of the Fisher-Scoring method using analytiscal expressions for log mean and log variance. The modification is introducted to prevent the algorithm from leaving the admissible parameter set. It reduced the stepsize to at most have of distance to the limit of the admissible parameter set.

Value

 alpha the estimated parameter loglikelihood the likelihood df The dimension of the dataset minus the dimension of the parameter

Missing Policy

Up to now the fitting can not handle missings.

Author(s)

K.Gerald v.d. Boogaart http://www.stat.boogaart.de

References

Aitchison, J. (1986) The Statistical Analysis of Compositional Data Monographs on Statistics and Applied Probability. Chapman & Hall Ltd., London (UK). 416p.

Examples

 1 2 x <- rDirichlet.acomp(100,c(1,2,3,4)) fitDirichlet(x)

Example output

Attaching package: 'tensorA'

The following object is masked from 'package:base':

norm

Welcome to compositions, a package for compositional data analysis.
Find an intro with "? compositions"

Attaching package: 'compositions'

The following objects are masked from 'package:stats':

cor, cov, dist, var

The following objects are masked from 'package:base':

%*%, scale, scale.default

Warning message:
In structure(c(), class = c(class(x), class(y))) :
Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
\$alpha
 0.9252514 2.1381038 2.8845571 3.9291478

\$loglikelihood
 -1737.571

\$df
 296

Warning message:
In structure(c(), class = c(class(x), class(y))) :
Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.