Saturday, April 24, 2021

Der Satz von Bayes während der modernen Pest

Haftungsausschluss: Ich bin eine Mathematikerin mit Interesse an der öffentlichen Gesundheit, keine Ärztin. Bitte sprechen Sie mit einem Arzt, um medizinischen Rat zu erhalten. Diese Website kann medizinische Fachkräfte nicht ersetzen. Wenn Sie sich hier auf Informationen verlassen, geschieht dies auf eigenes Risiko. Ich werde diese Informationen nach Bedarf aktualisieren, aber ich kann nicht garantieren, dass alles korrekt ist. Es gibt keinerlei Garantie und ich kann nicht garantieren, dass diese Website für Sie funktioniert.

Dies ist ein Wahrscheinlichkeitsrechner, der von Ihrer Eingabe abhängt.

Welche Informationen erhalten Sie, wenn Sie einen Schnelltest für COVID-19 durchführen? Klicken Sie unten auf die Schaltfläche "Berechnen", um zu sehen, was mit einigen typischen Werten passiert, und versuchen Sie dann, mit den Werten für die Sensitivität und Spezifität von Tests (siehe unten) sowie Ihrem allgemeinen Risiko für COVID-19 zu spielen, je nach der Situation in Ihrem Bereich. Der Text unter der Schaltfläche "Berechnen" ändert sich abhängig von Ihrer Eingabe.

Mathematik ist in blau geschrieben. Diese Teile können übersprungen werden, es sei denn, man möchte die Methoden verstehen.

Sensitivität: %
Wenn Sie COVID-19 haben, wie oft wird Ihr Test es erkennen? Das Timing ist wichtig, ebenso wie die Testqualität. Daher ist die Antwort kompliziert. Dieser Forschungsbericht* ergab einen Bereich von Sensitivitäten von 0 bis 80% für PCR-Tests basierend auf Tagen nach der Infektion (0% am ersten Tag nach der Infektion, 67% an 4 Tagen nach der Infektion, 80% an 8 Tagen nach der Infektion und allmählich danach abnehmend). Die Gefahrenzone scheint vom 2. bis 5. Tag zu sein, wenn die Tests das Virus häufig nicht erkennen und die Symptome fehlen oder gerade erst beginnen, infizierte Personen jedoch wahrscheinlich ansteckend sind. In diesem Artikel wurde davon ausgegangen, dass Tag 5 der Tag des Symptombeginns war, sodass die Zeitachse für Personen mit längeren Inkubationszeiten verschoben werden kann. Die Empfindlichkeit ist bei Schnelltests geringer als bei PCR-Tests, insbesondere wenn die Anweisungen zur Lagerung und Verwendung nicht genau befolgt werden. Eine Cochrane Review**, bei der der Zeitpunkt des Tests ignoriert wird, ergibt 58% bis 75% als Schnelltest Sensitivität für asymptomatische Personen. Hersteller von Schnelltests behaupten regelmäßig, eine viel höhere Empfindlichkeit zu erzielen (98% bei meinem), aber es ist schwierig für mich zu verstehen, warum Krankenhäuser PCR-Tests immer noch als Standard verwenden würden, wenn die Schnelltests besser, billiger und schneller wären. Eine gewisse Klarheit ergibt sich aus dem Artikel von Lancet "Buyer Beware: inflated claims of sensitivity for rapid COVID-19 tests" von Fitzpatrick et al. Hersteller geben die prozentuale positive Übereinstimmung an und nennen sie Sensibilität. Die prozentuale positive Übereinstimmung gibt an, welcher Anteil der positiven PCR-Tests auch von diesem Schnelltest erfasst wurde.

Spezifität: %
Wenn Sie COVID-19 nicht haben, wie oft wird der Test korrekt negativ ausfallen? Dies liegt bei der meisten Tests zwischen 98.8% und 99.9%. Der niedrigste Wert, den ich jemals gesehen habe, war 97%.

Prävalenz: pro 100,000

Wie wahrscheinlich ist es, dass Sie COVID-19 haben? Dies ist die Inzidenz in Ihrer Region, die an Ihre individuelle Situation angepasst wird, wenn es wahrscheinlich sehr unterschiedlich ist. Sind Sie mit jemandem in Kontakt gekommen, der positiv getestet wurde? Hat sich jeder in Ihrem Haushalt entschlossen, mit Kontakten äußerst vorsichtig umzugehen?

*"Variation in False-Negative Rate of Reverse Transcriptase Polymerase Chain Reaction–Based SARS-CoV-2 Tests by Time Since Exposure" by Kucirka et al. in Annals of Internal Medicine

**"Rapid, point‐of‐care antigen and molecular‐based tests for diagnosis of SARS‐CoV‐2 infection" by Dinnes et al. in the Cochrane database of Systematic Reviews (accessed 27 April, 2021)

Klicken Sie auf "Berechnen", um die Antworten auf die Fragen basierend auf Ihren Eingaben anzuzeigen. Dezimalstellen werden mit einem Punkt dargestellt.

Was sind die Ergebnisse, wenn 100.000 zufällige Personen Tests machen?

