Skip to content

Instantly share code, notes, and snippets.

@emredjan
Created April 23, 2018 17:19
Show Gist options
  • Save emredjan/83d526e23a1994e189959b7e0af2a832 to your computer and use it in GitHub Desktop.
Save emredjan/83d526e23a1994e189959b7e0af2a832 to your computer and use it in GitHub Desktop.
QQ = ProbPlot(model_norm_residuals)
plot_lm_2 = QQ.qqplot(line='45', alpha=0.5, color='#4C72B0', lw=1)
plot_lm_2.set_figheight(8)
plot_lm_2.set_figwidth(12)
plot_lm_2.axes[0].set_title('Normal Q-Q')
plot_lm_2.axes[0].set_xlabel('Theoretical Quantiles')
plot_lm_2.axes[0].set_ylabel('Standardized Residuals');
# annotations
abs_norm_resid = np.flip(np.argsort(np.abs(model_norm_residuals)), 0)
abs_norm_resid_top_3 = abs_norm_resid[:3]
for r, i in enumerate(abs_norm_resid_top_3):
plot_lm_2.axes[0].annotate(i,
xy=(np.flip(QQ.theoretical_quantiles, 0)[r],
model_norm_residuals[i]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment