{"id":12165,"date":"2016-12-19T05:00:20","date_gmt":"2016-12-19T11:00:20","guid":{"rendered":"http:\/\/marcfbellemare.com\/wordpress\/?p=12165"},"modified":"2017-01-19T16:26:42","modified_gmt":"2017-01-19T22:26:42","slug":"metrics-monday-testing-for-mechanisms-and-sometimes-ruling-out-all-other-mechanisms","status":"publish","type":"post","link":"https:\/\/marcfbellemare.com\/wordpress\/12165","title":{"rendered":"&#8216;Metrics Monday: Testing for Mechanisms (and Possibly Ruling Out All Other Mechanisms) (Updated)"},"content":{"rendered":"<p>A few weeks ago, one of my doctoral advisees wrote to me asking me how she could test for a specific mechanism behind the causal effect she is trying to estimate in her job-market paper.<\/p>\n<p>Letting [math]y[\/math] be her outcome of interest,\u00a0[math]D[\/math] her treatment of interest,\u00a0[math]x[\/math] be a vector of control variables, and [math]\\epsilon[\/math] be an error term with mean zero, my student was estimating<\/p>\n<p>(1) [math]y = \\alpha_{0} + \\beta_{0}{x} + \\gamma_{0}{D}+\\epsilon[\/math],<\/p>\n<p>in which she was interested in\u00a0[math]\\gamma[\/math], or the causal impact of\u00a0[math]D[\/math] on\u00a0[math]y[\/math].<\/p>\n<p>But more importantly for the purposes of this post, she was also interested in whether\u00a0[math]M[\/math] is a mechanism through which\u00a0[math]D[\/math] causes\u00a0[math]y[\/math]. I suggested\u00a0the usual thing I often see done, which is to estimate<\/p>\n<p>(1&#8242;) [math]y = \\alpha_{1} + \\beta_{1}{x} + \\phi_{1}{M} + \\gamma_{1}{D}+\\nu[\/math],<\/p>\n<p>in which case if [math]\\gamma[\/math] dropped out of significance and [math]\\phi[\/math] was significant (and had the &#8220;right&#8221;) sign, then she could say that [math]M[\/math] was a mechanism through which [math]D[\/math] cause [math]y[\/math]. I also suggested maybe conducting a\u00a0<a href=\"https:\/\/www.amazon.com\/gp\/product\/0195060113\/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&amp;tag=marfbel-20&amp;camp=1789&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=0195060113&amp;linkId=88a2b79f7677eba39a9a3c6e7da01634\">Davidson-MacKinnon J-test for non-nested hypotheses<\/a>\u00a0to assess the robustness of her mechanism finding.<!--more--><\/p>\n<p>As it turns out, the standard method of testing for mechanisms show in in equation (1&#8242;) above is wrong. A few days after my student asked me how to test for her posited mechanism, my colleague <a href=\"http:\/\/jasonkerwin.com\/\">Jason Kerwin<\/a> (if you don&#8217;t already know of his work, you should) commented in a different context at our Friday Trade and Development seminar that this was a mistaken way to do it, and talked about a recent paper by <a href=\"http:\/\/www.mattblackwell.org.s3-website-us-east-1.amazonaws.com\/files\/papers\/direct-effects.pdf\">Acharya et al. (2016)<\/a> in the <em>American Political Science Review<\/em>\u00a0in which the authors:<\/p>\n<ul>\n<li>Show that the method laid out in equation 1 can lead to biased estimates,<\/li>\n<li>Develop a method\u00a0to test for whether [math]M[\/math] is a\u00a0mechanism through which [math]D[\/math] causes [math]y[\/math] which\u00a0relies on determining which controls are pre-treatment, and which controls are post-treatment (including presumed mechanism\u00a0[math]M[\/math]), and<\/li>\n<li>Provide R and Stata codes to use their method.<\/li>\n<\/ul>\n<p>As if that weren&#8217;t important enough, Acharya et al.&#8217;s method allows doing one thing that social scientists often dream of doing, viz. ruling out all other possible mechanisms, beyond any reasonable (i.e., statistical) doubt.<\/p>\n<p>That is, their method not only tells you whether [math]M[\/math] is a\u00a0mechanism through which [math]D[\/math] causes [math]y[\/math], it can also tell you <em>whether there is any significant amount of statistical variation left in the causal relationship flowing from<\/em>\u00a0[math]D[\/math] <em>through\u00a0<\/em>[math]y[\/math] <em>after\u00a0<\/em>[math]M[\/math] <em>is accounted for<\/em>. <a href=\"http:\/\/marcfbellemare.com\/wordpress\/6339\">In my experience<\/a>, this really is the most powerful part of Acharya et al.&#8217;s contribution.<\/p>\n<p>Acharya et al.&#8217;s paper should be read in its entirety, but briefly, their method consists in the following for the example above:<\/p>\n<ol>\n<li>Split the vector of controls [math]x[\/math] into pre- and post-treatment controls, respecitvely\u00a0[math]x_{0}[\/math] and\u00a0[math]x_{1}[\/math]. Let\u00a0[math]x = (x_{0},x_{1})[\/math].<\/li>\n<li>Estimate equation (1&#8242;) above.<\/li>\n<li>Compute [math]\\tilde{Y} = Y &#8211; \\hat{\\phi}{M}[\/math].<\/li>\n<li>Estimate\u00a0[math]\\tilde{Y} = \\delta + \\theta{X}_{0} + \\kappa{D}+\\xi[\/math].<\/li>\n<\/ol>\n<p>The coefficient of interest is still [math]D[\/math], but it now tells us what is the effect of the treatment variable after removing the effect of the mechanism. This means that if one fails to reject the null hypothesis that [math]\\kappa = 0[\/math], this means that the treatment itself has no effect on the dependent variable once the mechanism is taken into account.*<\/p>\n<p>(The setup in steps 2 to 4 above relies on generated regressors, the whole procedure needs to be bootstrapped, which is why Acharya et al. provide R and Stata codes;\u00a0there are two typos in their Stata code; if you&#8217;d like to use it, <del>email me<\/del>\u00a0 see below.)<\/p>\n<p>As soon as I realized what\u00a0Acharya et al.&#8217;s method could do,\u00a0I had to try it out. In a paper I am working on with coauthors, we look at whether participation in contract farming provides partial insurance to growers by way of reducing income variability. Our preliminary findings suggest that yes, participation in contract farming does reduce income variability, and thus provide growers with a means of partially insuring against income fluctuations.<\/p>\n<p>One of the theoretical predictions in our paper is that this happens via the presence in the data of fixed-price contracts&#8211;that is, contracts which guarantee a given price per unit. Using Acharya et al.&#8217;s method, I find that fixed-price contracts appear to be the only mechanism by which participation in contract farming provides partial insurance. More on this paper in a few months, when it is ready to circulate.<\/p>\n<p>UPDATE: After receiving several emails asking me for it, here is the fixed up Stata code. Keeping the above notation, the following code (i) removes the semicolon on the last line, which prevented the code from running in my version of Stata, and (ii) multiplies\u00a0[math]\\hat{\\phi}[\/math] by\u00a0[math]M[\/math] when computing\u00a0[math]\\tilde{Y}[\/math]:<\/p>\n<pre>gen y_tilde=.\r\ncapture program drop deboot\r\nprogram define deboot, rclass\r\n#delimit ;\r\nregress y M D x_0 x_1;\r\nreplace y_tilde = y - _b[M]*M;\r\nregress y_tilde D x_0;\r\nreturn scalar deffect = _b[D];\r\n#delimit cr\r\nend\r\nbootstrap deffect = r(deffect), reps(500) seed(123456789): deboot<\/pre>\n<p>___<\/p>\n<p><span style=\"font-size: small;\">* There is no way a blog post can render justice to a paper as rich and interesting as Acharya et al.&#8217;s, and their argument is more complicated. Again, the paper should be read in full to fully understand\u00a0the assumptions behind and the limitations of their method.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few weeks ago, one of my doctoral advisees wrote to me asking me how she could test for a specific mechanism behind the causal<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/marcfbellemare.com\/wordpress\/12165\">Continue reading<span class=\"screen-reader-text\">&#8216;Metrics Monday: Testing for Mechanisms (and Possibly Ruling Out All Other Mechanisms) (Updated)<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12165","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1gPg8-3ad","_links":{"self":[{"href":"https:\/\/marcfbellemare.com\/wordpress\/wp-json\/wp\/v2\/posts\/12165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/marcfbellemare.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/marcfbellemare.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/marcfbellemare.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/marcfbellemare.com\/wordpress\/wp-json\/wp\/v2\/comments?post=12165"}],"version-history":[{"count":25,"href":"https:\/\/marcfbellemare.com\/wordpress\/wp-json\/wp\/v2\/posts\/12165\/revisions"}],"predecessor-version":[{"id":12242,"href":"https:\/\/marcfbellemare.com\/wordpress\/wp-json\/wp\/v2\/posts\/12165\/revisions\/12242"}],"wp:attachment":[{"href":"https:\/\/marcfbellemare.com\/wordpress\/wp-json\/wp\/v2\/media?parent=12165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/marcfbellemare.com\/wordpress\/wp-json\/wp\/v2\/categories?post=12165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/marcfbellemare.com\/wordpress\/wp-json\/wp\/v2\/tags?post=12165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}