Um dies zu erreichen, multiplizieren wir 100.000 mit der Wahrscheinlichkeit jedes möglichen Ereignisses. Die Wahrscheinlichkeit jedes Ereignisses ist in Klammern angegeben.

Leute haben COVID-19, und ihre Tests sind positiv. (Prävalenz mal Sensitivität)
Leute haben COVID-19, und ihre Tests sind negativ. (Prävalenz mal [1-Sensitivität])
Leute haben kein COVID-19, und ihre Tests sind positiv. ([1 minus Prävalenz] mal [1-Spezifität])
Leute haben kein COVID-19, und ihre Tests sind negativ. ([1 minus Prävalenz] mal Spezifität)

Für diejenigen, die sich für Mathematik interessieren: Eine Regel, die ich gerade hier verwendet habe, ist, dass die Wahrscheinlichkeit, dass etwas nicht passiert, ist 100% (oder 1) minus der Wahrscheinlichkeit, dass es passiert. Wenn ein Test beispielsweise in 20% der Fälle COVID-19 erkennt, wird er in 80% der Fälle nicht erkannt. Sie subtrahieren nur 20% von 100%, um 80% zu erhalten. Diese Regel wird auch viel später auftauchen. Eine andere Regel ist die Multiplikation von Wahrscheinlichkeiten. Wenn Sie die Wahrscheinlichkeit haben möchten, dass zwei unabhängige Dinge passieren (z. B. Sie werfen eine Münze und erhalten Köpfe UND Sie wählen die richtige von vier Türen aus), multiplizieren Sie einfach ihre Wahrscheinlichkeiten. In diesem Fall 50% mal 25% (Köpfe befinden sich auf einer von zwei Seiten der Münze. Eine der vier Türen ist richtig.). Wenn die Ereignisse nicht unabhängig sind, müssen Sie die bedingte Wahrscheinlichkeit verwenden. Zum Beispiel wollen wir die Wahrscheinlichkeit, dass jemand COVID-19 hat und sein Test positiv ist. Da der Test COVID-19 erkennt und eine höhere Wahrscheinlichkeit hat, positiv zu sein, wenn jemand an der Infektion leidet, sind diese Ereignisse nicht unabhängig. In diesem Fall multiplizieren wir zwei Dinge: (1) die Wahrscheinlichkeit, dass jemand COVID-19 hat, und (2) die Wahrscheinlichkeit, dass ein Test positiv ist, wenn jemand COVID-19 hat.

Wie stark ändert sich mein Infektionsrisiko, wenn ich einen Test mache?

Ihr Risiko, vor dem Test COVID-19 zu haben, war die oben aufgeführte Prävalenz. Das heißt, dass % von Leute in deine Nähe und Situation haben COVID-19.

Sobald Sie einen negativen Test erhalten, ändert sich dieser in . Dies ist die Anzahl der Personen mit COVID-19 und einem negativen Test geteilt durch die Gesamtzahl der Personen mit einem negativen Test in den obigen Berechnungen. Dies bedeutet, dass % der Personen, die einen negativen Test erhalten haben, COVID-19 haben. Mit realistischen Werten in der Allgemeinbevölkerung sind die Chancen für Sie als Einzelperson mit oder ohne Test nicht viel anders: wahrscheinlich irgendwo um ein Zehntel Prozent.

Der Satz von Bayes gibt eine Möglichkeit, bedingte Wahrscheinlichkeiten, die Sie kennen, gegen solche auszutauschen, die Sie nicht kennen. Hier wollten wir wissen, wie hoch Ihr Risiko für COVID-19 war, wenn Sie einen negativen Test hatten. Aufgrund der Sensitivität wussten wir jedoch nur, wie hoch die Wahrscheinlichkeit war, einen negativen Test zu erhalten, wenn Sie COVID-19 hatten. Um die Reihenfolge zu ändern, können Sie die Formel Bayes verwenden oder einen Bayes-Baum zeichnen.

Wenn ich COVID-19 habe, wie hoch ist die Wahrscheinlichkeit, dass der Test es erkennt?

Das ist nur die Sensitivität, die Sie oben angegeben haben (%). Also von 100 Personen mit COVID-19 durch den Test erkannt werden und nicht. Hier werden die Dinge aus Sicht der öffentlichen Gesundheit wichtig. Wenn bei den Tests einige COVID-19-Fälle festgestellt werden, die Menschen jedoch aufgrund des Vertrauens in die negativen Tests häufiger ausgehen oder risikoreichere Aktivitäten ausführen, kann dies zu mehr Infektionen führen. Angesichts der hier angegebenen Werte müssen die Menschen ihr Infektionsrisiko um den Faktor erhöhen, bevor die Tests für sie nutzlos werden. Wenn sie ihr Risiko um mehr erhöhen, verursachen die Tests mehr Fälle als sie verhindern. Sie können die Sensitivität ändern, um zu untersuchen, wie sich dieser Faktor ändert. Weitere Informationen dazu finden Sie weiter unten.

Wenn ich einen positiven Test bekomme, wie hoch ist die Wahrscheinlichkeit, dass ich tatsächlich COVID-19 habe?

