What is the small peak I see when plotting a noncentral chi squared function?

34 Views Asked by At

When I try to plot a noncentral chi-squared distribution (in Python):

from scipy.stats import ncx2
fig = plt.figure(figsize=(20,8))
x =  np.arange(0.0,100.0,0.01)
y = ncx2.pdf(x, df=1.0, nc=10.0)
plt.plot(x,y)
plt.show()

I get the following: enter image description here

I'm wondering what this small peak is near x=0. It seems to be an artifact of my code, but can anyone please explain further?

1

There are 1 best solutions below

2
On

If I am not mistaken $$y=\frac{e^{-\frac{x+10}{2} } \cosh \left(\sqrt{10x} \right)}{\sqrt{2 \pi x }}$$ Computing the derivative, the minimum corresponds to the zero of function $$f(x)=\sqrt{10x} \, \sinh \left(\sqrt{10x}\right)-(x+1) \cosh \left(\sqrt{10x} \right)$$ which does not show explicit solution.

Since $x$ is small, using series $$f(x)=-1+4 x+\frac{15}{2}x^2+O\left(x^3\right)$$ which gives an estimate of $$x \sim\frac{\sqrt{46}-4}{15}=0.1855$$ while the exact solution is $x=0.1829$.

At this point, $y=0.0118$.