User:Beakerboy/sandbox


 * $$F(q;k,\nu)=\frac{\sqrt{2\pi}k\nu^{\frac{\nu}{2}}}{\Gamma\left(\frac{\nu}{2}\right)2^{\frac{\nu}{2}-1}}\int_0^\infty x^{\nu-1}\phi(\sqrt\nu x)\left[\int_{-\infty}^\infty \phi(u) (\Phi(u)-\Phi(u-qx))^{k-1} \, \text{d}u\right]\text{d}x$$

Differentiate with respect to q:
 * $${\mathrm{d}\over \mathrm{d}x} \left ( \int_{y_0}^{y_1} f(x, y) \,\mathrm{d}y \right )= \int_{y_0}^{y_1} f_x(x,y)\,\mathrm{d}y$$
 * $$f(q;k,\nu)=\frac{\sqrt{2\pi}k(k-1)\nu^{\frac{\nu}{2}}}{\Gamma\left(\frac{\nu}{2}\right)2^{\frac{\nu}{2}-1}}\int_0^\infty x^{\nu}\phi(\sqrt\nu x)\left[\int_{-\infty}^\infty \phi(u)\phi(u-qx) (\Phi(u)-\Phi(u-qx))^{k-2} \, \text{d}u\right]\text{d}x$$

if k=2
 * $$f(q;k,\nu)=\frac{\sqrt{\pi}\nu^{\frac{\nu}{2}}}{\Gamma\left(\frac{\nu}{2}\right)2^{\frac{\nu}{2}-2}}\int_0^\infty x^{\nu}\phi(\sqrt\nu x)\phi\left(\frac{-qx}{\sqrt2}\right)\text{d}x$$
 * $$f(q;k,\nu)=\frac{\nu^{\frac{\nu}{2}}}{\sqrt\pi\Gamma\left(\frac{\nu}{2}\right)2^{\frac{\nu}{2}-1}}\int_0^\infty x^{\nu}e^{\frac{-\nu x^2}{2}}e^{\frac{-q^2 x^2}{4}}\text{d}x$$
 * $$f(q;k,\nu)=\frac{\nu^{\frac{\nu}{2}}}{\sqrt\pi\Gamma\left(\frac{\nu}{2}\right)2^{\frac{\nu}{2}-1}}\int_0^\infty x^{\nu}e^{\frac{-(2\nu+q^2) x^2}{4}}\text{d}x$$
 * $$f(q;k,\nu)=\frac{\sqrt2 \nu^{\frac{\nu}{2}}}{\Gamma\left(\frac{\nu}{2}\right)2^{\frac{\nu}{2}-1}}\int_0^\infty x^{\nu}\phi\left(\sqrt\frac{2\nu+q^2}{2} x\right)\text{d}x$$
 * $$f(q;k,\nu)=\frac{\sqrt2 \nu^{\frac{\nu}{2}}}{\Gamma\left(\frac{\nu}{2}\right)2^{\frac{\nu}{2}-1}}\int_0^\infty \left(\frac{u}{\sqrt\frac{2\nu+q^2}{2}}\right)^{\nu}\phi(u)\text{d}u$$
 * $$f(q;k,\nu)=\frac{2^\frac{3}{2} \nu^{\frac{\nu}{2}}}{\left(2\nu+q^2 \right)^\frac{\nu}{2}\Gamma\left(\frac{\nu}{2}\right)}\int_0^\infty u^\nu \phi(u)\text{d}u$$

Since the samples per group must be equal, $$\nu$$ is even. This means $$\Gamma$$ can be converted into the factorial.


 * $$\int u^\nu \phi(u) \, \text{d}u = (\nu-1)!!\,\Phi(u) -\phi(u)\sum_{j=0}^{\frac{\nu-2}{2}}\frac{(\nu-1)!!}{(2j+1)!!}u^{2j+1} + C$$
 * $$f(q;k,\nu)=\frac{2^\frac{3}{2} \nu^{\frac{\nu}{2}}}{\left(2\nu+q^2 \right)^\frac{\nu}{2}\left(\frac{\nu-2}{2}\right)!}\left(\frac{(\nu-1)!!}{2} +\phi(0)\sum_{j=0}^{\frac{\nu-2}{2}}\frac{(\nu-1)!!}{(2j+1)!!}u^{2j+1}\right)$$