{"id":17,"date":"2021-08-17T10:18:00","date_gmt":"2021-08-17T15:18:00","guid":{"rendered":""},"modified":"2024-01-27T01:17:35","modified_gmt":"2024-01-27T06:17:35","slug":"to-log-or-how-to-log","status":"publish","type":"post","link":"https:\/\/ozer.gt\/log\/2021\/08\/17\/to-log-or-how-to-log\/","title":{"rendered":"To log or how to log"},"content":{"rendered":"<p>I avoid posting technical notes here. This is an exception because I have an agenda.<\/p>\n<p>Log transformation is widely used in modeling data for several reasons: Making data &#8220;behave,&#8221; calculating elasticity etc.<\/p>\n<p>When an outcome variable naturally has zeros, however, log transformation is tricky. Many data modelers (including seasoned researchers) instinctively add a positive constant to each value in the outcome variable. One popular idea is to add 1 to the variable and transform raw zeros to log-transformed zeros. Another idea is to add a very small constant, especially when the scale of the outcome variable is small.<\/p>\n<p>Well, bad news is these are arbitrary choices and the resulting estimations may be biased. To me, if an analysis is correlational (as most are), a small bias may not be a big concern. If it is causal, and for example, an estimated elasticity will be used to take action (with an intention to change an outcome), that&#8217;s trouble waiting to happen. This is a problem of data centricity.<\/p>\n<p>What is a solution (other than deserting to Poisson etc.)? A recent study by\u00a0<a href=\"https:\/\/www.linkedin.com\/in\/christophe-bell%C3%A9go-70bb9069\/\">Christophe Bell\u00e9go<\/a> and his coauthors offers a solution called iOLS (iterated OLS). To avoid bias, the iOLS algorithm adds an observation-specific value to the outcome variable. Voila! I haven&#8217;t tested it yet but I like the idea. Read their nicely written paper here:\u00a0<a href=\"https:\/\/papers.ssrn.com\/sol3\/papers.cfm?abstract_id=3444996\">https:\/\/papers.ssrn.com\/sol3\/papers.cfm?abstract_id=3444996<\/a><\/p>\n<p>My (not so hidden) agenda is regarding the implementation. The authors offer a Stata implementation (<a href=\"https:\/\/github.com\/ldpape\/iOLS\">https:\/\/github.com\/ldpape\/iOLS<\/a>). I would love to see it in R (or Python). Hence this is a call for action.<\/p>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I avoid posting technical notes here. This is an exception because I have an agenda. Log transformation is widely used in modeling data for several reasons: Making data &#8220;behave,&#8221; calculating elasticity etc. When an outcome variable naturally has zeros, however, log transformation is tricky. Many data modelers (including seasoned researchers) instinctively add a positive constant [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":39,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"cybocfi_hide_featured_image":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-17","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/ozer.gt\/log\/wp-json\/wp\/v2\/posts\/17","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ozer.gt\/log\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ozer.gt\/log\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ozer.gt\/log\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ozer.gt\/log\/wp-json\/wp\/v2\/comments?post=17"}],"version-history":[{"count":2,"href":"https:\/\/ozer.gt\/log\/wp-json\/wp\/v2\/posts\/17\/revisions"}],"predecessor-version":[{"id":93,"href":"https:\/\/ozer.gt\/log\/wp-json\/wp\/v2\/posts\/17\/revisions\/93"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ozer.gt\/log\/wp-json\/wp\/v2\/media\/39"}],"wp:attachment":[{"href":"https:\/\/ozer.gt\/log\/wp-json\/wp\/v2\/media?parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ozer.gt\/log\/wp-json\/wp\/v2\/categories?post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ozer.gt\/log\/wp-json\/wp\/v2\/tags?post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}