Es ändert sich drastisch in Abhängigkeit von allen drei eingegebenen Werten. Dies ist die Anzahl der COVID-19-infizierten Personen mit einem positiven Test geteilt durch die Gesamtzahl der Personen mit einem positiven Test. In diesem Fall beträgt diese Wahrscheinlichkeit %.

Wie stark ändert sich mein Risiko, COVID-19 zu verbreiten, wenn ich Schnelltests benutze?

Dies ist eine einfache Frage ohne einfache Antwort. Da sich die Prävalenz im Laufe der Zeit und nach Ort ändert und unterschiedliche Veranstaltungen unter verschiedenen Bedingungen stattfinden (drinnen / draußen, mit / ohne Masken usw.), kann dies nicht genau beantwortet werden. Mit ein paar unrealistischen Vereinfachungen können wir jedoch mit minimalem Aufwand eine Schätzung erhalten.

Nachfolgend zählen wir die Anzahl der Personen, die bei fünf Veranstaltungen anwesend waren, an denen ich möglicherweise teilgenommen habe, bevor Tests allgemein verfügbar waren:
Veranstaltung 1A:
Veranstaltung 2A:
Veranstaltung 3A:
Veranstaltung 4A:
Veranstaltung 5A:

Aber wenn Tests verfügbar sind, fühle ich mich vielleicht wohl genug, um zusätzlich zu meinen üblichen Interaktionen mit 50 Personen zu einer Hochzeit zu gehen. Hier ist eine Liste der Anzahl der Personen, die bei fünf Veranstaltungen anwesend sind, an denen ich teilnehmen könnte, wenn jeder Teilnehmer an einem Test teilnehmen müsste, einschließlich mir:
Veranstaltung 1B:
Veranstaltung 2B:
Veranstaltung 3B:
Veranstaltung 4B:
Veranstaltung 5B:

Lassen Sie uns nun einige unrealistische Annahmen treffen:
(1) Die Prävalenz war, ist und wird immer genau das sein, was wir in das Feld oben auf dieser Seite eingegeben haben. Dies gilt für jeden Ort, einschließlich des Ortes, an dem die Versammlung stattfindet und an dem die Teilnehmer ihren Ursprung haben.
(2) Jede Veranstaltung tritt unter den gleichen Bedingungen auf. (z. B. sind alle im Freien mit dem gleichen Anteil maskenloser Gäste, es wird kein Essen serviert und die Leute halten keinen Abstand zueinander). Es ist egal, wie die Bedingungen sind. Es ist nur wichtig, dass das Risiko, dass das Virus von einer infizierten Person auf eine andere übertragen wird, gleich ist.
(3) Jeder Teilnehmer der zweiten Gruppe von Veranstaltungen verwendet einen Test mit der Sensitivität, die in das Feld oben auf dieser Seite eingegeben wurde.
(4) Die Veranstaltungen finden selten statt und die Gäste haben außerhalb dieser Veranstaltungen keinen Kontakt miteinander.

Selbst mit diesen Annahmen können wir die Fragen "Wie wahrscheinlich ist es, dass ich bei diesen Veranstaltungen COVID-19 bekomme?" oder "Wie viele Personen soll ich bei diesen Veranstaltungen infizieren?" nicht antworten. Ich (und vermute ich auch echte Epidemiologen) bin nicht in der Lage, diese Fragen zu beantworten. Wir können jedoch eine verwandte Frage beantworten, um eine ungefähre Vorstellung zu bekommen: "Wie wahrscheinlich ist es, dass jemand mit COVID-19 bei einer Veranstaltung anwesend war, an der ich teilgenommen habe?" Falls die zweite Annahme ungefähr richtig ist, dann hat diese Frage etwas mit der andere zu tun.

Wenn Sie das Risiko für eine einzelne Veranstaltung ohne Tests berechnen möchten, geben Sie die Anzahl der Gäste für das Sammeln von 1A und Null für den Rest ein. Wenn alle getestet werden, können Sie dies für 1B tun.

Für den ersten Satz von Veranstaltungen beträgt die Wahrscheinlichkeit, dass COVID-19 für mindestens eines der Veranstaltungen vorhanden ist, %.

Für diejenigen, die sich für Mathematik interessieren, basiert die Formel auf der Prävalenz und Anzahl der Gäste. Wenn g die Anzahl der Gäste bei einer bestimmten Veranstaltung ist, beträgt die Wahrscheinlichkeit, dass dort niemand COVID-19 hat, (1-p) ^ g. Dies folgt aus einer Erweiterung der oben erwähnten Multiplikationsregel. (1-p) ist die Wahrscheinlichkeit, dass ein einzelner Gast nicht infiziert ist. Die Wahrscheinlichkeit, dass der erste Gast kein COVID-19 hat, beträgt 1-p. Die Wahrscheinlichkeit, dass sowohl der erste als auch der zweite Gast es nicht haben, ist (1-p) (1-p) oder (1-p) ^ 2. Die Wahrscheinlichkeit, dass die ersten drei es nicht haben, ist (1-p) (1-p) (1-p) oder (1-p) ^ 3. Sie können dies so oft tun, wie Sie möchten. (1-p) ^ g ist also die Wahrscheinlichkeit, dass keiner der Gäste infiziert ist. Wenn r1 die Wahrscheinlichkeit ist, dass beim erste Veranstaltung niemand infiziert ist (1-p) ^ g, und wir r2, r3, r4 und r5 für den Rest der Veranstaltungen berechnen, können wir r1 mit r2, r3 multiplizieren , r4 und r5, um die Wahrscheinlichkeit zu ermitteln, dass bei keinem der Veranstaltungen jemand infiziert ist. Um die Wahrscheinlichkeit zu ermitteln, dass jemand bei einem der Veranstaltungen infiziert ist, subtrahieren wir dies einfach von 1.

