fitDirichlet: Fit a Dirichlet distribution to elicited marginal...

View source: R/fitDirichlet.R

fitDirichletR Documentation

Fit a Dirichlet distribution to elicited marginal distributions for proportions

Description

Takes elicited beta distributions for a set of proportions as inputs, and fits a Dirichlet distribution. The beta parameters are adjusted so that the expectations sum to 1, and then the sum of the Dirichlet parameters is chosen based on the sums of the beta parameters for each elicited marginal

Usage

fitDirichlet(
  ...,
  categories = NULL,
  n.fitted = "opt",
  plotBeta = TRUE,
  xlab = "x",
  ylab = expression(f[X](x)),
  fs = 12,
  silent = FALSE
)

Arguments

...

Multiple arguments, each an objects of class elicitation, one per marginal proportion, separated by commas. The sequence can be specified as a single argument by containing all the elicitation objects within a single list object.

categories

A vector of strings labelling the marginal proportions.

n.fitted

The method used to determine the sum of the Dirichlet parameters. Use "opt" for best fitting, derived by matching standard deviations from the elicited marginals and the fitted Dirichlet; "min" for a conservative choice based on the smallest equivalent sample size (sum of the beta parameters) from the elicited marginals; "med" for the median of the smallest and largest largest equivalent sample size from the elicited marginals; "mean" for the mean of all the equivalent sample sizes from the elicited marginals.

plotBeta

logical. Plot the original elicited marginals and the fitted marginals from the Dirichlet fit.

xlab

x-axis label on the marginal distribution plot.

ylab

y-axis label on the marginal distribution plot.

fs

The font size used in the plot.

silent

Set to TRUE to suppress printing of results to the console.

Value

The parameters of the fitted Dirichlet distribution.

Author(s)

Jeremy Oakley <j.oakley@sheffield.ac.uk>

References

Zapata-Vazquez, R., O'Hagan, A. and Bastos, L. S. (2014). Eliciting expert judgements about a set of proportions. Journal of Applied Statistics 41, 1919-1933.

Examples

## Not run: 
p1 <- c(0.25, 0.5, 0.75)
v1 <- c(0.5, 0.55, 0.6)
v2 <- c(0.22, 0.3, 0.35)
v3 <- c(0.11, 0.15, 0.2)
myfit1 <- fitdist(v1, p1, 0, 1)
myfit2 <- fitdist(v2, p1, 0, 1)
myfit3 <- fitdist(v3, p1, 0, 1)
d <- fitDirichlet(myfit1, myfit2, myfit3,
                  categories = c("A","B","C"),
                  n.fitted = "opt")

# Note that this will also work:
d <- fitDirichlet(list(myfit1, myfit2, myfit3),
                  categories = c("A","B","C"),
                  n.fitted = "opt")


## End(Not run)

SHELF documentation built on Sept. 11, 2024, 6:54 p.m.