{"id":1440,"date":"2024-11-28T13:54:48","date_gmt":"2024-11-28T13:54:48","guid":{"rendered":"https:\/\/www.allendowney.com\/blog\/?p=1440"},"modified":"2024-11-29T15:10:26","modified_gmt":"2024-11-29T15:10:26","slug":"hazard-and-survival","status":"publish","type":"post","link":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/","title":{"rendered":"Hazard and Survival"},"content":{"rendered":"\n<p>Here\u2019s a <a href=\"https:\/\/www.reddit.com\/r\/AskStatistics\/comments\/1gzff52\/if_i_have_a_tumor_that_ive_been_told_has_a\/\">question from the Reddit statistics forum<\/a>.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>If I have a tumor that I\u2019ve been told has a malignancy rate of 2% per year, does that compound? So after 5 years there\u2019s a 10% chance it will turn malignant?<\/p>\n<\/blockquote>\n\n\n\n<p>This turns out to be an interesting question, because the answer depends on what that 2% means. If we know that it\u2019s the same for everyone, and it doesn\u2019t vary over time, computing the compounded probability after 5 years is a relatively simple.<\/p>\n\n\n\n<p>But if that 2% is an average across people with different probabilities, the computation is a little more complicated \u2013 and the answer turns out to be substantially different, so this is not a negligible effect.<\/p>\n\n\n\n<p>To demonstrate both computations, I\u2019ll assume that the probability for a given patient doesn\u2019t change over time. This assumption is consistent with the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Armitage%E2%80%93Doll_multistage_model_of_carcinogenesis\">multistage model of carcinogenesis<\/a>, which posits that normal cells become cancerous through a series of mutations, where the probability of any of those mutations is constant over time.<\/p>\n\n\n\n<p><a href=\"https:\/\/colab.research.google.com\/github\/AllenDowney\/DataQnA\/blob\/main\/nb\/hazard.ipynb\">Click here to run this notebook on Colab<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Constant Hazard<\/h2>\n\n\n\n<p>Let\u2019s start with the simpler calculation, where the probability that a tumor progresses to malignancy is known to be 2% per year and constant. In that case, we can answer OP\u2019s question by making a constant hazard function and using it to compute a survival function.<\/p>\n\n\n\n<p><code>empiricaldist<\/code> provides a <code>Hazard<\/code> object that represents a hazard function. Here\u2019s one where the hazard is 2% per year for 20 years.<\/p>\n\n\n\n<pre id=\"codecell3\" class=\"wp-block-preformatted\">from empiricaldist import Hazard\n\np = 0.02\nts = np.arange(1, 21)\nhazard = Hazard(p, ts, name='hazard1')\n<\/pre>\n\n\n\n<p>The probability that a tumor survives a given number of years without progressing is the cumulative product of the complements of the hazard, which we can compute like this.<\/p>\n\n\n\n<pre id=\"codecell4\" class=\"wp-block-preformatted\">p_surv = (1 - hazard).cumprod()\n<\/pre>\n\n\n\n<p><code>Hazard<\/code> provides a <code>make_surv<\/code> method that does this computation and returns a <code>Surv<\/code> object that represents the corresponding survival function.<\/p>\n\n\n\n<pre id=\"codecell5\" class=\"wp-block-preformatted\">surv = hazard.make_surv(name='surv1')\n<\/pre>\n\n\n\n<p>Here\u2019s what it looks like.<\/p>\n\n\n\n<pre id=\"codecell6\" class=\"wp-block-preformatted\">surv.plot()\ndecorate(xlabel='Year', ylabel='P(survival &gt; t)')\n<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/allendowney.github.io\/DataQnA\/_images\/6520d3305e45a1d25be58e49729b7a380e68afd2546d79afcd9f462338ec02b0.png\" alt=\"_images\/6520d3305e45a1d25be58e49729b7a380e68afd2546d79afcd9f462338ec02b0.png\"\/><\/figure>\n\n\n\n<p>The y-axis shows the probability that a tumor \u201csurvives\u201d for more than a given number of years without progressing. The probability of survival past Year 1 is 98%, as you might expect.<\/p>\n\n\n\n<pre id=\"codecell7\" class=\"wp-block-preformatted\">surv.head()\n<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><\/th><th>probs<\/th><\/tr><\/thead><tbody><tr><th>1<\/th><td>0.980000<\/td><\/tr><tr><th>2<\/th><td>0.960400<\/td><\/tr><tr><th>3<\/th><td>0.941192<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>And the probability of going more than 10 years without progressing is about 82%.<\/p>\n\n\n\n<pre id=\"codecell8\" class=\"wp-block-preformatted\">surv(10)\n<\/pre>\n\n\n\n<pre id=\"codecell9\" class=\"wp-block-preformatted\">array(0.81707281)\n<\/pre>\n\n\n\n<p>Because of the way the probabilities compound, the survival function drops off with decreasing slope, even though the hazard is constant.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Knowledge is Power<\/h2>\n\n\n\n<p>Now let\u2019s add a little more realism to the model. Suppose that in the observed population the average rate of progression is 2% per year, but it varies from one person to another. As an example, suppose the actual rate is 1% for half the population and 3% for the other half. And for a given patient, suppose we don\u2019t know initially which group they are in.<\/p>\n\n\n\n<p>[UPDATE: If you read an earlier version of this article, there was an error in this section \u2013 I had the likelihood ratio wrong and it had a substantial effect on the results.]<\/p>\n\n\n\n<p>As in the previous example, the probability that the tumor goes a year without progressing is 98%. However, at the end of that year, if it has not progressed, we have evidence in favor of the hypothesis that the patient is in the low-progression group. Specifically, the likelihood ratio is 99\/97 in favor of that hypothesis.<\/p>\n\n\n\n<p>Now we can apply <a href=\"https:\/\/en.wikipedia.org\/wiki\/Bayes'_theorem#Bayes'_rule_in_odds_form\">Bayes\u2019s rule in odds form<\/a>. Since the prior odds were 1:1 and the likelihood ratio is 99\/97, the posterior odds are 99:97 \u2013 so after one year we now believe the probability is 50.5% that the patient is in the low-progression group.<\/p>\n\n\n\n<pre id=\"codecell10\" class=\"wp-block-preformatted\">p_low = 99 \/ (99 + 97)\np_low\n<\/pre>\n\n\n\n<pre id=\"codecell11\" class=\"wp-block-preformatted\">0.5051020408163265\n<\/pre>\n\n\n\n<p>In that case we can update the probability that the tumor progresses in the second year:<\/p>\n\n\n\n<pre id=\"codecell12\" class=\"wp-block-preformatted\">p1 = 0.01\np2 = 0.03\n\np_low * p1 + (1-p_low) * p2\n<\/pre>\n\n\n\n<pre id=\"codecell13\" class=\"wp-block-preformatted\">0.019897959183673472\n<\/pre>\n\n\n\n<p>If the tumor survives a year without progressing, the probability it will progress in the second year is 1.99%, slightly less than the initial estimate of 2%. Note that this change is due to evidence that the patient is in the low progression group. It does not assume that anything has changed in the world \u2013 only that we have more information about which world we\u2019re in.<\/p>\n\n\n\n<p>If the tumor lasts another year without progressing, we would do the same update again. The following loop repeats this computation for 20 years.<\/p>\n\n\n\n<pre id=\"codecell14\" class=\"wp-block-preformatted\">odds = 1\nratio = 99\/97\nres = []\n\nfor year in hazard.index:\n    p_low = odds \/ (odds + 1)\n    haz = p_low * p1 + (1-p_low) * p2\n    res.append((p_low, haz))\n    odds *= ratio\n<\/pre>\n\n\n\n<p>Here are the results in percentages.<\/p>\n\n\n\n<pre id=\"codecell15\" class=\"wp-block-preformatted\">df = pd.DataFrame(res, columns=['p_low', 'hazard'], index=hazard.index)\n(df * 100).round(2).head()\n<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><\/th><th>p_low<\/th><th>hazard<\/th><\/tr><\/thead><tbody><tr><th>1<\/th><td>50.00<\/td><td>2.00<\/td><\/tr><tr><th>2<\/th><td>50.51<\/td><td>1.99<\/td><\/tr><tr><th>3<\/th><td>51.02<\/td><td>1.98<\/td><\/tr><tr><th>4<\/th><td>51.53<\/td><td>1.97<\/td><\/tr><tr><th>5<\/th><td>52.04<\/td><td>1.96<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>If we put the hazard rates in a <code>Hazard<\/code> object, we can compare them to the constant hazard model.<\/p>\n\n\n\n<pre id=\"codecell16\" class=\"wp-block-preformatted\">hazard2 = Hazard(df['hazard'], name='hazard2')\n<\/pre>\n\n\n\n<pre id=\"codecell17\" class=\"wp-block-preformatted\">hazard.plot(label='Known probability')\nhazard2.plot(label='Uncertain probability')\ndecorate(xlabel='Year', ylabel='Hazard')\n<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/allendowney.github.io\/DataQnA\/_images\/5d7cb2951f8e4a949b31295ba14ad3f1c7353887e065b451b35488e1e943f5ff.png\" alt=\"_images\/5d7cb2951f8e4a949b31295ba14ad3f1c7353887e065b451b35488e1e943f5ff.png\"\/><\/figure>\n\n\n\n<p>Each year, the probability increases that the patient is in the low-progression group, so the probability of progressing in the next year is a little lower.<\/p>\n\n\n\n<p>Here\u2019s what the corresponding survival function looks like.<\/p>\n\n\n\n<pre id=\"codecell18\" class=\"wp-block-preformatted\">surv2 = hazard2.make_surv(name='surv2')\n<\/pre>\n\n\n\n<pre id=\"codecell19\" class=\"wp-block-preformatted\">surv.plot(label='Known probability')\nsurv2.plot(label='Uncertain probability')\ndecorate(xlabel='Year', ylabel='P(survival &gt; t)')\n<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/allendowney.github.io\/DataQnA\/_images\/30ecc5edc2c3c2fc40fb64a4110f570177450b0f2e5fa819f0404a4064c651fb.png\" alt=\"_images\/30ecc5edc2c3c2fc40fb64a4110f570177450b0f2e5fa819f0404a4064c651fb.png\"\/><\/figure>\n\n\n\n<p>The difference in survival is small, but it accumulates over time. For example, the probability of going more than 20 years without progression increases from 67% to 68%.<\/p>\n\n\n\n<pre id=\"codecell20\" class=\"wp-block-preformatted\">surv(20), surv2(20)\n<\/pre>\n\n\n\n<pre id=\"codecell21\" class=\"wp-block-preformatted\">(array(0.66760797), array(0.68085064))\n<\/pre>\n\n\n\n<p>In this example, there are only two groups with different probabilities of progression. But we would see the same effect in a more realistic model with a range of probabilities. As time passes without progression, it becomes more likely that the patient is in a low-progression group, so their hazard during the next period is lower. The more variability there is in the probability of progression, the stronger this effect.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Discussion<\/h2>\n\n\n\n<p>This example demonstrates a subtle point about a distribution of probabilities. To explain it, let\u2019s consider a more abstract scenario. Suppose you have two coin-flipping devices:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>One of them is known to flips head and tails with equal probability.<\/li>\n\n\n\n<li>The other is known to be miscalibrated so it flips heads with either 60% probability or 40% probability \u2013 and we don\u2019t know which, but they are equally likely.<\/li>\n<\/ul>\n\n\n\n<p>If we use the first device, the probability of heads is 50%. If we use the second device, the probability of heads is 50%. So it might seem like there is no difference between them \u2013 and more generally, it might seem like we can always collapse a distribution of probabilities down to a single probability.<\/p>\n\n\n\n<p>But that\u2019s not true, as we can demonstrate by running the coin-flippers twice. For the first, the probability of two heads is 25%. For the second, it\u2019s either 36% or 16% with equal probability \u2013 so the total probability is 26%.<\/p>\n\n\n\n<pre id=\"codecell20\" class=\"wp-block-preformatted\">p1, p2 = 0.6, 0.4\nnp.mean([p1**2, p2**2])\n<\/pre>\n\n\n\n<pre id=\"codecell21\" class=\"wp-block-preformatted\">0.26\n<\/pre>\n\n\n\n<p>In general, there\u2019s a difference between a scenario where a probability is known precisely and a scenario where there is uncertainty about the probability.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here\u2019s a question from the Reddit statistics forum. If I have a tumor that I\u2019ve been told has a malignancy rate of 2% per year, does that compound? So after 5 years there\u2019s a 10% chance it will turn malignant? This turns out to be an interesting question, because the answer depends on what that 2% means. If we know that it\u2019s the same for everyone, and it doesn\u2019t vary over time, computing the compounded probability after 5 years is&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-1440","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Hazard and Survival - Probably Overthinking It<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hazard and Survival - Probably Overthinking It\" \/>\n<meta property=\"og:description\" content=\"Here\u2019s a question from the Reddit statistics forum. If I have a tumor that I\u2019ve been told has a malignancy rate of 2% per year, does that compound? So after 5 years there\u2019s a 10% chance it will turn malignant? This turns out to be an interesting question, because the answer depends on what that 2% means. If we know that it\u2019s the same for everyone, and it doesn\u2019t vary over time, computing the compounded probability after 5 years is... Read More Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/\" \/>\n<meta property=\"og:site_name\" content=\"Probably Overthinking It\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-28T13:54:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-29T15:10:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/allendowney.github.io\/DataQnA\/_images\/6520d3305e45a1d25be58e49729b7a380e68afd2546d79afcd9f462338ec02b0.png\" \/>\n<meta name=\"author\" content=\"AllenDowney\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@AllenDowney\" \/>\n<meta name=\"twitter:site\" content=\"@AllenDowney\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"AllenDowney\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/\"},\"author\":{\"name\":\"AllenDowney\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/4e5bfb2e9af6c3446cb0031a7bf83207\"},\"headline\":\"Hazard and Survival\",\"datePublished\":\"2024-11-28T13:54:48+00:00\",\"dateModified\":\"2024-11-29T15:10:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/\"},\"wordCount\":1007,\"publisher\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/allendowney.github.io\/DataQnA\/_images\/6520d3305e45a1d25be58e49729b7a380e68afd2546d79afcd9f462338ec02b0.png\",\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/\",\"url\":\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/\",\"name\":\"Hazard and Survival - Probably Overthinking It\",\"isPartOf\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/allendowney.github.io\/DataQnA\/_images\/6520d3305e45a1d25be58e49729b7a380e68afd2546d79afcd9f462338ec02b0.png\",\"datePublished\":\"2024-11-28T13:54:48+00:00\",\"dateModified\":\"2024-11-29T15:10:26+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#primaryimage\",\"url\":\"https:\/\/allendowney.github.io\/DataQnA\/_images\/6520d3305e45a1d25be58e49729b7a380e68afd2546d79afcd9f462338ec02b0.png\",\"contentUrl\":\"https:\/\/allendowney.github.io\/DataQnA\/_images\/6520d3305e45a1d25be58e49729b7a380e68afd2546d79afcd9f462338ec02b0.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.allendowney.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hazard and Survival\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/#website\",\"url\":\"https:\/\/www.allendowney.com\/blog\/\",\"name\":\"Probably Overthinking It\",\"description\":\"Data science, Bayesian Statistics, and other ideas\",\"publisher\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.allendowney.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/#organization\",\"name\":\"Probably Overthinking It\",\"url\":\"https:\/\/www.allendowney.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/03\/probably_logo.png\",\"contentUrl\":\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/03\/probably_logo.png\",\"width\":714,\"height\":784,\"caption\":\"Probably Overthinking It\"},\"image\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/AllenDowney\",\"https:\/\/www.linkedin.com\/in\/allendowney\/\",\"https:\/\/bsky.app\/profile\/allendowney.bsky.social\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/4e5bfb2e9af6c3446cb0031a7bf83207\",\"name\":\"AllenDowney\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/fb01b3a7f7190bea1bbf7f0852e686c2f8c03b099222df2ce4bc7926f15bcb43?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/fb01b3a7f7190bea1bbf7f0852e686c2f8c03b099222df2ce4bc7926f15bcb43?s=96&d=mm&r=g\",\"caption\":\"AllenDowney\"},\"url\":\"https:\/\/www.allendowney.com\/blog\/author\/allendowney_6dbrc4\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hazard and Survival - Probably Overthinking It","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/","og_locale":"en_US","og_type":"article","og_title":"Hazard and Survival - Probably Overthinking It","og_description":"Here\u2019s a question from the Reddit statistics forum. If I have a tumor that I\u2019ve been told has a malignancy rate of 2% per year, does that compound? So after 5 years there\u2019s a 10% chance it will turn malignant? This turns out to be an interesting question, because the answer depends on what that 2% means. If we know that it\u2019s the same for everyone, and it doesn\u2019t vary over time, computing the compounded probability after 5 years is... Read More Read More","og_url":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/","og_site_name":"Probably Overthinking It","article_published_time":"2024-11-28T13:54:48+00:00","article_modified_time":"2024-11-29T15:10:26+00:00","og_image":[{"url":"https:\/\/allendowney.github.io\/DataQnA\/_images\/6520d3305e45a1d25be58e49729b7a380e68afd2546d79afcd9f462338ec02b0.png","type":"","width":"","height":""}],"author":"AllenDowney","twitter_card":"summary_large_image","twitter_creator":"@AllenDowney","twitter_site":"@AllenDowney","twitter_misc":{"Written by":"AllenDowney","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#article","isPartOf":{"@id":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/"},"author":{"name":"AllenDowney","@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/4e5bfb2e9af6c3446cb0031a7bf83207"},"headline":"Hazard and Survival","datePublished":"2024-11-28T13:54:48+00:00","dateModified":"2024-11-29T15:10:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/"},"wordCount":1007,"publisher":{"@id":"https:\/\/www.allendowney.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#primaryimage"},"thumbnailUrl":"https:\/\/allendowney.github.io\/DataQnA\/_images\/6520d3305e45a1d25be58e49729b7a380e68afd2546d79afcd9f462338ec02b0.png","inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/","url":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/","name":"Hazard and Survival - Probably Overthinking It","isPartOf":{"@id":"https:\/\/www.allendowney.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#primaryimage"},"image":{"@id":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#primaryimage"},"thumbnailUrl":"https:\/\/allendowney.github.io\/DataQnA\/_images\/6520d3305e45a1d25be58e49729b7a380e68afd2546d79afcd9f462338ec02b0.png","datePublished":"2024-11-28T13:54:48+00:00","dateModified":"2024-11-29T15:10:26+00:00","breadcrumb":{"@id":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#primaryimage","url":"https:\/\/allendowney.github.io\/DataQnA\/_images\/6520d3305e45a1d25be58e49729b7a380e68afd2546d79afcd9f462338ec02b0.png","contentUrl":"https:\/\/allendowney.github.io\/DataQnA\/_images\/6520d3305e45a1d25be58e49729b7a380e68afd2546d79afcd9f462338ec02b0.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.allendowney.com\/blog\/2024\/11\/28\/hazard-and-survival\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.allendowney.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Hazard and Survival"}]},{"@type":"WebSite","@id":"https:\/\/www.allendowney.com\/blog\/#website","url":"https:\/\/www.allendowney.com\/blog\/","name":"Probably Overthinking It","description":"Data science, Bayesian Statistics, and other ideas","publisher":{"@id":"https:\/\/www.allendowney.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.allendowney.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.allendowney.com\/blog\/#organization","name":"Probably Overthinking It","url":"https:\/\/www.allendowney.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/03\/probably_logo.png","contentUrl":"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/03\/probably_logo.png","width":714,"height":784,"caption":"Probably Overthinking It"},"image":{"@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/AllenDowney","https:\/\/www.linkedin.com\/in\/allendowney\/","https:\/\/bsky.app\/profile\/allendowney.bsky.social"]},{"@type":"Person","@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/4e5bfb2e9af6c3446cb0031a7bf83207","name":"AllenDowney","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/fb01b3a7f7190bea1bbf7f0852e686c2f8c03b099222df2ce4bc7926f15bcb43?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fb01b3a7f7190bea1bbf7f0852e686c2f8c03b099222df2ce4bc7926f15bcb43?s=96&d=mm&r=g","caption":"AllenDowney"},"url":"https:\/\/www.allendowney.com\/blog\/author\/allendowney_6dbrc4\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1715,"url":"https:\/\/www.allendowney.com\/blog\/2026\/01\/31\/the-girl-born-on-tuesday\/","url_meta":{"origin":1440,"position":0},"title":"The Girl Born on Tuesday","author":"AllenDowney","date":"January 31, 2026","format":false,"excerpt":"Some people have strong opinions about this question: In a family with two children, if at least one of the children is a girl born on Tuesday, what are the chances that both children are girls? In this article, I hope to offer A solution to one interpretation of this\u2026","rel":"","context":"In \"Bayes&#039;s Theorem\"","block_context":{"text":"Bayes&#039;s Theorem","link":"https:\/\/www.allendowney.com\/blog\/tag\/bayess-theorem\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2026\/01\/c81aa262e67d9b56ecabe5664c2397cdd0375ce23e2d2c683d8d281e36c47726.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2026\/01\/c81aa262e67d9b56ecabe5664c2397cdd0375ce23e2d2c683d8d281e36c47726.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2026\/01\/c81aa262e67d9b56ecabe5664c2397cdd0375ce23e2d2c683d8d281e36c47726.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":835,"url":"https:\/\/www.allendowney.com\/blog\/2023\/02\/13\/one-queue-or-two\/","url_meta":{"origin":1440,"position":1},"title":"One Queue or Two","author":"AllenDowney","date":"February 13, 2023","format":false,"excerpt":"I'm happy to report that copyediting of Modeling and Simulation in Python is done, and the book is off to the printer! Electronic versions are available now from No Starch Press; print copies will be available in May, but you can pre-order now from No Starch Press, Amazon, and Barnes\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/01\/image.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/01\/image.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/01\/image.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1163,"url":"https:\/\/www.allendowney.com\/blog\/2023\/12\/29\/how-many-books\/","url_meta":{"origin":1440,"position":2},"title":"How Many Books?","author":"AllenDowney","date":"December 29, 2023","format":false,"excerpt":"If you like this article, you can read more about this kind of Bayesian analysis in Think Bayes. Recently I found a copy of Probably Overthinking It at a local bookstore and posted a picture on Twitter. Aubrey Clayton replied with this question: It's a great question with what turns\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/12\/image-11.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/12\/image-11.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/12\/image-11.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":985,"url":"https:\/\/www.allendowney.com\/blog\/2023\/07\/16\/homophobia-and-religion\/","url_meta":{"origin":1440,"position":3},"title":"Homophobia and Religion","author":"AllenDowney","date":"July 16, 2023","format":false,"excerpt":"Two weeks ago I published an excerpt from Probably Overthinking It where I presented data from the General Social Survey showing a steep decrease in the percentage of people in the U.S. who think homosexuality is wrong. Last week I followed up to answer a question about data from Pew\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/07\/reliten2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/07\/reliten2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/07\/reliten2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/07\/reliten2.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/07\/reliten2.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/07\/reliten2.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1071,"url":"https:\/\/www.allendowney.com\/blog\/2023\/10\/22\/the-world-population-singularity\/","url_meta":{"origin":1440,"position":4},"title":"The World Population Singularity","author":"AllenDowney","date":"October 22, 2023","format":false,"excerpt":"One of the exercises in Modeling and Simulation in Python invites readers to download estimates of world population from 10,000 BCE to the present, and to see if they are well modeled by any simple mathematical function. Here's what the estimates look like (aggregated on Wikipedia from several researchers and\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/10\/image-14.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1154,"url":"https:\/\/www.allendowney.com\/blog\/2023\/12\/19\/what-are-the-odds\/","url_meta":{"origin":1440,"position":5},"title":"What are the odds?","author":"AllenDowney","date":"December 19, 2023","format":false,"excerpt":"Whenever something unlikely happens, it is tempting to ask, \"What are the odds?\" In some very limited cases, we can answer that question. For example, if someone deals you five cards from a well-shuffled deck, and you want to know the odds of getting a royal flush, we can answer\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/12\/image-3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/12\/image-3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/12\/image-3.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/12\/image-3.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/posts\/1440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/comments?post=1440"}],"version-history":[{"count":3,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/posts\/1440\/revisions"}],"predecessor-version":[{"id":1444,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/posts\/1440\/revisions\/1444"}],"wp:attachment":[{"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/media?parent=1440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/categories?post=1440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/tags?post=1440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}