{"id":501,"date":"2018-07-10T16:05:03","date_gmt":"2018-07-10T21:05:03","guid":{"rendered":"http:\/\/web.education.wisc.edu\/nwhillman\/?p=501"},"modified":"2018-07-10T16:05:03","modified_gmt":"2018-07-10T21:05:03","slug":"using-difference-in-differences-in-higher-education-research","status":"publish","type":"post","link":"https:\/\/web.education.wisc.edu\/nwhillman\/index.php\/2018\/07\/10\/using-difference-in-differences-in-higher-education-research\/","title":{"rendered":"Using difference-in-differences in higher education research"},"content":{"rendered":"<p>Difference-in-differences is gaining popularity in higher education policy research and for good reason. Under <a href=\"https:\/\/www.ntanet.org\/NTJ\/68\/2\/ntj-v68n02p319-338-difference-in-differences%20methods.html\" target=\"_blank\" rel=\"noopener\">certain conditions<\/a>, it can help us <a href=\"https:\/\/press.princeton.edu\/titles\/10363.html\" target=\"_blank\" rel=\"noopener\">evaluate<\/a> the effectiveness of policy changes.<\/p>\n<p>The basic idea is that two groups were following similar trend lines for a period of time. But eventually, one group gets exposed to a new policy (the treatment) while the other group does not (the comparison). This change essentially splits time in two, where the treatment group&#8217;s exposure to the policy puts them on a new trend line. Had the policy never been adopted, the two groups would have continued on similar paths.<\/p>\n<p>I made a <a href=\"http:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/did_example_data.xlsx\">data file<\/a>\u00a0and show the steps I took to conduct this analysis in Stata.<\/p>\n<p><strong>Step 1: Generate treatment variable<\/strong><\/p>\n<p>Let&#8217;s say College A is exposed to the policy change (treatment) and College B is not (comparison). We just need a simple dummy variable to categorize these two groups. Let&#8217;s call it &#8220;treat,&#8221; where College A gets a value of 1 and College B gets a value of 0.<\/p>\n<p><a href=\"http:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-512\" src=\"http:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure1-300x181.png\" alt=\"\" width=\"505\" height=\"305\" srcset=\"https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure1-300x181.png 300w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure1-624x376.png 624w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure1-400x241.png 400w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure1.png 713w\" sizes=\"auto, (max-width: 505px) 100vw, 505px\" \/><\/a><\/p>\n<p><strong>Step 2: Generate &#8220;post&#8221; policy variable<\/strong><\/p>\n<p>In the previous step, we didn&#8217;t say <em>when<\/em> the policy change occurred, so we need to do that now. Let&#8217;s say it began in 2015, meaning all years from that point forward are &#8220;post-policy&#8221; while those prior are &#8220;pre-policy.&#8221;<\/p>\n<p><a href=\"http:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-513\" src=\"http:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure2-300x264.png\" alt=\"\" width=\"367\" height=\"323\" srcset=\"https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure2-300x264.png 300w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure2-400x352.png 400w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure2.png 480w\" sizes=\"auto, (max-width: 367px) 100vw, 367px\" \/><\/a><\/p>\n<p><strong>Step 3: Examine trends for the two groups<\/strong><\/p>\n<p>Now that we&#8217;ve identified the treatment\/control and the pre\/post periods, we can put it all together in a simple graph. I like to use the user-written &#8220;lgraph&#8221; command (use &#8220;ssc install lgraph, replace&#8221; to get it).<\/p>\n<p>We see here the two groups were following similar trends prior to the 2015 policy change, and then the treatment group started to increase at a higher rate while the comparison group did not.<\/p>\n<p><a href=\"http:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-515\" src=\"http:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure4-300x218.png\" alt=\"\" width=\"437\" height=\"318\" srcset=\"https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure4-300x218.png 300w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure4-768x559.png 768w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure4-1024x745.png 1024w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure4-624x454.png 624w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure4-400x291.png 400w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure4.png 1080w\" sizes=\"auto, (max-width: 437px) 100vw, 437px\" \/><\/a><\/p>\n<p><strong>Step 4: Difference-in-differences means table<\/strong><\/p>\n<p>The visual inspection looks like there&#8217;s probably a policy effect, but it&#8217;s hard to tell the magnitude. To get at that, we need to measure the <em>difference<\/em> in groups means before and after the policy:<\/p>\n<p><a href=\"http:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-516\" src=\"http:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure5-300x167.png\" alt=\"\" width=\"235\" height=\"131\" srcset=\"https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure5-300x167.png 300w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure5.png 326w\" sizes=\"auto, (max-width: 235px) 100vw, 235px\" \/><\/a><\/p>\n<p>Below is a simple table calculating the difference between the two groups before (-10) and after (5) the policy. It then calculates the difference before and after within each group (20 and 35, respectively).<\/p>\n<table style=\"height: 146px\" width=\"150\">\n<tbody>\n<tr>\n<td width=\"78\"><\/td>\n<td width=\"64\">Pre<\/td>\n<td width=\"64\">Post<\/td>\n<td style=\"text-align: left\" width=\"64\">Difference<\/td>\n<\/tr>\n<tr>\n<td>Comparison<\/td>\n<td>517.5<\/td>\n<td>537.5<\/td>\n<td>20<\/td>\n<\/tr>\n<tr>\n<td>Treatment<\/td>\n<td>507.5<\/td>\n<td>542.5<\/td>\n<td>35<\/td>\n<\/tr>\n<tr>\n<td>Difference<\/td>\n<td>-10<\/td>\n<td>5<\/td>\n<td><strong>15<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The comparison group increased by 20 units after the policy, while the treatment increased by 35. Similarly, the treatment group was 10 units lower than the comparison group prior to the policy, but was ahead by 5 units after. When we calculate the difference in the group differences, we get <strong>15<\/strong>\u00a0(e.g., 35 minus 20, or 5 minus -10).<\/p>\n<p><strong>Step 5: Difference-in-differences regression<\/strong><\/p>\n<p>We can run a regression on the data using the two variables created in Steps 1 and 2. The only trick is we need to interact those two variables (treat x post) to get our difference-in-differences estimate.<\/p>\n<p><a href=\"http:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-517\" src=\"http:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure6-296x300.png\" alt=\"\" width=\"478\" height=\"484\" srcset=\"https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure6-296x300.png 296w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure6-624x632.png 624w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure6-45x45.png 45w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure6-400x405.png 400w, https:\/\/web.education.wisc.edu\/nwhillman\/wp-content\/uploads\/sites\/16\/2018\/07\/figure6.png 663w\" sizes=\"auto, (max-width: 478px) 100vw, 478px\" \/><\/a><\/p>\n<p>Here, the &#8220;treat&#8221; dummy measures the treatment group&#8217;s pre-policy difference from the comparison group. And &#8220;post&#8221; is the comparison groups post-policy change. The interaction between the two variables (&#8220;treat x post&#8221;) is our average treatment effect of <strong>15<\/strong>, the same number we saw in the previous step. The intercept is the comparison group&#8217;s pre-policy mean.<\/p>\n<p>In a regression framework, we can easily add covariates, use multiple comparison groups for robustness checks, and address issues that may arise with respect to standard errors. Doing so can help rule out plausible alternative explanations to the findings, assuming other <a href=\"https:\/\/press.princeton.edu\/titles\/10363.html\" target=\"_blank\" rel=\"noopener\">important<\/a> <a href=\"https:\/\/ntanet.org\/NTJ\/68\/2\/ntj-v68n02p319-338-difference-in-differences%20methods.html\" target=\"_blank\" rel=\"noopener\">considerations<\/a> are also met.<\/p>\n<p>My goal with this post was to break down the difference-in-differences approach to help make it a little more accessible and less intimidating to researchers\/policy analysts. I am still leaning a lot about the technique, so please consider these steps some illustrative tips to get oriented\/introduced.<\/p>\n<p>Stata replication code:<\/p>\n<blockquote><p>\/\/ generate treatment variable (College A is the treated unit, College B is comparison)<br \/>\ngen treat = 1 if id==1<br \/>\nrecode treat (.=0)<br \/>\nlab def treat_lab 0 &#8220;comparison&#8221; 1 &#8220;treatment&#8221;<br \/>\nlab val treat treat_lab<br \/>\ntabstat y, by(treat) stat(n mean min max sd)<\/p>\n<p>\/\/ generate post-treatment period (2015 is start date)<br \/>\ngen post = 1 if year&gt;=2015<br \/>\nrecode post (.=0)<br \/>\nlab def post_lab 0 &#8220;pre&#8221; 1 &#8220;post&#8221;<br \/>\nlab val post post_lab<br \/>\ntabstat y, by(post) stat(n mean min max sd)<\/p>\n<p>\/\/ descriptives of the two groups<br \/>\ntable year treat, c(mean y)<br \/>\nssc install lgraph, replace<br \/>\nlgraph y year, by(treat) stat(mean) xline(2015) ylab(, nogrid) scheme(s2mono)<\/p>\n<p>\/\/ did means table<br \/>\ntable treat post, c(mean y)<\/p>\n<p>\/\/ did regression<br \/>\nxtset id year<br \/>\nxtreg y i.treat i.post i.treat#i.post<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Difference-in-differences is gaining popularity in higher education policy research and for good reason. Under certain conditions, it can help us evaluate the effectiveness of policy changes. The basic idea is that two groups were following similar trend lines for a period of time. But eventually, one group gets exposed to a new policy (the treatment) [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[1],"tags":[],"class_list":["post-501","post","type-post","status-publish","format-standard","hentry","category-community-college-research"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/web.education.wisc.edu\/nwhillman\/index.php\/wp-json\/wp\/v2\/posts\/501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/web.education.wisc.edu\/nwhillman\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/web.education.wisc.edu\/nwhillman\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/web.education.wisc.edu\/nwhillman\/index.php\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/web.education.wisc.edu\/nwhillman\/index.php\/wp-json\/wp\/v2\/comments?post=501"}],"version-history":[{"count":0,"href":"https:\/\/web.education.wisc.edu\/nwhillman\/index.php\/wp-json\/wp\/v2\/posts\/501\/revisions"}],"wp:attachment":[{"href":"https:\/\/web.education.wisc.edu\/nwhillman\/index.php\/wp-json\/wp\/v2\/media?parent=501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/web.education.wisc.edu\/nwhillman\/index.php\/wp-json\/wp\/v2\/categories?post=501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/web.education.wisc.edu\/nwhillman\/index.php\/wp-json\/wp\/v2\/tags?post=501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}