Created
March 2, 2022 04:30
-
-
Save meraldo-aliz/13671b58666fffed46f6d12df4b2b608 to your computer and use it in GitHub Desktop.
lifetimes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import scipy.stats as stats | |
| from matplotlib import pyplot as plt | |
| fig, (ax_gamma, ax_beta) = plt.subplots(ncols=1, nrows =2, figsize = (20, 16)) | |
| x_gamma = np.linspace(0, 10, 1000) | |
| y_gamma = stats.gamma.pdf(x_gamma, a=bgf.params_["alpha"], scale=bgf.params_["r"]) | |
| ax_gamma.plot(x_gamma, y_gamma, "-") | |
| ax_gamma.set_title(f'Gamma distribution (alpha = {bgf.params_["alpha"]:.2f}, scale (r) = {bgf.params_["r"]:.2f})') | |
| ax_gamma.set_xlabel(r'$\lambda$') | |
| ax_gamma.set_ylabel(r'$P(\lambda)$') | |
| x_beta = np.linspace(0, 1, 100) | |
| y_beta = stats.beta.pdf(x_beta, a=bgf.params_["a"], b=bgf.params_["b"]) | |
| ax_beta.plot(x_beta, y_beta, "-") | |
| ax_beta.set_title(f'Beta distribution (a = {bgf.params_["a"]:.2f}, b = {bgf.params_["b"]:.2f})') | |
| ax_beta.set_xlabel('p') | |
| ax_beta.set_ylabel('P(p)') | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment