Learn R Programming

compositions (version 2.0-2)

fitdirichlet: Fitting a Dirichlet distribution

Description

Fits a Dirichtlet Distribution to a dataset by maximum likelihood.

Usage

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

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.

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.

References

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

See Also

rDirichlet, acompDirichletGOF.test, runif.acomp, rnorm.acomp,

Examples

Run this code
# NOT RUN {
x <- rDirichlet.acomp(100,c(1,2,3,4))
fitDirichlet(x)
# }

Run the code above in your browser using DataLab