{"id":3536,"date":"2013-08-07T01:17:00","date_gmt":"2013-08-07T06:17:00","guid":{"rendered":"http:\/\/www.thejuliagroup.com\/blog\/?p=3536"},"modified":"2013-08-07T01:43:17","modified_gmt":"2013-08-07T06:43:17","slug":"logistic-regression-in-pictures-part-3","status":"publish","type":"post","link":"https:\/\/www.thejuliagroup.com\/blog\/logistic-regression-in-pictures-part-3\/","title":{"rendered":"Logistic regression in pictures: Part 3"},"content":{"rendered":"<p>This is the third and last part of my attempt to explain logistic regression in pictures. You can see <a href=\"http:\/\/www.thejuliagroup.com\/blog\/?p=3530\">a picture of odds ratios here<\/a>, \u00a0and a <a href=\"http:\/\/www.thejuliagroup.com\/blog\/?p=3518\">picture of two charts of predicted probabilities, to compare models, here<\/a>.<\/p>\n<p>If people only know one chart associated with logistic regression, it is usually the ROC chart, though many of them cannot tell you what ROC stands for (not that it really matters) or how to interpret the chart &#8211; which kind of does matter, because it&#8217;s useful.<\/p>\n<p>The ROC curve is an abbreviation for receiver operating characteristic curve (I told you it didn&#8217;t matter). This is a plot of<\/p>\n<p>SENSITIVITY &#8211; the percentage of true positives, the people we predicted would die who did, and<\/p>\n<p>SPECIFICITY &#8211; or true negatives, the number of people we said would NOT die, who did not<\/p>\n<p>We actually plot (1 &#8211; specificity) by sensitivity. If we predicted no one would die, our rate of true negatives would be 100%. Since we predicted nobody would die, we would be exactly right for all of the people who didn\u2019t die. 1 &#8211; 1.0 = 0\u00a0 so we\u2019d be at 0 on the X axis.<\/p>\n<p>On the other hand, we\u2019d have zero sensitivity. Since we predicted no one would die, we would have zero true positives.<\/p>\n<p>At the other extreme, if we predicted <span style=\"text-decoration: underline;\">everyone<\/span> would die, we would have 100% true positives and 0 true negatives. Since 1-0 = 1 , that would be at the upper right corner here.<\/p>\n<p>The straight line is what we would get without any predictor variables, if we just randomly guessed whether a person would live or die. The top left corner, where we have correctly predicted all of our positives and all of our negatives is what we would get in a perfect model.<\/p>\n<p>The more that curve is bowed toward the top left and away from the straight line, the better our model.<\/p>\n<p><a href=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2013\/08\/roc.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3537\" alt=\"Curve with substantial bow toward the upper left corner\" src=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2013\/08\/roc.png\" width=\"426\" height=\"429\" srcset=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2013\/08\/roc.png 426w, https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2013\/08\/roc-150x150.png 150w, https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2013\/08\/roc-297x300.png 297w\" sizes=\"auto, (max-width: 426px) 100vw, 426px\" \/><\/a><\/p>\n<p>Let&#8217;s take a look at our actual curve from the Kaiser-Permanente data, where we used gender, age, number of emergency room visits and nursing home residence (yes or no) to predict whether or not a person would die within the next nine years.<\/p>\n<p>From this, we can conclude that while our model is substantially better than random guessing &#8211; a conclusion that is consistent with what we saw in our previous charts. We can also see that there is definitely room for improvement.\u00a0Perhaps future research could improve prediction by including behavioral risk indicators such as amount of alcohol and tobacco usage, as well as socioeconomic status and diagnosis of chronic illness.<\/p>\n<p>So, there you have it \u00a0&#8211; logistic regression in three blog posts and four pictures.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the third and last part of my attempt to explain logistic regression in pictures. You can see a picture of odds ratios here, \u00a0and a picture of two charts of predicted probabilities, to compare models, here. If people only know one chart associated with logistic regression, it is usually the ROC chart, though&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-3536","post","type-post","status-publish","format-standard","hentry","category-statistics"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/3536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/comments?post=3536"}],"version-history":[{"count":3,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/3536\/revisions"}],"predecessor-version":[{"id":3540,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/3536\/revisions\/3540"}],"wp:attachment":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/media?parent=3536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/categories?post=3536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/tags?post=3536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}