Chi Square Probability Distribution Code Using PHP

This example is a Web application piece of code that I wrote to add a (approximate) p-value to some dynamically generated crosstabs. This will allow a researcher to provide a way to deliver data over the web and will allow the researcher a way to calculate the p-value from a distribution based on input data. In order to use this function the researcher must calculate the value first by using the standard equation: . In addition to the statistic the researcher needs to provide the degrees of freedom.