Take Web Data Analysis To The Next Level With PHP
The Constructor: Backbone Of The Chi Square Test
Listing 4 looks at the Chi Square constructor code which forms the backbone of the Chi Square test.
Listing 4. The Chi Square constructor
|
Four noteworthy aspects of the constructor method are:
- The constructor accepts an array of observed frequencies, an alpha probability cutoff score, and an optional array of expected probabilities.
- The first six lines involve relatively simple assignments and computed values that are recorded so a complete result object is available to calling scripts.
- The final four lines do the bulk of the work in obtaining the Chi Square statistics you are most interested in.
- The class implements only the Chi Square test logic. No output methods are associated with this class.
You can examine the class methods included in the code download for this article to find out more about how each result object value is computed (see Resources).
View Take Web Data Analysis To The Next Level With PHP Discussion
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 Next Page: Handle Output IssuesFirst published by IBM developerWorks