Conduct Web experiments using PHP, Part 2
By Paul Meagher2005-03-18
Poisson sampling model
The poisson distribution accepts only one parameter, a success-rate parameter called lambda (lambda). For a null effects poisson sampling model , you can efficiently simulate the effects of four independent poisson variables by instantiating the poisson distribution once with λ=0.045 and calling the RNG method four times (simulating 100 experimental trials per RNG call).
Listing 3. Simulating cell counts under the null effects poisson sampling model
<?php
require_once "config.php";
require_once PHPMATH . "/PDL/PoissonDistribution.php";
$lambda = 0.045;
$trials = 100;
$pois = new PoissonDistribution($lambda);
$cell1 = array_sum($pois->RNG($trials));
$cell2 = array_sum($pois->RNG($trials));
$cell3 = array_sum($pois->RNG($trials));
$cell4 = array_sum($pois->RNG($trials));
?>
The contingency table data appearing in Table 2 was generated by this script.
You can implement a poisson effects sampling model by instantiating your four poisson distributions with different lambda values to represent the differential effectiveness of your factors in eliciting a response.
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!

