Chi2 comparison of X-Y points and a function (chi2, p-values)
Source code name: "stat_chi2_p1d.py"
Programming language: Python
Topic: Statistics/Tests
DMelt Version 1. Last modified: 12/11/2015. License: Free
https://datamelt.org/code/cache/stat_chi2_p1d_2915.py
To run this script using the DataMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.



from jhplot  import * 

p=P1D("Data")
p.add(1, 9, 3); p.add(2, 21, 5); p.add(3, 36, 6)
f=F1D('10+x*x*x',1,3)
print p.compareChi2(f)
c=HPlot()
c.visible()
c.setAutoRange()
c.draw(p);  c.draw(f)