Helping ordinary people create extraordinary websites!

Conduct Web experiments using PHP, Part 2

By Paul Meagher
2005-03-18

Poisson sampling model
The binomial distribution converges to the poisson distribution for large values of N and small values of p . While the binomial distribution is still conceptually applicable to simulating your results, the poisson distribution is more often used to represent rare-event distributions and behaves more reliably than my current binomial distribution implementation when supplied with extreme parameter settings (such as large N values and small p values).

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.



Tutorial pages:

First published by IBM developerWorks


 1 Votes

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!


GET OUR NEWSLETTERS