Für die zweite Reihe von Veranstaltungen, sind wir vielleicht bereit, ein Risiko mit mehr Gästen einzugehen, aber die Tests filtern einige der Personen heraus, die COVID-19 hatten, und gleichen hoffentlich das Risiko aus. In diesem Fall ist die Wahrscheinlichkeit %.

Wenn diesmal s die Empfindlichkeit ist, lautet die Formel 1-(1-p(1-s))^g. In diesem Fall müsste jeder Gast, der COVID-19 zu einer Versammlung bringt, infiziert sein und auch nicht vom Test erfasst werden, um teilnehmen zu können. p(1-s) ist die Wahrscheinlichkeit, dass ein einzelner Gast sowohl infiziert ist als auch der Anteil der Infektionen, die vom Test nicht erfasst werden.

Was passiert, wenn ich regelmäßig an Veranstaltungen teilnehme (z. B. tägliche Arbeit, wöchentliches Abendessen mit einem Freund)?

Dies hat einen großen Effekt. Ich hatte Freunde, die sich Sorgen um ihr Risiko während der Spitzenwerte bei neuen täglichen Infektionen machten. Mit ein wenig mathematischer Modellierung konnte ich ihnen zeigen, dass sie aufgrund ihrer üblichen Aktivitäten in den letzten Monaten mit geringer Prävalenz tatsächlich einem höheren Risiko ausgesetzt waren, COVID-19 zu bekommen, als der Kontakt, den sie in den nächsten Wochen aushalten mussten an ihren Arbeitsplätzen. Wenn Sie sich über die hohe Prävalenz in Ihrer Region gestresst fühlen, kann es hilfreich sein, Ihr Risiko für frühere regelmäßige Aktivitäten zu bewerten, um die Dinge ins rechte Licht zu rücken.

Um eine zufriedenstellende Antwort zu erhalten, müssen Sie nur ein wenig selbst arbeiten. Es gibt drei Schritte.

(1) Verwenden Sie für jede Veranstaltung den Wahrscheinlichkeitsrechner, um die Wahrscheinlichkeit zu berechnen, dass dort niemand COVID-19 hat. Verwenden Sie einfach Nullen für die Anzahl der Gäste in allen bis auf eine Veranstaltung (pro Gruppe). Dann benötigen Sie für das erste Veranstaltung: (ohne Schnelltests) und für das zweite Veranstaltung (dies beinhaltet Schnelltests) . Berechnen Sie so oft neu, wie Sie für alle Ihre Veranstaltungen benötigen, und notieren Sie die Ergebnisse sowie die Häufigkeit, mit der die Veranstaltung stattfinden wird. Die Schaltfläche "Los." registriert auch neue Prävalenz- und Sensitivitätswerte, sodass Sie nicht erneut auf die Schaltfläche "Berechnen" klicken müssen, wenn Sie diese ändern.

Nehmen wir als Beispiel an, ich habe ein wöchentliches Abendessen mit 4 Freunden aus verschiedenen Haushalten, bei dem niemand getestet wird. Und ich mache diesen Monat zweimal Geschäftsreisen und treffe mich mit 8 Kunden pro Reise, wobei alle, einschließlich mir, mit einem Test mit einer Empfindlichkeit von 70% getestet wurden. Nehmen wir auch an, dass 160 pro 100.000 Menschen in meiner Region COVID-19 haben. Jedes Abendessen hat eine Wahrscheinlichkeit von 0,993615, dass niemand infiziert ist, während jede Geschäftsreise 0,996166 hat. Ich erhalte diese Werte, wenn ich 160 für die Prävalenz, 70 für die Sensitivität und dann 4 für A1, 8 für B1 und 0 für die Anzahl der Gäste bei jeder anderen Veranstaltung eingebe. Beachten Sie, dass Sie bei einer Änderung der Prävalenz im Laufe der Zeit verschiedene Prävalenzen für Ihre Berechnungen eingeben und alles nach Ihren Wünschen anpassen können. Verfolgen Sie einfach, wie viele Veranstaltungen mit jedem Wertesatz für die nächsten Schritte aufgetreten sind. Erstellen Sie möglicherweise eine Tabelle oder ein Excel-Dokument.

(2) Multiplizieren Sie alle diese Wahrscheinlichkeiten miteinander.

