A random variable \(X\) follows Kolmogorov-Gamma(b,c) distribution, in short KG(b,c), if
$$
X \stackrel{d}{=} \dfrac{1}{2\pi^2}\sum_{k=1}^\infty \dfrac{\epsilon_k}{k^2 + c^2/(4\pi^2)}, \quad \epsilon_k\stackrel{iid}{\sim} Gamma(b,1)
$$
where \(\stackrel{d}{=}\) denotes equality in distribution.
The random variate generation is based on alternating series method, a fast and exact method (without infinite sum truncation) implemented in cpp.
This function only supports integer b, which is sufficient for cobin and micobin regression models.
Usage
rkgcpp(n, b, c)
Value
It returns n independent Kolmogorov-Gamma(b[i],c[i]) samples. If input b or c is scalar, it is assumed to be length n vector with same entries.
Arguments
n
The number of samples.
b
First parameter, positive integer (1,2,...). Length must be 1 or n.
c
Second parameter, real, associated with tilting. Length must be 1 or n.