Skip to content

Instantly share code, notes, and snippets.

@upandacross
Last active December 29, 2015 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save upandacross/7615556 to your computer and use it in GitHub Desktop.
Save upandacross/7615556 to your computer and use it in GitHub Desktop.
How to visualize Bayesian goodness of fit for logistic regression
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