Für diesen Monat findet das Abendessen viermal und für die Geschäftsreise zwei Mal statt. Für diesen Monat erhalte ich also: 0,99362 * 0,99362 * 0,99362 * 0,99362 * 0,99617 * 0,99617 (oder 0,99362 ^ 4 * 0,99617 ^ 2) = 0,967. (Hinweis: Es funktioniert immer, die Anzahl der Vorkommen als Exponenten wie diesen zu verwenden.) In diesem Fall beträgt das Ergebnis 0,967.

(3) Die Wahrscheinlichkeit, dass COVID-19 für mindestens eines Ihrer Veranstaltungen vorhanden ist, beträgt dann nur 1-X, wobei X die Antwort aus dem letzten Schritt ist. Multiplizieren Sie mit 100, wenn Sie einen Prozentsatz wünschen.

Für das Beispiel erhalten wir 1-0,967 = 0,032, was 0,032 * 100 = 3,2% entspricht. Beachten Sie, dass jedes einzelne Veranstaltung Wahrscheinlichkeiten von nur etwa 0,5% aufwies, sich jedoch im Laufe der Zeit summierten.

Friday, April 23, 2021

An application of Bayes' Rule to daily life during the modern plague

Disclaimer: I am a mathematician with interest in public health, not a doctor. Please speak to a medical professional to get medical advice. This website cannot replace medical professionals. If you rely on information here, you do so at your own risk. I will update this information as needed, but I make no guarantee that the anything is correct. There is no warranty of any kind, and I make no guarantee that this website will function for you. (e.g. The calculations require javascript functions, and some browsers will have difficulty if the functions are no longer supported in the future).

This is a probability calculator that depends on your input.

When you take a rapid test for COVID-19, what information do you gain? Click the "Calculate" button below to see what happens with some typical values, then try playing with the values for sensitivity and specificity of tests (explained just below) as well as your general risk of having COVID-19, given the situation in your area. The text below the calculate button will change depending on your input.

Mathematics is written in blue, and you can ignore these sections unless you want to understand my methods.

Sensitivity: %
If you have COVID-19, how often will your test detect it? Timing is important, and so is test quality, so the answer is complicated. This research review article* gave a range of sensitivites from 0 to 80% for PCR tests based on days post exposure (0% on the first day past exposure, 67% at 4 days past exposure, 80% at 8 days past exposure and a gradual decrease thereafter). The danger zone appears to be from days 2 to 5, when the tests often fail to detect the virus and symptoms are absent or just starting, but infected people are likely to be contagious. This article assumed that day 5 was the day of symptom onset, so the timeline may be shifted for people with longer incubation times. Sensitivity is lower for rapid tests than for PCR tests, especially if storage and usage instructions are not followed precisely. A Cochrane review** that ignores the timing of testing gives 58% to 75% as rapid test sensitivies for asymptomatic individuals. Manufacturers of rapid tests regularly claim to get much higher sensitivity (98% on mine), but it is difficult for me to comprehend why hospitals would still use PCR tests as their standard if the rapid tests were better, cheaper, quicker, and required no special equipment. Some clarity comes from the Lancet's article "Buyer Beware: inflated claims of sensitivity for rapid COVID-19 tests" by Fitzpatrick et al., which states that manufacturers aren't reporting the sensitivity at all; they are stating the percent positive agreement and calling it sensitivity. The percent positive agreement tells you what fraction of positive PCR tests, for example, were also caught by this rapid test.

Specificity: %
If you don't have COVID-19, how often will the test correctly come back negative? This is around 98.8% to 99.9% for all tests. The lowest value I saw anywhere was 97%.

Prevalence: per 100,000

How likely are you to have COVID-19? This will be the incidence in your area, adjusted based on your individual situation if it's likely to be very different. Did you come into contact with someone who tested positive? Has everyone in your household decided to be extremely cautious with contacts?

*Variation in False-Negative Rate of Reverse Transcriptase Polymerase Chain Reaction–Based SARS-CoV-2 Tests by Time Since Exposure by Kucirka et al. in Annals of Internal Medicine

**Rapid, point‐of‐care antigen and molecular‐based tests for diagnosis of SARS‐CoV‐2 infection by Dinnes et al. in the Cochrane database of Systematic Reviews (accessed 27 April, 2021)

Click "Calculate" to display the answers to the questions based on your inputs.

What are the results when 100,000 random people take tests?

To get that, we multiply 100,000 by the probability of each possible event. The probability of each event is given in the parentheses.

people have COVID-19, and their test is positive. (prevalence times sensitivity)
people have COVID-19, and their test is negative. (prevalence times [1 minus sensitivity])
people do not have COVID-19, and their test is positive. ([1 minus prevalence] times [1-specificity])
people do not have COVID-19, and their test is negative. ([1 minus prevalence] times specificity)

For those interested in the math: One rule I just used here is that the probability of something not happening is 100% (or 1) minus the probability of it happening. For example, if a test senses COVID-19 20% of the time, then it won't sense it 80% of the time. You just subtract 20% from 100% to get 80%. This rule will come up a lot later as well. Another rule is multiplication of probabilities. If you want the probability of two independent things happening (e.g. you flip a coin and get heads AND you pick one of four doors and get the prize hiding behind only one of them), you just multiply their probabilities. In this case 50% times 25% (heads is on one out of two sides of the coin. One of the four doors contains the prize.). If the events aren't independent, you have to use conditional probability. For example, we want the probability that someone has COVID-19, and their test is positive. Since the test detects COVID-19 and has a higher probability of being positive if someone has the infection, these events are not independent. In this case we multiply two things (1) the probability that someone has COVID-19 and (2) the probability that a test will be positive IF someone has COVID-19. People who study probability say "given" instead of "if".

