Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chi2pdf #4

Open
falseywinchnet opened this issue May 17, 2022 · 0 comments
Open

chi2pdf #4

falseywinchnet opened this issue May 17, 2022 · 0 comments

Comments

@falseywinchnet
Copy link

chi2_pdf = stats.chi2.pdf(chi2_data, df=data.size)

The chi2pdf estimation is dependent on df.
df, in the example demos, is set to data.size.

In the case of fabada_demo_spectrum, data.size is 1430 samples.

per wolfram alpha, the gamma function value of 715 is 1x10^1729,
which is well out of the calculation range of any desktop computer.

chi2_data = np.sum <-- a float
chi2_pdf = stats.chi2.pdf(chi2_data, df=data.size)

https://lost-contact.mit.edu/afs/inf.ed.ac.uk/group/teaching/matlab-help/R2014a/stats/chi2pdf.html

chi2_pdf = (chi2data** (N - 2) / 2) * numpy.exp(-chi2sum / 2)
/ ((2 ** (N / 2)) * math.gamma(N / 2))

As a result, this function is going to fail without any question, and numpy /python
will happily ignore the NaN value which is always returned.
this then turns
chi2_pdf_derivative
chi2_pdf_previous
chi2_pdf_snd_derivative
chi2_pdf_derivative_previous
into NaN values as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant