Welcome to the Parallax Discussion Forums, sign-up to participate.

# Optimum COVID-19 Testing Pool Size vs. Positivity

Posts: 22,742
The news lately has suggested that COVID-19 tests could be done more efficiently by combining, say, 25 samples into one batch and testing the batch as a whole. Then, if the batch tests positive, go back and retest individuals within the batch. This has the potential of reducing the total number of tests required. (BTW, it's not clear from the reports I've read whether two samples are taken from each individual, so they don't need to be called back, or whether those individuals in a positive pool need to return for another test.)

This got me to wondering, given a known percentage of expected positive tests (the "positivity" number), what the optimum pool size would be to minimize the total number of tests required in a given population. So I wrote a program in Perl that does a Monte Carlo simulation of the testing regimen for a population of 100,000 individuals, for pool sizes ranging from 1 to 50, and positivities from 0.01 to 0.50. Here's the program:
```use strict;
\$|=1;

my \$population = 100000;

foreach my \$i (1 .. 50) {
my \$positivity = \$i / 100;
my \$min_tests = 1e38;
my \$best_pool;

foreach my \$pool_size (1 .. 50) {
my \$ntests = do_tests(100000, \$pool_size, \$positivity);
if (\$ntests < \$min_tests) {
\$min_tests = \$ntests;
\$best_pool = \$pool_size;
}
}
print "\$positivity \$best_pool \$min_tests\n";
}

sub do_tests {
my (\$population, \$pool_size, \$positivity) = @_;
my \$ntests = 0;
foreach (0 .. \$population / \$pool_size - 1) {
\$ntests++;
foreach my \$test (0 .. \$pool_size - 1) {
if (rand(1) < \$positivity) {
\$ntests += \$pool_size unless \$pool_size == 1;
last
}
}
}
return \$ntests
}
```

The optimum pool sizes were pretty low, starting at 10 for a positivity of 1% and dropping rapidly as the positivity increased. Above a positivity of 30%, there was no advantage to using pooling, as the graphs below demonstrate:

I was hoping to send my results to the CDC or NIH, but I was scooped! The following paper appeared in JAMA last month:

https://jamanetwork.com/journals/jamanetworkopen/fullarticle/2767513

At least it was nice to see that their results agreed with my own!

-Phil

P.S. If anyone objects to my posting this here, due to its lack of any relation to Parallax or its products, I might be happy to rewrite the Perl program in Spin.

• Posts: 11,687
• Posts: 22,742
Publison wrote:
I don't know if I'd go that far. Why do you think I'm no longer a moderator?

-Phil
• Posts: 11,687
Point taken.😁
• Posts: 607
Well it does deal with a problem that a programmer might have to handle, so I think its very relevant. Thanks!
• Posts: 2,046
edited 2020-07-21 - 06:57:18
I might be happy to rewrite the Perl program in Spin.

Was that a gauntlet laid splendidly and spinningly on oneself, Phil?

• Posts: 22,742
VonSzarvas wrote:
Was that a gauntlet laid splendidly and spinningly on oneself, Phil?
Um, not by design!

-Phil
• Posts: 16,603
Sadly, I look at the world meters regularly. In particular, and obviously to some, I look at Australia, then UK (my daughter and family reside there) and the USA.
By comparing the cases v deaths, the ratios don’t match very well. It seems the case numbers reported are either so far under the actual cases, or the medical facilities are terrible in some countries.
• Posts: 1,712
I would look at world meters as very badly out of cal devices. Just way to many fingers in the tray offsetting the values for a particular bias and / or agenda. Kinda like using that really sketchy scope you got on ebay really cheap that ended up there because the cal was whack and would never be correct again. Personally I think everyone will have been exposed before the year is out. I am in an area wide reasearch study for healthcare workers. 4 tests quarterly. Not really worried, but not complacent either. Inclined to go with the docs saying bug is aerosolized, so politically correct or not, mask makes some sense. Just standard precautions.
• Posts: 1,733
I am on-site and have been for ages.
Pubs reopened on the 4th and so now I can enjoy a proper sit-down meal.

Place is busy, no social distancing...people in groups and rowdy as they used to be.

But nobody is trying to topple a President here. Just sayin. Prolly get deleted anyway.
• Posts: 19,766
Mickster: It's really nice to hear that life is some kinda normal SOMEWHERE. Not here for a while (after the election, I presume) but you give us hope. Thanks for that!

And Phipi, tip-top work as always. Will YOU please consider a PotUS nomination?
• Posts: 22,742
There was an article in the NY Times today about test pooling. Apparently dilution is an issue, wherein someone might be weakly infected, and their test sample gets so diluted in the pool as to be undetectable. Research shows that the maximum reliable limit for pool size is five, which corresponds roughly to an average positivity of 5% and below. At five samples in the pool and below, dilution was shown not to be a problem.

With the limit-of-five in mind, I reran the simulation and got these results:

-Phil
• Posts: 1,712
Phil, there is government money for you somewhere out there for certain. Well, within a limit of probability..
Of course the dilution can be offset by designated no-shows.
• Posts: 22,742
Here's a NY Times article that describes an even more efficient pooling technique:

https://www.nytimes.com/2020/08/21/health/fast-coronavirus-testing-israel.html

By using a combinatoric method akin to error-correcting codes, the scientists claim ability to test 384 individuals using only 48 tests, with no repeat testing required for positive samples. They do this by distributing each person's sample among several pools in such a way that a spectrum of positive tests will reveal the positive individual(s). There are some caveats, though, namely an upper limit on overall positivity for the method to work, and dilution due to the rather large pool sizes involved. The latter is concerning in light of other research noted in my post above.

-Phil