Difference-in-Differences with a Continuous Treatment
Overview
Provides methods for difference-in-differences with a continuous treatment and staggered treatment adoption. Includes estimation of treatment effects and causal responses as a function of the dose, event studies indexed by length of exposure to the treatment, and aggregation into overall average effects. Uniform inference procedures are included, along with both parametric and nonparametric models for treatment effects. The methods are based on Callaway, Goodman-Bacon, and Sant'Anna (2025) doi:10.48550/arXiv.2107.02637.
- Resubmission to CRAN following archival on 2026-07-16 (contdid was archived because its dependency
ptetoolshad been archived;ptetoolshas since been restored to CRAN as version 1.0.1). - Require
ptetools (>= 1.0.1)inImportsto prevent recurrence. - Update
ggcont_did()to useptetools'sautoplot()methods in place of the now-deprecatedggpte()/ggpte_cont().
From NEWS.md in the release
Install
Health
ERRORtestsr-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-release-linux-x86_64
r-devel-linux-x86_64-debian-gcc
Running ‘testthat.R’ [18s/20s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
> # * https://testthat.r-lib.org/articles/special-files.html
>
> library(testthat)
> library(contdid)
>
> test_check("contdid")
Saving _problems/test-cont_did-54.R
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 3 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-cont_did.R:37:3'): test basic functionality ────────────────────
Error: D must contain only 0 (comparison) and 1 (treated).
Backtrace:
▆
1. ├─base::suppressWarnings(...) at test-cont_did.R:37:3
2. │ └─base::withCallingHandlers(...)
3. └─contdid::cont_did(...)
4. └─ptetools::pte(...)
5. └─ptetools::compute.pte(...)
6. └─ptetools (local) attgt_fun(gt_data = gt_data, ...)
7. └─DRDID::drdid_panel(...)
8. └─DRDID:::validate_treatment_indicator(D)
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 3 ]
Error:
! Test failures.
Execution haltedr-devel-linux-x86_64-fedora-clang
Running ‘testthat.R’ [20s/42s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
> # * https://testthat.r-lib.org/articles/special-files.html
>
> library(testthat)
> library(contdid)
>
> test_check("contdid")
Saving _problems/test-cont_did-54.R
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 3 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-cont_did.R:37:3'): test basic functionality ────────────────────
Error: D must contain only 0 (comparison) and 1 (treated).
Backtrace:
▆
1. ├─base::suppressWarnings(...) at test-cont_did.R:37:3
2. │ └─base::withCallingHandlers(...)
3. └─contdid::cont_did(...)
4. └─ptetools::pte(...)
5. └─ptetools::compute.pte(...)
6. └─ptetools (local) attgt_fun(gt_data = gt_data, ...)
7. └─DRDID::drdid_panel(...)
8. └─DRDID:::validate_treatment_indicator(D)
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 3 ]
Error:
! Test failures.
Execution haltedr-devel-linux-x86_64-fedora-gcc
Running ‘testthat.R’ [19s/57s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
> # * https://testthat.r-lib.org/articles/special-files.html
>
> library(testthat)
> library(contdid)
>
> test_check("contdid")
Saving _problems/test-cont_did-54.R
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 3 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-cont_did.R:37:3'): test basic functionality ────────────────────
Error: D must contain only 0 (comparison) and 1 (treated).
Backtrace:
▆
1. ├─base::suppressWarnings(...) at test-cont_did.R:37:3
2. │ └─base::withCallingHandlers(...)
3. └─contdid::cont_did(...)
4. └─ptetools::pte(...)
5. └─ptetools::compute.pte(...)
6. └─ptetools (local) attgt_fun(gt_data = gt_data, ...)
7. └─DRDID::drdid_panel(...)
8. └─DRDID:::validate_treatment_indicator(D)
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 3 ]
Error:
! Test failures.
Execution haltedr-release-linux-x86_64
Running ‘testthat.R’ [28s/31s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
> # * https://testthat.r-lib.org/articles/special-files.html
>
> library(testthat)
> library(contdid)
>
> test_check("contdid")
Saving _problems/test-cont_did-54.R
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 3 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-cont_did.R:37:3'): test basic functionality ────────────────────
Error: D must contain only 0 (comparison) and 1 (treated).
Backtrace:
▆
1. ├─base::suppressWarnings(...) at test-cont_did.R:37:3
2. │ └─base::withCallingHandlers(...)
3. └─contdid::cont_did(...)
4. └─ptetools::pte(...)
5. └─ptetools::compute.pte(...)
6. └─ptetools (local) attgt_fun(gt_data = gt_data, ...)
7. └─DRDID::drdid_panel(...)
8. └─DRDID:::validate_treatment_indicator(D)
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 3 ]
Error:
! Test failures.
Execution halted- ERROR9 OK, 4 ERRORNow
- ERROR11 OK, 2 ERROR2026-10-23
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-08
Show 3 earlier changesHide 3 earlier changes
- OK13 OK2026-05-02
- ERROR11 OK, 1 ERROR2026-04-25
- OK14 OK2026-03-10
Documentation
- Help pages
- 9 (1 internal)includes a package overview page
- Examples that run
- 50%1 run in a plain check · 1 only when donttest examples are enabled (R CMD check --as-cran)
- Exported functions with examples
- 25%
- Documented parameters
- 98%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 2
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Issues over time
Commits over time
7 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/bcallaway11/contdid on 2026-10-21.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
This repository shows signs of AI coding tools.
- Claude Codefirst seen on or before 2026-07-20Named in .Rbuildignore: .claudeCommits: at least 4 crediting it in the message
- Claude Sonnet 54 commits · Jul 2026
Dependencies
Installing contdid adds 50 packages (26 with compiled code, 46 MB of source tarballs). Heaviest: BH 14 MB, ggplot2 6.0 MB, data.table 5.7 MB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- unarchivedReturned to CRAN2026-07-21
- 0.1.1Latest
- archivedRemoved from CRAN2026-07-16requires archived package 'ptetools'
- RR 4.6.0 released · 2026-04-24
- 0.1.02025-07-03
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2025-07-03
- Total releases
- 2 / 1 yrs
- License
- GPL-3 OSI
- Minimum R
- ≥ 4.1.0
- Download size
- 179 KB
Cite
Cite this package
Run in R for the authors' entry:
citation("contdid")The package provides a citation file, so citation() returns the authors' own entry.
The repository also keeps a CITATION.cff.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.