<jupyter_start><jupyter_text>From Christiansen+ (2015), the gamma CDF is defined (Equation 1) as:$$F(x\,|\,a,b) = \frac{1}{b^a \Gamma(a)} \int_0^x t^{a-1} e^{-t/b}\,dt$$Scipy defines the [incomplete gamma function](http://docs.scipy.org/doc/scipy/reference/generated/scipy.special.gammainc.htmlscipy.special.gammainc) as follows:$$\gamma(a, x) = \frac{1}{\Gamma(a)} \int_0^x e^{-t} t^{a-1}\,dt$$These are almost the same.  Substitute $u = t/b$ into the Christiansen+ function:$$F(x\,|\,a,b) = \frac{1}{b^a \Gamma(a)} \int_0^{x/b} (bu)^{a-1} e^{-u}b\,du$$ $$F(x\,|\,a,b) = \frac{1}{b^a \Gamma(a)} b^{a-1}b \int_0^{x/b} u^{a-1} e^{-u}\,du$$ $$F(x\,|\,a,b) = \frac{1}{\Gamma(a)} \int_0^{x/b} e^{-u} u^{a-1}\,du = \gamma(a, x/b)$$This matches up with the Wikipedia definition of the gamma function CDF with $a \rightarrow k$ and $b \rightarrow \theta$.So this should be how to evaluate the gamma CDF from Christiansen+:<jupyter_code>from scipy.special import gammainc 

def gamma_cdf(x, a, b, c):
    return gammainc(a, (x-c)/b)
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

a, b, c = 4.35, 1.05, 4.1 #params from paper.  4.1 priv. comm. from Christiansen

snr = np.arange(0, 20, 0.1)
plt.plot(snr, gamma_cdf(snr, a, b, c));<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.22431372549019607, 'fraction_numerical': 0.02823529411764706, 'mean_word_length': 4.523809523809524, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '176551', 'license': 'MIT', 'n_tokens_mistral': 574, 'n_tokens_neox': 551, 'n_words': 132, 'path': 'survey-test.ipynb', 'repo_name': 'timothydmorton/fppop', 'size': '1275'}