How much does my risk of having COVID-19 change if I take a test?

Your risk of having COVID-19 was the prevalence you listed above before the test. This means that % of people in your area and situation have COVID-19.

Once you get a negative test, it changes to . This is the number of people who had COVID-19 and a negative test divided by the total number of people with a negative test in the calculations above. This means that % of people who got a negative test have COVID-19. With realistic values, the chances for you as an individual aren't much different with or without a test: probably somewhere around one-tenth of a percent unless the hospitals are overflowing.

I've snuck in Bayes' Rule here. Bayes' rule is a way to switch conditional probabilities you know for ones you don't know. Here, we wanted to know what your risk of having COVID-19 was IF you had a negative test. But from the sensitivity, we only knew what the probability of getting a negative test was IF you had COVID-19. To switch the order, you can use the formula Bayes concocted, or it helps to draw something called a Bayes tree if you are new to the concept. If you look up how to do that and try it here, you'll notice that all of the branches on the tree are the probabilities we used to calculate how many people out of 100,000 had each of the possible conditions (have COVID-19 and a positive test, etc.). Be sure to put COVID-19/no COVID-19 on the first set of branches and positive/negative tests on the second set. We finished using the Bayes tree method in this last step, where we found the proportion of COVID-19-infected people with a negative test to the total number of people with a negative test (this is the probability of COVID-19 given a negative test).

If I have COVID-19, what is the likelihood that the test will detect it?

That's just the sensitivity you gave above (%). So out of every 100 people who have COVID-19 will be detected by the test, and won't. This is where things become important from a public health perspective. If the tests detect some COVID-19 cases, but people go out more often or do more high-risk activities due to faith in the negative tests, this can result in more infections. Given the values here, people need to increase their risk of becoming infected/infecting others by a factor of before the tests become useless to them. If they increase their risk by more than that, the tests are causing more cases than they prevent. A more nuanced treatment is given below. You can change the sensitivity to explore how this factor changes.

If I get a positive test, what is the likelihood that I actually have COVID-19?

It changes drastically depending on all three values you entered. It's the number of COVID-19-infected people with a positive test divided by the total number of people with a positive test. In this case, that probability is %.

How much does my risk of spreading COVID-19 change when I take rapid tests?

This is a simple question with an extremely complicated answer. Because the prevalence changes over time and by location, and because different events take place in various conditions (indoors/outdoors, with/without masks, etc.), this is impossible to answer precisely. However, with a few unrealistic simplifications, we can get a ballpark estimate with minimal effort.

Below is a list of the number of people present at five events I might have attended before tests were widely available:
Event 1A:
Event 2A:
Event 3A:
Event 4A:
Event 5A:

But maybe if tests are available, I feel comfortable enough to go to a wedding with 50 people in addition to my usual interactions. So here is a list of the number of people present at five events I might attend if everyone who attended was required to take a test, myself included:
Event 1B:
Event 2B:
Event 3B:
Event 4B:
Event 5B:

