Description
Compute the descriptive two-by-two difference-in-differences contrast from supplied group-time values.
Cutoff and event-study calculations need explicit treatment timing, reference categories and boundary rules. A numerical selection flag or before-after contrast is not evidence that the identifying assumptions for causal inference hold.
Compute the descriptive two-by-two difference-in-differences contrast from supplied group-time values.
When to use this tool
Use Econometrics: Difference-in-Differences Two By Two Contrast when checking a supplied cutoff, event-time or group-time contrast.
How to use the tool and how it works
- Enter treatedBefore, treatedAfter, controlBefore, controlAfter. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read result. Expand result to inspect the returned fields.
Compute treatedChange = treatedAfter-treatedBefore and controlChange = controlAfter-controlBefore; differenceInDifferences = treatedChange-controlChange.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| treatedBefore | Treated Before | Required. Finite number. |
| treatedAfter | Treated After | Required. Finite number. |
| controlBefore | Control Before | Required. Finite number. |
| controlAfter | Control After | Required. Finite number. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Object containing the named calculated members below. | Required. Object. |
| result.treatedChange | Treated Change | Calculated result member: number. |
| result.controlChange | Control Change | Calculated result member: number. |
| result.differenceInDifferences | Difference In Differences | Calculated result member: number. |
{
"input": {
"treatedBefore": 10,
"treatedAfter": 15,
"controlBefore": 8,
"controlAfter": 10
},
"output": {
"result": {
"treatedChange": 5,
"controlChange": 2,
"differenceInDifferences": 3
}
}
} Limitations and assumptions
- All group-time values must use comparable outcome definitions. The contrast alone does not establish parallel trends, no anticipation or a causal treatment effect.
- Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use the appropriate research design and full estimator to assess comparability, treatment assignment and causal assumptions.
References
Similar or alternative tools
- First Difference Two Period Error Term
outcomeDifference = secondOutcome-firstOutcome; regressorDifference = secondRegressor-firstRegressor; residualDifference = outcomeDifference-slope*regressorDifference.
- Regression Discontinuity Cutoff Distance Term
distance = runningVariable-cutoff; treated uses >= when equalityTreated, otherwise >; insideBandwidth = abs(distance) <= bandwidth.