Skip to contents

For n draws from a Dirichlet process with precision alpha, returns \(E[K_n] = \sum_{i=1}^{n} \alpha / (\alpha + i - 1)\) and \(Var[K_n] = \sum_{i=1}^{n} \alpha (i - 1) / (\alpha + i - 1)^2\).

Usage

morie_gh_dp_ndistinct(n, alpha)

Arguments

n

sample size (positive integer)

alpha

Dirichlet-process precision (positive)

Value

list with elements mean and var, the expected number of distinct values and its variance

References

Ghosal, S. and van der Vaart, A. (2017). Fundamentals of Nonparametric Bayesian Inference. Cambridge University Press.

Examples

morie_gh_dp_ndistinct(n = 50, alpha = 2)
#> $mean
#> [1] 7.037626
#> 
#> $var
#> [1] 4.535558
#>