plotHistoFitCompare()
$ {\Large ({\rm HW}-1)}$ $${\large {\rm Prove\ the}\ \subNsubR{n}{f}{r}\ {\rm Theorem\ by\ computing\ the\ chain\ integral.} }$$
Proof:
$$ \subNsubR{n}{f}{r}(x_r) dx_r = \Int{\{x_{i \neq r}\}_n}{} dP(\{x_i\}_n) = n! \Int{-\infty}{x_r} f(x_{r-1}) \Int{-\infty}{x_{r-1}} f(x_{r-2}) \cdots \Int{-\infty}{x_2} f(x_1) \Prod{i=1}{r-1} dx_i $$$$ \times\ f(x_r) dx_r \Int{x_r}{\infty} f(x_{r+1}) \Int{x_{r+1}}{\infty} f(x_{r+2}) \cdots \Int{x_{n-1}}{\infty} f(x_n) \Prod{j=r+1}{n} dx_j $$Integration by parts:
$$ \Int{-\infty}{x} f(\widetilde{x}) F^{a-1}(\widetilde{x}) d\widetilde{x} = \frac{1}{a} F^a(x) \qquad {\rm and} \qquad \Int{x}{\infty} f(\widetilde{x}) \left(1 - F(\widetilde{x})\right)^{a-1} d\widetilde{x} = \frac{1}{a} \left(1 - F(x)\right)^a $$makeHist(0)
makeHist(1)
makeHist(2)
makeHist(3)
makeHist(4)
makeHist(5)
makeHist(6)
makeHist(7)
makeHist(8)
makeHist(9)
${\Large ({\rm HW}-2) }$ $${\large {\rm Prove}: \qquad \Sum{r=1}{n} \frac{\subNsubR{n}{K}{r}}{n} F^{r-1}(x) \left(1 - F(x)\right)^{n-r} = 1, \quad \forall x. }$$
Proof (special thanks to Ola Liabøtrø, who solved this in his head during my talk):
$$\frac{\subNsubR{n}{K}{r}}{n} = \frac{(n-1)!}{(n-r)!(r-1)!} = \frac{(n-1)!}{(n-1-[r-1])!(r-1)!} = \subNsubR{n-1}{C}{r-1}$$Thus,
$$ \Sum{r=1}{n} \frac{\subNsubR{n}{K}{r}}{n} F^{r-1}(x) \left(1 - F(x)\right)^{n-r} = \Sum{r=1}{n} \subNsubR{n-1}{C}{r-1} F^{r-1}(x) \left(1 - F(x)\right)^{n-r} $$$$ = \Sum{r'=0}{n-1} \subNsubR{n-1}{C}{r'} F^{r'}(x) \left(1 - F(x)\right)^{n-1-r'} = (F(x) + 1 - F(x))^{n-1} = 1. \quad {}_\blacksquare $$Note: I proved this also. The hard way. Term-by-term. I could not see the relation to $\subNsubR{n-1}{C}{r-1}$.
${\large \left[\vec{G}_{(j)} \equiv {}_N K_r F^{r-1}_{\rm\rust{bg}}(x_{(j)}) \left( 1 - F_{\rm\rust{bg}}(x_{(j)}) \right)^{N-r} \right] }$.
makeDebinningPlot()
# One more pull for plotting purposes
x, f, F, data = quickData()
x, bgf, bgF, bgData = quickBG()
f /= F[-1]
bgf /= F[-1]
bgF /= F[-1]
F /= F[-1]
# Pretty plot
fig, axes = plt.subplots(figsize=(11,7), facecolor='#ffffff')
plt.fill_between(x, debinningUpper, debinningLower, color='#0088ff', alpha=0.3, zorder=1)
plt.plot(x, f, color='#0088ff', linewidth=3, zorder=3)
plt.plot(x, bgf, color='#0088ff', linestyle='-.', linewidth=3, zorder=3)
plt.plot(x, BIGdebinningData, color='black', linestyle='--', linewidth=3, zorder=4)
colors = np.array([(0.8,1.,0.4), (0.8,0.3,0.), (1.,1.,1.), (0.,0.,1.)])
for i, v in enumerate(x):
debinPlot.verticalColorBand(uncertaintyHistos[i], v, 0.5, colors)
axes.set_xticks(np.arange(0, 201, 50))
axes.set_xticks(np.arange(0, 201, 10), minor=True)
axes.set_xticklabels([r'$%i$' % int(num) for num in np.arange(0, 201, 50)], fontsize=20)
axes.set_ylim(bottom=-0.0001, top=0.0201)
axes.set_yticks(np.arange(0, 0.02, 0.005))
axes.set_yticklabels([r'$%0.3f$' % num for num in np.arange(0, 0.02, 0.005)], fontsize=20)
axes.set_yticks(np.arange(0, 0.02, 0.005/5), minor=True)
axes.set_xlabel('Physical Observable', labelpad=5, fontsize=22)
axes.set_ylabel('Probability', labelpad=5, fontsize=22)
axes.tick_params(length=10, width=1.2, labelsize=22, zorder=10, pad=10)
axes.tick_params(which='minor', length=5, width=1.2, zorder=11)
axes.minorticks_on()
print
fig, axes = plt.subplots(figsize=(11,7), facecolor='#ffffff')
plt.hist(chisq, bins=np.arange(0, 7.01, .05), color='#0088ff', edgecolor='#555555')
plt.hist(bgchisq, bins=np.arange(0, 7.01, .05), color='#66a61e', edgecolor='#555555', alpha=0.5)
axes.set_xticks(np.arange(0, 7.01, 1))
axes.set_xticks(np.arange(0, 7.01, .25), minor=True)
axes.set_xticklabels([r'$%1.1f$' % num for num in np.arange(0, 7.01, 1)], fontsize=20)
axes.set_ylim(bottom=-0.0001, top=6000)
axes.set_yticks(np.arange(0, 6001, 1000))
axes.set_yticks(np.arange(0, 6001, 250), minor=True)
axes.set_yticklabels([r'$%i$' % int(num) for num in np.arange(0, 6001, 1000)], fontsize=20)
axes.set_xlabel(r'$\chi^2$ per d.o.f.', labelpad=5, fontsize=22)
axes.set_ylabel('Number of Counts', labelpad=5, fontsize=22)
axes.tick_params(length=10, width=1.2, labelsize=22, zorder=10, pad=10)
axes.tick_params(which='minor', length=5, width=1.2, zorder=11)
axes.minorticks_on()
print
fig, axes = plt.subplots(figsize=(11,7), facecolor='#ffffff')
plt.hist(ks, bins=np.arange(0, 0.3, .002), color='#0088ff', edgecolor='#555555')
plt.hist(bgks, bins=np.arange(0, 0.3, .002), color='#66a61e', edgecolor='#555555', alpha=0.5)
axes.set_xticks(np.arange(0, 0.26, .05))
axes.set_xticks(np.arange(0, 0.26, .01), minor=True)
axes.set_xticklabels([r'$%0.2f$' % num for num in np.arange(0, 0.26, .05)], fontsize=20)
axes.set_ylim(bottom=-0.0001, top=5000)
axes.set_yticks(np.arange(0, 5001, 1000))
axes.set_yticks(np.arange(0, 5001, 250), minor=True)
axes.set_yticklabels([r'$%i$' % int(num) for num in np.arange(0, 5001, 1000)], fontsize=20)
axes.set_xlabel('KS test value', labelpad=5, fontsize=22)
axes.set_ylabel('Number of Counts', labelpad=5, fontsize=22)
axes.tick_params(length=10, width=1.2, labelsize=22, zorder=10, pad=10)
axes.tick_params(which='minor', length=5, width=1.2, zorder=11)
axes.minorticks_on()
print
from IPython.display import HTML
HTML('<iframe src=http://gambit.hepforge.org/ width=1000 height=350></iframe>')
GAMBIT is a global fitting code for generic Beyond the Standard Model theories, designed to allow fast and easy definition of new models, observables, likelihoods, scanners and backend physics codes.
GAMBIT is developed by a group of nearly 30 theorists and experimentalists. The Collaboration includes members of the AMS-02, ATLAS, CDMS, CTA, DARWIN, DM-ICE, Fermi-LAT, HESS, IceCube, LHCb and XENON experiments, as well as developers of the public theory codes DarkSUSY, FlexibleSUSY, IsaJet, SoftSUSY and SuperIso.
We are currently finalising the code in preparation for first public release in Summer 2015 — stay tuned!