Now let's make a few unrealistic assumptions:
(1) The prevalence has been, is, and always will be exactly what we entered in the box at the top of this page. And that is true for every location, including where the gathering takes place and where the participants originate.
(2) If we want some estimate of relative transmissibility risk, then every event occurs under the same conditions. (e.g. all of them are outdoors with the same proportion of maskless guests, there is no food served, and people aren't maintaining distance from each other). It doesn't matter what the conditions are. It just matters that the risk of the virus being passed from one infected person to another is the same.
(3) Everyone at the second group of events uses a test with the sensitivity entered at the box at the top of this page.
(4) The events occur infrequently, and the guests don't have contact with each other outside of these events.
(5) The people at the events are vaccinated at the same proportions as people in the population used to measure the incidence.

Even with these assumptions, we can't answer the questions "How likely am I to get COVID-19 at these events?" or "How many people am I expected to infect at these events?" I am not equipped to answer those questions, and I doubt even epidemiologists would be confident in any estimates they could give you. But we can answer a related question to get a rough idea: "How likely is it that someone with COVID-19 was present at an event I attended?"

You can also use this calculator to calculate risks for individual events with and without required testing. Just enter the number of guests for Event 1A and 1B, and enter 0 as the number of guests for the rest of the events.

Click "Find out." to get the answers.

For the first set of events, the probability of COVID-19 being present for at least one of the events is %.

For those interested in the math, the formula is based on the prevalence and number of guests. If g is the number of guests at a given event, then the probability that no one has COVID-19 there is (1-p)^g. This follows from an expansion of the multiplication rule mentioned above. (1-p) is the probability that any given individual guest is not infected. So, the probability that the first guest does not have COVID-19 is 1-p. The probability that both the first guest and the second guest don't have it is (1-p)(1-p) or (1-p)^2. The probability that the first three don't have it is (1-p)(1-p)(1-p) or (1-p)^3. You can do this as many times as you like, so (1-p)^g is the probability that none of the guests are infected. If r1 is the probatility that no one at the first event is infected, (1-p)^g, and we calculate r2, r3, r4, and r5 for the rest of the events, then we can multiply r1 by r2, r3, r4, and r5 to get the probability that no one is infected at any of the events. Finally, to get the probability that anyone is infected at any one of the events, we just subtract that from 1.

For the second set of events, we may be willing to take a chance with more guests, but the tests are filtering out some of the people who had COVID-19 and hopefully offsetting the risk. In this case the probability is %.

This time, if s is the sensitivity, then the formula is (1-p(1-s))^g for the probability of no one being infected at a single event with g guests. In this case, each guest who brings COVID-19 to a gathering would have to be infected and also not be sensed by the test in order to attend. p(1-s) is probability that any individual guest is both infected and in the proportion of infections not sensed by the test.

What happens if I attend events regularly (e.g. daily work, weekly dinner with a friend)?

This has a big effect. I had friends who were worried about their risk during peaks in new daily infections. With a little bit of mathematical modeling, I was able to show them that their usual activities over the past several months of low prevalence had actually put them at higher risk for catching COVID-19 than the contact they needed to endure over the next few weeks at their jobs. If you are feeling stressed about high prevalence in your area, it may be helpful to assess your risk for previous regular activities to put things in perspective. For a quick and dirty approximation, you can still use the calculator above. Just add up all of the probabilities for every activity you do in a given time frame. Keep in mind that the prevalence may change during that time, and you will need to guess what the average prevalence might be to get a better estimate. This method could give you a result of more than 100%, though, if the activities are particularly high risk (many guests, high prevalence, or many repetitions). This is because adding the probabilities like this ignores the fact that COVID-19 could be present at multiple gatherings. The difference between this approximation and your actual risk of exposure to COVID-19 increases as your risk increases, because this makes it more likely that COVID-19 is present at multiple events.

To get a satisfactory answer to a question like this, you will have to do only a little work yourself with three steps.

(1) For each event, use the calculator to calculate the probability that no one there has COVID-19. Just use zeros for the number of guests in all but one event. then the value you need for the first event is: , and for the second event, it is (this one includes testing). Recalculate as many times as you need for all of your events and write down the results along with how many times the event will happen. The "Find out" button also registers new prevalence and sensitivity values, so you don't need to click the "Calculate" button again if you change those.

As an example, Let's say I have a weekly dinner with 4 friends from different households, where no one is tested. And I go on business trips twice this month, meeting with 8 clients per trip, with everyone including myself tested with a test at 70% sensitivity. Let's also say that 160 per 100,000 people has COVID-19 in my area. Each dinner has probability 0.993615 that no one is infected, while each business trip has 0.996166. I get these values if I enter 160 for prevalence, 70 for sensitivity and then 4 for 1A, 8 for 1B, and 0 for the number of guests at every other event. Keep in mind that if the prevalence changed over time, you can enter different prevalences for your calculations and customize everything to your liking. Just keep track of how many occurrences of the events took place with each set of values for the next steps. Maybe make a table or spreadsheet document.

(2) Multiply all of those probabilities together.

For this month, the dinner happens four times, and the business trip two, so for this month I get: 0.99362*0.99362*0.99362*0.99362*0.99617*0.99617 (or 0.99362^4 * 0.99617^2) = 0.967. (Hint: It always works to use the number of occurences as an exponent like this.) In this case, the result is 0.967.

(3) The probability of COVID-19 being present for at least one of your events is then just 1-X, where X was what you got in the last step. Multiply by 100 if you want a percentage.

For the example, we get 1-0.967=0.032, which is 0.032*100%=3.2%. Notice that each single event had probabilites of only about 0.5%, but they add up over time.

Update: At the time this was written, vaccination was just starting in Germany. I've added an assumption to the model for vaccination uptake. If vaccine uptake is similar to the general population used to measure the incidence, then the model will give good estimates of the risk, perhaps underestimating risk if the incidence is measured only by confirmed cases (rather than an estimate of actual cases). If vaccine uptake proportions are much better than expected at an event, the risk is overestimated by the model. If vaccine uptake proportions are worse than expected at an event, then the model will underestimate the risk.

Saturday, December 6, 2014

Wrapping presents with two papers



I couldn't easily find bows I liked last year, so I came up with a wrapping method that made bows and copious amounts of ribbon unnecessary to make a very pretty wrapped gift.  It's come in handy this year for gifts that I want to be pretty but also need the prettiness to not get squished in the mail.  All it takes is two types of wrapping paper that go together nicely and a tiny bit of middle school algebra.  Ribbon or decorative tape is optional and dresses the end result up while also covering up any jagged edges from cutting the paper.

My wrapped packages turned out like this:




Maybe my math teacher friends will like this, because you could derive the formulas necessary by applying perimeter equations, and it also applies inequalities and "plugging in" numbers for variables.  You could make some decent exercises out of this problem, including figuring it out for a cylindrical rather than a rectangular package.  It might be a decent Christmas-time comeback for, "When am I ever gonna use this?"

You will need:
>A yardstick or measuring tape
>Two types of wrapping paper
>Scissors
>Tape
>Pencil or pen that won't bleed through the wrapping paper (for marking back of paper)
>Ribbon or decorative tape (optional, but you just have to be really, really careful to cut a straight line or follow the alternate directions below if you don't have it).



Here are the steps for wrapping a rectangular box:

1)  Measure the length (L), width (W) and height (H) of the box you will wrap.  To be most efficient, it is best if H<W<L (i.e. the height is the smallest edge of the box, and the length is the longest).

My package had H = 3.5 cm, W = 15 cm, and L = 21 cm, so this is what I will plug into the formulas below.

Write down the measurements you made, and lable them as H, W, and L so you don't get them mixed up later.



2) Figure out how much paper you will need to wrap the box.  You will need a rectangle with a length that runs all the way around the box (H+W+H+W = 2H+2W) and a width that will cover up the top half of the box (0.5H+L+0.5H = L+H) like in the diagram below.



