Learn R Programming

IMIFA (version 1.3.1)

G_variance: 2nd Moment of Dirichlet / Pitman-Yor processes

Description

Calculates the variance in the number of clusters under a Dirichlet process or Pitman-Yor process prior for a sample of size N at given values of the concentration parameter alpha and optionally also the discount parameter. Useful for soliciting sensible priors for alpha or suitable fixed values for alpha or discount under the "IMFA" and "IMIFA" methods for mcmc_IMIFA, All arguments are vectorised.

Usage

G_variance(N, alpha, discount = 0L)

Arguments

N

The sample size.

alpha

The concentration parameter. Must be specified and must be strictly greater than -discount.

discount

The discount parameter for the Pitman-Yor process. Must lie in the interval [0, 1). Defaults to 0 (i.e. the Dirichlet process).

Value

The variance of the number of clusters under the specified prior conditions.

See Also

G_expected, G_priorDensity, Rmpfr

Examples

Run this code
# NOT RUN {
G_variance(N=50, alpha=19.23356)

# require("Rmpfr")
# G_variance(N=50, alpha=c(19.23356, 12.21619, 1), discount=c(0, 0.25, 0.7300045))
# }

Run the code above in your browser using DataLab