# Updating the NAO Simulator

*Cross-posted from my [NAO Notebook](https://data.securebio.org/jefftk-notebook/simulator-update).*

In April we released [released](https://naobservatory.org/blog/simulating-approaches-to-metagenomic-pandemic-identification) a [tool](https://data.securebio.org/simulator/) to model the efficacy of different approaches to stealth pathogen identification. The tool's interface is pretty rough, which I'm not super happy about, but there just aren't that many people in the world who need to simulate the performance impact these design choices.

A month ago we published [estimates of RAi(1%) for influenza in municipal wastewater](https://naobservatory.org/blog/predicting-influenza-abundance), and ended that post with:

> In response to this work we plan to update our metagenomic biosurveillance simulator in two ways:
> 
> *   We'll switch the simulator's RAi(1%) from using the mean of the distribution to sampling from the full posterior distribution. Because our posteriors sometimes span several orders of magnitude, this change should better capture our uncertainty.
>     
> *   We'll replace our preliminary influenza A RAi(1%) point estimate of 3.2e-8 with an option to choose each of the four above distributions, with medians of 1.4e-8, 1.4e-8, 2.8e-9, and 7.0e-10.
>     
> 
> Overall we expect these changes to make our projections higher variance and somewhat less optimistic, but not to have a large impact on whether this approach to novel pathogen detection is practical.

With [Dan](https://dp-rice.github.io/)'s help I've now made both of these changes ([#6](https://github.com/naobservatory/scenario-simulator/pull/6), [#7](https://github.com/naobservatory/scenario-simulator/pull/7), [#9](https://github.com/naobservatory/scenario-simulator/pull/9)), and additionally:

*   Stopped assuming uniform coverage along the genome, and instead use the distribution we've observed along SARS-CoV-2. ([#5](https://github.com/naobservatory/scenario-simulator/pull/5)) While it would be better to generate estimates from a wider range of pathogens, everything else we've looked at in our samples has too much genetic diversity for it to be easy to make these estimates. Now that we've done some [spike-ins](https://naobservatory.org/blog/testing-with-spike-ins), however, I think it ought to be possible to use the highest concentration spike-in sample to get second estimate, though I haven't tried this. The overall effect of this change on our estimates should be to increase variance while slightly lowering median performance.
    
*   Updated the pricing we see for the NovaSeq X 25B and switched pricing to per-lane, based on the pricing we're seeing from sequencing providers. ([#10](https://github.com/naobservatory/scenario-simulator/pull/10)) It's great that sequencing is continuing to get cheaper!
    

Let's compare what the two simulators say for one weekly NovaSeq X 25B run, generating approximately 2e10 read pairs ([SARS-CoV-2](https://data.securebio.org/simulator/#scenario_ww_c=false&scenario_ns_c_1m=false&scenario_ww_f=false&scenario_ns_f_1m=false&custom_scenario=true&doubling_time=3&cv_doubling_time=10%25&genome_length=30%2C000&ww_rothman_scv2=true&ww_flu_a_mu=false&ww_flu_b_mu=false&ww_flu_a_uci=false&ww_flu_b_uci=false&nasal_scv2=false&nasal_flu=false&custom_sampling=false&sigma_shedding_values=0.05&direct_flaggable=false&shedding_duration=5&sigma_shedding_duration=0.05&low_quality=true&sample_population=500%2C000&sampling_m=false&sampling_t=false&sampling_w=true&sampling_r=false&sampling_f=false&sampling_s=false&sampling_u=false&sample_cost=200&nx25b=false&aviti=false&ns4=false&n6ksp3=false&n6ksp5=false&nanopore=false&custom_sequencing=true&sample_depth=2e10&read_length=300&run_cost=2%2C000&sequencing_m=false&sequencing_t=false&sequencing_w=true&sequencing_r=false&sequencing_f=false&sequencing_s=false&sequencing_u=false&processing_delay=4&min_observations=2&sites=1&overhead=50&cost=%24170%2C000&simulations=1%2C000&simulation_label=New%3A+Covid+WW+25B&shedding_values=Rothman-2697049&outcomes=%5B%7B%22percentile_outcomes%22%3A%5B0.00007427517267310035%2C0.00037808432759772195%2C0.0005660720006098655%2C0.0007067834990998055%2C0.0008023569754116725%2C0.0009202400523980523%2C0.0009955127719109276%2C0.0010656893319143084%2C0.0012017341454904557%2C0.001274481506367937%2C0.0013409592356045427%2C0.0014276877456426203%2C0.0014970303202146858%2C0.0015498802413057469%2C0.001639087021465545%2C0.001689233178187628%2C0.0017740819267808093%2C0.001808514101057008%2C0.001864369086009767%2C0.0019214576137649318%2C0.0020155699660204737%2C0.0020818907393471433%2C0.002161752917051283%2C0.002202228135253533%2C0.002290881719473468%2C0.0023921764318542323%2C0.002467475662054121%2C0.002556551975471362%2C0.0026255276505658285%2C0.002734875718145658%2C0.002786012198005171%2C0.0029467911377241804%2C0.0030404988262714133%2C0.0031381243997655717%2C0.0032834311641045753%2C0.0033578124513917737%2C0.0034519526545938547%2C0.0034933336068120042%2C0.0035643787220765877%2C0.0036111078490191654%2C0.0036878544994137234%2C0.0037480677200833834%2C0.003843332636351558%2C0.003927950957464172%2C0.004077014336843596%2C0.0041806716226397%2C0.004365461891133379%2C0.004506366938907424%2C0.0045855762393398405%2C0.004696368308902353%2C0.0047903514559471385%2C0.004850891991554023%2C0.004916911380095561%2C0.005050176711243629%2C0.005115929355385867%2C0.005243426021191524%2C0.005343566482814796%2C0.0054494036727494605%2C0.005585040464955641%2C0.005693828589277642%2C0.005816533979232851%2C0.005904783412034648%2C0.006139818603845666%2C0.006292239536946485%2C0.006379449181425265%2C0.006499108500501754%2C0.006618037773664414%2C0.006842441387378991%2C0.007056535250581488%2C0.007207837617774615%2C0.007367149029683035%2C0.007614150809453908%2C0.007808009933210631%2C0.008023447090539862%2C0.008263072862685869%2C0.008410089541312747%2C0.008690618082260577%2C0.008909219594867283%2C0.009169148495210408%2C0.009382444836833249%2C0.00946948639047771%2C0.009726755581031978%2C0.010446896612990414%2C0.010660651198452444%2C0.011043432013522744%2C0.011340035207183399%2C0.011749198699722692%2C0.012070733785349362%2C0.012696862506671099%2C0.0135112986046331%2C0.01392455210308228%2C0.014330886778555556%2C0.01473237232139621%2C0.01565847428465826%2C0.016234241340856312%2C0.017636902681420062%2C0.019441945957934397%2C0.022095038880632994%2C0.024520047467526614%2C0.03024927213291778%5D%2C%22label%22%3A%22Old%3A+Covid+WW+25B%22%2C%22cost%22%3A%22%241%2C800%2C000%22%7D%2C%7B%22percentile_outcomes%22%3A%5B0.000019533569964387262%2C0.0006122880434509529%2C0.0010419005743802531%2C0.0012467994717575252%2C0.0013919937281104803%2C0.0015529935697396265%2C0.001724570095558141%2C0.001903092020677208%2C0.0020925454037260816%2C0.002273019891812246%2C0.0023742357852908065%2C0.0025699798056552725%2C0.0027642297175964384%2C0.002910107520455309%2C0.00313489332418434%2C0.0033542554506073453%2C0.003510660920870775%2C0.0036479865700449073%2C0.003968779383405742%2C0.004070576402840593%2C0.00428918130073678%2C0.004540597247422322%2C0.004797951114077474%2C0.004908765795990809%2C0.005098772865647222%2C0.005340786437954146%2C0.005580100583699959%2C0.005797479159400073%2C0.0059718579735299785%2C0.006308041698454703%2C0.006512895220903718%2C0.006702157791375434%2C0.006880212912276371%2C0.007182321374665681%2C0.007496010832826687%2C0.007797994818608977%2C0.007994963133778319%2C0.008193476794513046%2C0.008543477166603643%2C0.008984806477166781%2C0.00917791381640491%2C0.009379992289071354%2C0.009627883702394997%2C0.009886453480261119%2C0.010034140197468927%2C0.010236221495048273%2C0.010762650575948647%2C0.011143543142642261%2C0.011722982052560843%2C0.012100457407669274%2C0.012408010400314473%2C0.012824143404406518%2C0.013040412274729032%2C0.013470000185921822%2C0.01405634888251743%2C0.014438398024027905%2C0.014627829781515495%2C0.01495748786506009%2C0.015687234463028384%2C0.016052384399186475%2C0.01683830314902006%2C0.01729262515487542%2C0.017675949194750067%2C0.01851927622951909%2C0.01928295785496977%2C0.01992678834712373%2C0.02058311525258734%2C0.021067214316343834%2C0.02192552205871573%2C0.022665923635747504%2C0.023472791284644308%2C0.02460578911015493%2C0.02561075490727204%2C0.027383633716747208%2C0.028221502285078165%2C0.029214980191580312%2C0.030146944494764013%2C0.031395426776935464%2C0.03240769695906946%2C0.03405105221153904%2C0.035593244736431995%2C0.03728346300120505%2C0.03862583741235321%2C0.041712022329155544%2C0.04320633901879842%2C0.04574507670042987%2C0.04799910216112082%2C0.05122379457429198%2C0.05491617208265954%2C0.059428131430378735%2C0.06530117481034327%2C0.0701282977441033%2C0.07732223882374972%2C0.08665594412193359%2C0.09579065821656188%2C0.10122126047912051%2C0.11946878811435946%2C0.12979502875840687%2C0.16763843903554979%2C0.2183780209145477%5D%2C%22label%22%3A%22New%3A+Covid+WW+25B%22%2C%22cost%22%3A%22%24170%2C000%22%7D%5D), [Flu A](https://data.securebio.org/simulator/#scenario_ww_c=false&scenario_ns_c_1m=false&scenario_ww_f=false&scenario_ns_f_1m=false&custom_scenario=true&doubling_time=3&cv_doubling_time=10%25&genome_length=14%2C000&ww_rothman_scv2=false&ww_flu_a_mu=true&ww_flu_b_mu=false&ww_flu_a_uci=false&ww_flu_b_uci=false&nasal_scv2=false&nasal_flu=false&custom_sampling=false&sigma_shedding_values=0.05&direct_flaggable=false&shedding_duration=5&sigma_shedding_duration=0.05&low_quality=true&sample_population=500%2C000&sampling_m=false&sampling_t=false&sampling_w=true&sampling_r=false&sampling_f=false&sampling_s=false&sampling_u=false&sample_cost=200&nx25b=false&aviti=false&ns4=false&n6ksp3=false&n6ksp5=false&nanopore=false&custom_sequencing=true&sample_depth=2e10&read_length=300&run_cost=2%2C000&sequencing_m=false&sequencing_t=false&sequencing_w=true&sequencing_r=false&sequencing_f=false&sequencing_s=false&sequencing_u=false&processing_delay=4&min_observations=2&sites=1&overhead=50&cost=%24170%2C000&simulations=1%2C000&simulation_label=New%3A+Flu+WW+25B&shedding_values=MU-11320&outcomes=%5B%7B%22percentile_outcomes%22%3A%5B0.00018646990273047848%2C0.0007514205772735518%2C0.0009669128913169029%2C0.001313830935529149%2C0.0014324117149129858%2C0.0016318211139128762%2C0.0018779774603410134%2C0.0021460952186641057%2C0.0022581112680641093%2C0.002438538751517667%2C0.002549648432028154%2C0.002686786483442676%2C0.0028319683384672332%2C0.0029344834610473248%2C0.00304913457521255%2C0.003250258820515169%2C0.0033734130648571357%2C0.003510303071163585%2C0.003604275768262532%2C0.003720771607736618%2C0.003913362026081988%2C0.0041356645150131795%2C0.004299265542554039%2C0.0044251565991184315%2C0.004523983106753859%2C0.004614327519152747%2C0.004734273509628849%2C0.004863779763267645%2C0.0049738900171695495%2C0.00506189889755663%2C0.005151134375939227%2C0.005261842440721027%2C0.005329993183608795%2C0.005435841342392041%2C0.005580995585019049%2C0.005743966907359373%2C0.005894811318238051%2C0.006060793984257654%2C0.0062680802689550775%2C0.006491401810019747%2C0.006622216382478672%2C0.006793048886593636%2C0.006938020493394152%2C0.0071294613671671865%2C0.007349194937387488%2C0.007584593550102547%2C0.00771425047882712%2C0.007812472587116813%2C0.00800541681614335%2C0.00823216440365984%2C0.008391844396929917%2C0.008576731153754%2C0.008822867896325212%2C0.009089766779579225%2C0.00935144623935473%2C0.009620583116981635%2C0.009974686795511042%2C0.010203598211226073%2C0.010507024689921552%2C0.010727142985406496%2C0.011155885201629866%2C0.011713391239570475%2C0.012121510361100051%2C0.012264599523309229%2C0.012458997045805754%2C0.012731642247635363%2C0.012963492569539903%2C0.013274885446970308%2C0.013611579198408571%2C0.013927564200713354%2C0.014312130010250085%2C0.014777339886913488%2C0.015344073193255859%2C0.015695901608030652%2C0.016107337897657434%2C0.016469773609991557%2C0.01694949131754918%2C0.01768254559280337%2C0.018020831111840607%2C0.01841019290530987%2C0.01921683296224103%2C0.019757970474904962%2C0.020301809311184082%2C0.021051540671455593%2C0.021702775094419067%2C0.022199427033675015%2C0.02300253884366953%2C0.023573386554127846%2C0.024586625163389053%2C0.025967556771246958%2C0.02701280498464542%2C0.027826615756256678%2C0.029818486143229576%2C0.03150925561478208%2C0.033113001977642095%2C0.036479078896777366%2C0.041085849232501706%2C0.04702371491737389%2C0.05128216759394917%2C0.06771821769291472%5D%2C%22label%22%3A%22Old%3A+Flu+WW+25B%22%2C%22cost%22%3A%22%241%2C000%2C000%22%7D%2C%7B%22percentile_outcomes%22%3A%5B0.000016300258601734187%2C0.0007271929743337682%2C0.0012260017268152508%2C0.0016087269234068794%2C0.002001109566000938%2C0.0023616986462216398%2C0.0028225499804638487%2C0.003040977344583466%2C0.00324137772826991%2C0.0035290878701562706%2C0.004212174073611923%2C0.004617055737696797%2C0.004893642689567864%2C0.005392712700682522%2C0.005684792441099856%2C0.006039778753630487%2C0.00629299106043559%2C0.006845434037906125%2C0.007146877526816671%2C0.007734033445660334%2C0.008209625955804717%2C0.008660123766698277%2C0.008941516485280633%2C0.00936202718693949%2C0.009905165727173607%2C0.010290411822948277%2C0.010843232620367833%2C0.011441442908209578%2C0.011911733785093878%2C0.012228875142181538%2C0.012762626014081324%2C0.012921898530849938%2C0.013575257103056095%2C0.01414095202727972%2C0.014611223482984144%2C0.01509413171069637%2C0.015591683453879915%2C0.016135759317815787%2C0.01666518605856083%2C0.017580687714925734%2C0.018441569875095112%2C0.018907044976850307%2C0.019452994270433937%2C0.0199377693864635%2C0.020174124176594768%2C0.020914499156534136%2C0.02168396174086313%2C0.02210699768772497%2C0.023288148940437438%2C0.023971034344831756%2C0.02469514184151222%2C0.02528535466243081%2C0.02621889147103789%2C0.027011838600843583%2C0.027576969723086674%2C0.028794336355152546%2C0.02980400037240683%2C0.030942222889433116%2C0.031717011132880564%2C0.03287198128067722%2C0.033726529636743975%2C0.034581196069936204%2C0.03590549127746777%2C0.03717704418952232%2C0.03836350157278436%2C0.040452690921519076%2C0.04157641935846015%2C0.04367842033083875%2C0.045287224411338575%2C0.04660475499195076%2C0.047676345974975755%2C0.049487623385497025%2C0.050746987307189344%2C0.05219832901766165%2C0.05418985600208767%2C0.05655110035516299%2C0.05937828854864521%2C0.06130913445934628%2C0.06345073359019826%2C0.06971790350544885%2C0.07256092545960628%2C0.07721955389068894%2C0.08152414318582153%2C0.08628547114389104%2C0.08960256661377328%2C0.09658046288137291%2C0.10231951612285052%2C0.1120836046186808%2C0.11836551553091954%2C0.12468692246867437%2C0.13601007301807108%2C0.1463966294241467%2C0.15934547894094372%2C0.1722156998165187%2C0.1842688327020914%2C0.21904833506659913%2C0.25493844901592505%2C0.29686251694788274%2C0.37274131796384435%2C0.6505619643430626%5D%2C%22label%22%3A%22New%3A+Flu+WW+25B%22%2C%22cost%22%3A%22%24170%2C000%22%7D%5D))

[![](https://www.jefftk.com/simulator-update-covid-ww-25b.png)](https://www.jefftk.com/simulator-update-covid-ww-25b-big.png)

[![](https://www.jefftk.com/simulator-update-flu-ww-25b.png)

](https://www.jefftk.com/simulator-update-flu-ww-25b-big.png)

Note that lower is better here: the charts show the fraction of people in the monitored sewershed who have ever been infected by the time we raise the alarm.

| Scenario | Cumulative Incidence at Detection |   |   |   |   |
| --- | --- | --- | --- | --- | --- |
| 25th | 50th | 75th | 90th |
| Old, SARS-CoV-2 | 0.24% | 0.48% | 0.84% | 1.40% |
| New, SARS-CoV-2 | 0.53% | 1.20% | 2.90% | 6.50% |
| *Change in Sensitivity, SARS-CoV-2* | -55% | -60% | -71% | -78% |
| Old, Flu A | 0.46% | 0.84% | 1.60% | 2.70% |
| New, Flu A | 1.00% | 2.50% | 5.70% | 14.00% |
| *Change in Sensitivity, Flu A* | -54% | -66% | -72% | -81% |

This makes sense overall: the changes were expected to both make the simulator less optimistic and increase the variance of its predictions, and that's what we do see.

*Comment via: [facebook](https://www.facebook.com/jefftk/posts/pfbid02qY1kdzhjkMiRSGrpyaL6USa2d82c1cbAUSg9MUqqDRhnpSEJHawjDNHuF55QiVnpl), [lesswrong](https://lesswrong.com/posts/ZP5tmbh6TXmQmQmuw), [mastodon](https://mastodon.mit.edu/@jefftk/113396699876012995)*