Difference between revisions of "Ieddtab"
Kbjarkefur (talk | contribs) |
Kbjarkefur (talk | contribs) |
||
Line 14: | Line 14: | ||
''Describe best practices related to this command here.'' | ''Describe best practices related to this command here.'' | ||
== | == Description of the Statistics used == | ||
'' | |||
For each outcome variable five statistics are estimated. Two baseline means (one for control and one for treatment), two first differences (one for control and one for treatment) and the second difference. The baseline means show the starting point in each group, the first difference shows the trend in each group between the two time periods, and the second difference is the impact effect as estimated by a difference-in-difference model. This page is about how to use ''ieddtab'' and will therefore not discuss the statistical meaning of the results of this command more than this. | |||
The sections below discuss how the statistics are calculated by this command if the command was specified like this: | |||
<code>ieddtab varA, time(t) treatment(treat)</code> | |||
=== Interaction Dummy Creation === | |||
The command creates the interaction variable in a 'tempvar' but for the simplicity of this description we will use a regular variable and name it 'interact'. Stata treats a 'tempvar' the same as a regular variable, but a 'tempvar' is automatically deleted when the command finishes. This is how the interaction variable is created: | |||
<code>generate interact = t * treat</code> | |||
=== Difference-in-Difference === | |||
While the difference-on-difference result is presented in the last column in the table, this is the first statistics calculated as this command is used to restrict the sample when calculating the following statistics. This is because the sample for all other statistics estimations are restricted to not include any observation dropped in the difference-in-difference regression due to missing values in any variable used. | |||
The difference-in-difference result displayed in the table is the beta-coefficient of interact in the following regression. | |||
<code>regress varA time treat interact</code> | |||
A 'tempvar' indicating which observations were included in the regression above, let's make that variable a regular variable and call it 'sample' in this example. | |||
<code>generate sample = e(sample)</code> | |||
=== First Difference === | |||
The first differences, where the first difference results displayed in the table are the beta-coefficients of time, are calculated like this: | |||
For control: <code>regress varA time if treat == 0 & sample == 1</code> | |||
For treatment: <code>regress varA time if treat == 1 & sample == 1</code> | |||
=== Baseline means === | |||
The baseline means are calculated like this: | |||
For control: <code>mean varA if time == 0 & treat == 0 & sample == 1</code> | |||
For treatment: <code>mean varA if time == 0 & treat == 1 & sample == 1</code> | |||
== Back to Parent == | == Back to Parent == |
Revision as of 23:23, 20 November 2018
ieddtab is used to run difference in difference regressions and output the results in well formatted tables.
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 help ieddtab
in Stata. This command is a part of the package ietoolkit, to install all the commands in this package including this command, type ssc install ietoolkit
in Stata.
Intended use cases
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.
Intended Work Flow
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
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 help ieddtab
in Stata.
Describe best practices related to this command here.
Description of the Statistics used
For each outcome variable five statistics are estimated. Two baseline means (one for control and one for treatment), two first differences (one for control and one for treatment) and the second difference. The baseline means show the starting point in each group, the first difference shows the trend in each group between the two time periods, and the second difference is the impact effect as estimated by a difference-in-difference model. This page is about how to use ieddtab and will therefore not discuss the statistical meaning of the results of this command more than this.
The sections below discuss how the statistics are calculated by this command if the command was specified like this:
ieddtab varA, time(t) treatment(treat)
Interaction Dummy Creation
The command creates the interaction variable in a 'tempvar' but for the simplicity of this description we will use a regular variable and name it 'interact'. Stata treats a 'tempvar' the same as a regular variable, but a 'tempvar' is automatically deleted when the command finishes. This is how the interaction variable is created:
generate interact = t * treat
Difference-in-Difference
While the difference-on-difference result is presented in the last column in the table, this is the first statistics calculated as this command is used to restrict the sample when calculating the following statistics. This is because the sample for all other statistics estimations are restricted to not include any observation dropped in the difference-in-difference regression due to missing values in any variable used.
The difference-in-difference result displayed in the table is the beta-coefficient of interact in the following regression.
regress varA time treat interact
A 'tempvar' indicating which observations were included in the regression above, let's make that variable a regular variable and call it 'sample' in this example.
generate sample = e(sample)
First Difference
The first differences, where the first difference results displayed in the table are the beta-coefficients of time, are calculated like this:
For control: regress varA time if treat == 0 & sample == 1
For treatment: regress varA time if treat == 1 & sample == 1
Baseline means
The baseline means are calculated like this:
For control: mean varA if time == 0 & treat == 0 & sample == 1
For treatment: mean varA if time == 0 & treat == 1 & sample == 1
Back to Parent
This article is part of the topic ietoolkit