Skip to content

Main content

Econometrics: Difference-in-Differences Two By Two Contrast Tool

Compute the descriptive two-by-two difference-in-differences contrast from explicit cell means; no causal identification, parallel-trends claim or uncertainty estimation.

Loading tool…

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

  1. Enter treatedBefore, treatedAfter, controlBefore, controlAfter. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

Compute treatedChange = treatedAfter-treatedBefore and controlChange = controlAfter-controlBefore; differenceInDifferences = treatedChange-controlChange.1

Input fieldMeaning and unitsAccepted input
treatedBeforeTreated BeforeRequired. Finite number.
treatedAfterTreated AfterRequired. Finite number.
controlBeforeControl BeforeRequired. Finite number.
controlAfterControl AfterRequired. Finite number.
Output fieldInterpretationReturned shape
resultObject containing the named calculated members below.Required. Object.
result.treatedChangeTreated ChangeCalculated result member: number.
result.controlChangeControl ChangeCalculated result member: number.
result.differenceInDifferencesDifference In DifferencesCalculated result member: number.
json
{
  "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

  1. Calculation and input contract: econometrics/did-two-by-two-contrast — tool.io

Similar or alternative tools