This interactive demonstration compares individual sample testing to sample pooling for whole population testing. The idea is that nonscientists, e.g. policy makers, can sit and play with the sliders and get a feel for which variables have the most influence on outcomes of interest, comparing individual testing to sample pooling, a method in which samples from multiple people are mixed and tested using a single test.
This demo compares individual testing with sample pooling for COVID-19. See it live here:
https://www.robertjacobson.dev/BayesTesting/BayesTesting.html
It is possible to set default values with parameters in the URL:
The variables available to set from the URL are as follows:
const DEFAULT_VALUES = {
'pool_size' : 15,
'cost_per_test' : 100,
'people_count' : 10000,
'infection_rate' : 0.05,
'sensitivity' : 0.85,
'specificity' : 1.0,
'select_stats' : 'naive',
'stats_panel' : 'closed'
}
The sample pooling scheme pools samples from n individuals and uses a single test to test the pool. If the result is negative, the samples are assumed to be negative. If the result is positive, the individual (unpooled) samples are retested individually. (It is assumed a portion of the original individual samples are retained.) The model uses the counter-factual but simplifying assumption that the sensitivity and specificity for a pool is identical as for individual samples. It would be easy to include a feature that attenuates the sensitivity as an infected sample is increasingly diluted with larger pool sizes. Users can also account for dilution by lowering sensitivity.
It includes a feature I have not seen elsewhere in the literature: it computes the optimal pool size using a closed-form formula (if we include the Lambert-W function as "closed form"). Using the optimal pool size, we easily compute the minimum number of tests possible for the modeled testing scheme.
I had to write my own Lambert-W implementation, because the only Javascript version I could find online
cannot handle input less than
MIT License Copyright (c) 2020 Robert Jacobson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.