Compute the closed-form variance of \(K_n\) under the Gnedin finite-type model (\(\sigma=-1\)).
Details
Using the factorial–ordinary moment relation
\(\mathbb{E}[K_n^2]=\mathbb{E}[K_n(K_n-1)]+\mathbb{E}[K_n]\), the variance is
$$
\mathrm{Var}(K_n) \;=\; \mathbb{E}[K_n(K_n-1)] + \mathbb{E}[K_n] - \{\mathbb{E}[K_n]\}^2,
$$
where
$$
\mathbb{E}[K_n(K_n-1)]
\;=\; n(n-1)(1-\gamma)\,\frac{\Gamma(n)\,\Gamma(1+\gamma)}{\Gamma(n+\gamma)}.
$$
The implementation uses lgamma for numerical stability and is vectorized
over n and gamma (with standard R recycling rules).
References
Gnedin, A. (2010). A species sampling model with finitely many types. Electronic Communications in Probability, 15, 79–88.
Favaro, S., Lijoi, A., & Prünster, I. (2013). Extending the class of Gibbs-type priors: theoretical properties and new examples. Annals of Applied Probability, 23(4), 1729–1754.
Pitman, J. (2006). Combinatorial Stochastic Processes. Springer.