Difference between revisions of "Ieddtab"

Jump to: navigation, search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
<code>ieddtab</code> is a Stata command that estimates and outputs [[Difference-in-Differences | differences in differences]] results in well-formatted tables. This page describes how to use the command and how it works.  
<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.  


==Read First==
==Read First==


*<code>ieddtab</code> is a Stata command that estimates and outputs [[Difference-in-Differences | differences in differences]] results in well-formatted tables.
*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.
*This command is a part of the package [[Stata_Coding_Practices#ietoolkit|ietoolkit]]. To install all the commands in this package including <code>ieddtab</code>, type <code>ssc install ietoolkit</code> in Stata.
* For detailed instructions on how to implement the command in Stata, type <code>help ieddtab</code> in Stata.
* For detailed instructions on how to implement the command in Stata, type <code>help ieddtab</code> in Stata.  


==Overview==
==Overview==


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:  
<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:  
 
  <nowiki>ieddtab varA, time(t) treatment(treat)</nowiki>  
<code>ieddtab varA, time(t) treatment(treat)</code>  
 
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 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.  
The command then outputs the results into a well-formatted table.


==How it Works ==
==How it Works ==


This section explains how the command estimates results. 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.  
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).  
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
<code>generate interact = t * treat</code>
regress varA time treat interact
<code>regress varA time treat interact</code>
generate sample = e(sample)
<code>generate sample = e(sample)</code>
regress varA time if treat == 0 & sample == 1
<code>regress varA time if treat == 0 & sample == 1</code>
regress varA time if treat == 1 & sample == 1
<code>regress varA time if treat == 1 & sample == 1</code>
mean varA if time == 0 & treat == 0 & sample == 1
<code>mean varA if time == 0 & treat == 0 & sample == 1</code>
mean varA if time == 0 & treat == 1 & sample == 1</nowiki>
<code>mean varA if time == 0 & treat == 1 & sample == 1</code>
The tempvars are automatically deleted when the command ends.
 
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 ==
== 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