Difference-in-differences
Set up, run, and review this analysis in Lifescio.
Supported analysis
Enter exactly one pre and one post observation for each numeric subject ID, with a fixed 0/1 treatment group. A group-by-period regression estimates the difference-in-differences and clusters uncertainty by subject.
Supported scope: This implementation is a balanced two-period panel, not staggered adoption or an event study. One pre-period cannot test parallel trends. Subject-clustered inference does not address treatment assignment at a higher cluster level; few independent units make inference fragile.
Prepare data and configure the analysis
Enter exactly four numeric columns: Subject, Post period, Treatment group, and Outcome. Every subject must appear exactly twice, once with post 0 and once with post 1, and must keep the same group code. Group 1 is treated and group 0 is comparison.
At least four subjects per group are required. Subject IDs are numeric identifiers, not covariates. The workflow fits the group-by-post interaction and clusters uncertainty by subject. It does not support staggered adoption, more than two periods, repeated cross-sections, or higher-level cluster selection.
Input reference (1 fields)
Enter your data and prespecified choices. Ranges include both limits. For table fields, use cell editing, Paste data, or Import CSV / TSV. Review whether the first imported row contains headings and map the source columns before applying the import. Empty numeric cells are not treated as zero. Open file is for an exported Lifescio analysis JSON file, not a spreadsheet.
| Input | Format | Allowed range | Guidance |
|---|---|---|---|
| Panel observations | Table | — | Columns in order: Subject; Post period; Treatment group; Outcome. |
Run and review
- Give the analysis a descriptive name and review every example value. Record units, data preparation, and planning assumptions in Reproducibility & notes. For simulations, record the seed and replication or sampling settings.
- Choose Run analysis. Resolve input errors before interpreting output. In the connected app, a run uses a saved input revision; local preview runs need the page to stay open.
- Review Diagnostics for method limitations, warnings, and available numerical checks. A completed run means computation finished; it does not establish that the assumptions fit your study.
- Use the Result table selector to inspect each output. Editing inputs does not recalculate existing results: an earlier-input notice means you need to run again to obtain matching results.
Understand the outputs
Difference-in-differences reports the treated change minus the comparison change, its subject-clustered standard error, 95% interval, and p-value. Group-period means and Outcome trends provide the four means used to understand the contrast.
Group 0 and group 1 refer to the input coding. The graph has only pre and post points and cannot establish a historical parallel trend. If treatment was assigned to a few sites, subject-level clustering may be insufficient for the study even though the calculation completes.
Troubleshooting and common mistakes
A panel error means a subject is duplicated, missing a period, or changes treatment group. Correct identifiers and verify that a row is one subject-period observation. Do not create invented missing outcomes simply to make the panel balanced.
An apparently significant effect still needs a credible counterfactual trend. If the study needs site-level inference, additional periods, or staggered treatment, use a design-specific workflow; the four-column form does not estimate those extensions.
After correcting inputs, run again and check that the results belong to the new input snapshot. Increasing simulation draws improves numerical precision only; it does not repair invalid data or an unsuitable model.
Save, compare, and export
In the connected app, Save analysis retains the inputs in your account. Run history lets you inspect earlier runs, each with the input revision it used. In local preview, Save analysis downloads an input file instead; download results before leaving the page.
Use Result + inputs for a JSON archive containing the completed result and its inputs, Download CSV for the selected result table, PDF report for a report, and a chart's SVG button for its figure. Table displays round to three decimals; CSV and JSON exports retain calculation precision. Use those values when assessing a result near a decision boundary.
To reopen an archive, select the matching analysis method and choose Open file. Imported inputs start a new draft; a result archive can also display its retained result. It does not attach itself to an existing account analysis or recompute the result. Save or run the imported draft when you want a new account record.