Conduct Web experiments using PHP, Part 2
By Paul Meagher2005-03-18
Explorer output
You could further develop this monte carlo procedure to obtain more rigorous estimates of the sample size required to reliably detect differences (in 95 percent of runs) given different estimates of the effect size (lambda value differences).
In the doe_explorer.php script, the $this->showContingencyTable() method is used to display simulated contingency table data:
Table 6. Output of the showContingencyTable() method
| text | ||||
| Short | Long | sum | ||
| image | Person | 24 | 12 | 36 |
| Product | 6 | 13 | 19 | |
| sum | 30 | 25 | 55 | |
The $this->showResiduals() method displays the difference between observed and expected counts (see Table 7). Note that the overall chi-square score is 6.18 and that the probability of this outcome under the independence model is 0.0130, which tells you that your test detected the interaction effect you specified. If you lower the $trials parameter value from 500 to 100, your ability to detect a specified interaction is diminished (which is one reason I chose a larger value of 500).
Table 7. Output of the showResiduals() method
| Cell | Oij | Eij | (Oij - Eij) | (Oij - Eij)2 | (Oij - Eij)2 / Eij |
| person-short | 24 | 19.64 | 4.36 | 19.04 | 0.97 |
| person-long | 12 | 16.36 | -4.36 | 19.04 | 1.16 |
| product-short | 6 | 10.36 | -4.36 | 19.04 | 1.84 |
| product-long | 13 | 8.64 | 4.36 | 19.04 | 2.20 |
| Sums | 55 | 55 | 0.00 | 76.17 | 6.18 |
| P(6.18, 1) = 0.0130 | |||||
| Critical X2 for alpha=0.05 is 3.84 | |||||
The $this->showBarGraph() method displays your simulated contingency table data in bar graph format:
Figure 3. Output of showBarGraph() method
The $this->showLineGraph() method displays your simulated data in line graph format:
Figure 4. Output of showLineGraph() method
Note that the line graph rendering makes it particularly easy to see that a cross-over interaction is present. You should also consider visualizing your results using grouped bar charts which is a graph type that JPGraph also supports.
First published by IBM developerWorks
|
|||||||||
You might also want to check these out:
|
Leave a Comment on "Conduct Web experiments using PHP, Part 2"
You must be logged in to post a comment.
Link to This Tutorial Page!

