Last active
December 29, 2015 04:29
-
-
Save upandacross/7615556 to your computer and use it in GitHub Desktop.
How to visualize Bayesian goodness of fit for logistic regression
This file contains 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
figsize(12.5, 5) | |
simulations = mcmc.trace("bernoulli_sim")[:] | |
ck = ['darkgoldenrod', 'tomato', 'lime', 'darkblue', | |
'chocolate', 'crimson','green', 'cornflowerblue'] | |
plt.title("Simulated dataset using posterior parameters") | |
figsize(12.5, 6) | |
plt.scatter(temperature, D, marker='v', color="k", s=50, alpha=1., label='Observed') | |
for i in range(8): | |
plt.scatter(temperature, simulations[1000*i, :]+(i*.05), color=ck[i], | |
s=50, alpha=0.5, label='simulation {}'.format(1000*i)) | |
plt.xlim(xmax=92) | |
plt.ylim(ymax=1.8,ymin=-0.1) | |
plt.yticks([0,1],('OK','Fail')) | |
plt.xlabel("Temperature") | |
_ = plt.legend() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment