Difference between revisions of "Ieddtab"

Jump to: navigation, search
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''ieddtab''' is used to run difference in difference regressions and output the results in well formatted tables.
<code>ieddtab</code> is a Stata command that estimates and outputs [[Difference-in-Differences | differences in differences]] results in well-formatted tables. It is a useful command for conducting [[Data Analysis | data analysis]] and [[Exporting Analysis | exporting results]] in a reproducible manner. This page describes how to use the command and how it works.  


This article is meant to describe use cases, work flow and the reasoning used when developing the commands. For instructions on how to use the command specifically in Stata and for a complete list of the options available, see the help files by typing <code>help '''ieddtab'''</code> in Stata. This command is a part of the package [[Stata_Coding_Practices#ietoolkit|ietoolkit]], to install all the commands in this package including this command, type <code>ssc install ietoolkit</code> in Stata.
==Read First==


== Intended use cases ==
*This command is a part of the package <code>[[Stata_Coding_Practices#ietoolkit|ietoolkit]]</code>. To install all the commands in this package including <code>ieddtab</code>, type <code>ssc install ietoolkit</code> in Stata.
The intended use case is when you are using a [[Difference-in-Difference]] model for your analysis and you want to output your results in well formatted tables. This command is particularly suited for the case when you run the same difference-in-difference regression on multiple outcome variables.
* For detailed instructions on how to implement the command in Stata, type <code>help ieddtab</code> in Stata.


=== Intended Work Flow ===
==Overview==
The workflow for ''ieddtab'' is as simple as possible. You do not need to run any regression yourself before using this command. You only need to have one dummy variable that indicates which observations are treatment and which are control, and a dummy variable that indicates which observations are from baseline and which are from the follow-up/endline. The command creates the interaction dummy needed, run the regressions as well as outputs the table with the results.


== Instructions ==
<code>ieddtab</code> is a Stata command that estimates and outputs [[Difference-in-Differences | differences in differences]] results in well-formatted tables. To run <code>ieddtab</code> in its most basic form, you need three variables: the outcome variable, a dummy variable that indicates treatment vs. control assignment and a dummy variable that indicates whether the observation comes from baseline vs. endline. In this example, these variables are varA, treat, and t, respectively. The basic implementation of the command is:
These instructions are meant to help you understand how to use the command. For technical instructions on how to implement the command in Stata see the help files by typing <code>help  '''ieddtab'''</code> in Stata.
  <nowiki>ieddtab varA, time(t) treatment(treat)</nowiki>  
The command estimates five statistics for each outcome: the baseline means of the outcome for treatment = 0 and treatment = 1; the first difference regression coefficient of the outcome for treatment = 0 and treatment = 1; and the second difference. The baseline means represent the starting average for each group, the first differences represent the trend in each group between the two time periods, and the second difference represents the impact effect as estimated by a difference-in-difference model.  


''Describe best practices related to this command here.''
The command then outputs the results into a well-formatted table.


== Reasoning used during development ==
==How it Works ==
''Describe any non obvious decisions made during development of this command. This can help explain restrictions and requirements''
 
This section explains how <code>ieddtab</code> estimates results, using the variables specified in the above example (varA, treat, t). The user does not need to know the following backend information in order to implement the command: this section is intended solely to enhance user understanding. Note that, for simplicity, any tempvars mentioned in this section are represented as normal variables.
 
The command first creates an interaction tempvar, which we call interact (line 1). The command then calculates the difference-in-difference result (line 2). The difference-in-difference result displayed in the table is the beta-coefficient of interact in the following regression. The command then creates a tempvar, which we call sample, that indicates which observations were included in the regression (line 3). The command then calculates the first differences for control and treatment, respectively (lines 4, 5). The first difference results displayed in the table are the beta-coefficients of time. Finally, the command calculates baseline means for control and treatment, respectively (lines 6, 7).
<nowiki>generate interact = t * treat
regress varA time treat interact
generate sample = e(sample)
regress varA time if treat == 0 & sample == 1
regress varA time if treat == 1 & sample == 1
mean varA if time == 0 & treat == 0 & sample == 1
mean varA if time == 0 & treat == 1 & sample == 1</nowiki>
The tempvars are automatically deleted when the command ends.


== Back to Parent ==
== Back to Parent ==
This article is part of the topic [[Stata_Coding_Practices#ietoolkit|ietoolkit]]
This article is part of the topic [[Stata_Coding_Practices#ietoolkit|ietoolkit]]
 
== Additional Resources ==
*Read more about <code>ietoolkit</code> [https://github.com/worldbank/ietoolkit here] on GitHub
[[Category: Stata ]]
[[Category: Stata ]]

Latest revision as of 17:53, 4 June 2019

ieddtab is a Stata command that estimates and outputs differences in differences results in well-formatted tables. It is a useful command for conducting data analysis and exporting results in a reproducible manner. This page describes how to use the command and how it works.

Read First

  • This command is a part of the package ietoolkit. To install all the commands in this package including ieddtab, type ssc install ietoolkit in Stata.
  • For detailed instructions on how to implement the command in Stata, type help ieddtab in Stata.

Overview

ieddtab is a Stata command that estimates and outputs differences in differences results in well-formatted tables. To run ieddtab in its most basic form, you need three variables: the outcome variable, a dummy variable that indicates treatment vs. control assignment and a dummy variable that indicates whether the observation comes from baseline vs. endline. In this example, these variables are varA, treat, and t, respectively. The basic implementation of the command is:

 ieddtab varA, time(t) treatment(treat) 

The command estimates five statistics for each outcome: the baseline means of the outcome for treatment = 0 and treatment = 1; the first difference regression coefficient of the outcome for treatment = 0 and treatment = 1; and the second difference. The baseline means represent the starting average for each group, the first differences represent the trend in each group between the two time periods, and the second difference represents the impact effect as estimated by a difference-in-difference model.

The command then outputs the results into a well-formatted table.

How it Works

This section explains how ieddtab estimates results, using the variables specified in the above example (varA, treat, t). The user does not need to know the following backend information in order to implement the command: this section is intended solely to enhance user understanding. Note that, for simplicity, any tempvars mentioned in this section are represented as normal variables.

The command first creates an interaction tempvar, which we call interact (line 1). The command then calculates the difference-in-difference result (line 2). The difference-in-difference result displayed in the table is the beta-coefficient of interact in the following regression. The command then creates a tempvar, which we call sample, that indicates which observations were included in the regression (line 3). The command then calculates the first differences for control and treatment, respectively (lines 4, 5). The first difference results displayed in the table are the beta-coefficients of time. Finally, the command calculates baseline means for control and treatment, respectively (lines 6, 7).

generate interact = t * treat
regress varA time treat interact
generate sample = e(sample)
regress varA time if treat == 0 & sample == 1
regress varA time if treat == 1 & sample == 1
mean varA if time == 0 & treat == 0 & sample == 1
mean varA if time == 0 & treat == 1 & sample == 1

The tempvars are automatically deleted when the command ends.

Back to Parent

This article is part of the topic ietoolkit

Additional Resources

  • Read more about ietoolkit here on GitHub