You should also include a bit of room as a buffer, just because no one cuts perfectly straight, and you will have a little piece of package not covered by paper anywhere you wavered. (0.5 inches or 1cm should be fine.  I picked buffer = 1cm.  Choose 2 cm or 1 inch if you do not have ribbon or decorative tape and do not trust your cutting skills to be perfect.)

So the rectangle I would cut out of paper (if I were only using one type of paper) would have length: 2H+2W+2buffer = 2 * 3.5 cm + 2 * 15 cm + 2 * 1 cm = 7cm + 30cm + 2cm = 39 cm

and width:
L+H+2buffer = 21cm + 3.5cm + 2 * 1cm = 21cm + 3.5cm + 2cm = 26.5 cm

Calculate the lengths and width of the rectangle you would need for your measurements and write those down as labels on a drawn rectangle like in the picture below (you only need to write down the parts in black, the rest are just a visual explanation of how I came up with the formulas).  Be very careful if you use a calculator.  Always do multiplication before addition.  If you enter 1+2*3 into a typical calculator, it might give you 9 while the correct answer is 7.  The 25.5 in the picture is a typo; it should be 26.6.



3) To make the diagonal line between the papers, you need to pick a number.  We can call it X.  The only restriction is that X should be larger than 0.5H+buffer, but smaller than or equal to 0.5L+0.5H+buffer.  It shouldn't be too small, or you can easily get some paper to stick out from the side of the package.  And the larger boundary is just where the "diagonal" line between the papers will run parallel to the sides of the package.
 
X is what determines the steepness of the diagonal line spiraling around your package down the length of the package.  The smaller it is, the more dramatic the line.  If it is equal to 0.5L+0.5H+buffer, then the line is parallel to the sides.  



I chose X to make the steepest diagonal I could on my package, so X = buffer + 0.5H = 1 cm + 0.5*3.5 cm = 1 cm + 1.75 cm = 2.75 cm.

Once you pick your X, write it down and label it X.  Then draw it on your rectangle like this:



4) Next, calculate the difference between your rectangle's width and X.  For me, it was 26.5 - 2.75 cm = 23.75 cm. Label your rectangle like this:




5) Now it's time to cut the shapes you made on your drawn rectangle from the wrapping paper using the calculations you made. You use one type of paper for each of the two parts that make up the rectangle.  You should use a pencil to mark the measurements on the wrong side of the paper.  You will need to measure the lengths from your drawing, and connect the dots with a straight edge like a yardstick or large book (or, in my case, an empty canvas I had lying around).



5) Since the two shapes that make up your rectangle are the same (just rotated), you don't have to measure twice.  You can just trace one cut piece of paper onto the other type of paper (or you can measure it just the same).  Just remember to keep working on the wrong side of the paper (or the shapes won't fit together the way they should).

6) Tape the pieces of paper together from the wrong side to make a rectangle as shown in the picture.  If you don't have ribbon or decorative tape, weren't so sure about your cutting skills, and used a bit of extra buffer, feel free to fold 1 buffer length of paper back along the diagonal line of each paper before taping the papers together.  If you layer one paper a little over the other after doing this, you should get a nice straight line with no gaps.



7) Now just wrap your present as you would any other.

















8)  And finish off with the ribbon or decorative tape.  I also added a homemade bow to this one, since it didn't need to be mailed.



two-paper gift wrapping





Saturday, June 1, 2013

About Me


I'm Sarah, a researcher in the field of plant genetics and a former math teacher. I taught math classes at Michigan State University and tutored at Eastern Michigan University before that, where I had started as an art education major. Needless to say, my interests are somewhat varied. From painting, baking, and sewing to math, physics, and probability, I love it all.

Whenever I use mathematics on a project where others would probably use a different tool, I will put it up on the blog (time permitting). Partially, this is to catalog real-world applications for myself to use when I go back to teaching. But if anyone else reads it, I hope it spreads awareness that there can be a legitimate answer to the question, "When I am ever going to use this?" Very rarely do we *need* math, but it can make some tasks easier, some generalizable, and some possible.