Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4f45b2d
#44 r=0 and se=TRUE object 'boot' not found
TianzhuQin Jul 24, 2025
640dfed
#56 fails once data has been coerced into a matrix for balancing
TianzhuQin Aug 13, 2025
f89af39
#58 did_wrapper work with new feature of did
TianzhuQin Aug 15, 2025
2fd13ca
#50 weighted average treatment effects
TianzhuQin Aug 15, 2025
6dccb48
parallel running sens & unit tests initial
TianzhuQin Aug 16, 2025
b37d080
ci: add R-CMD-check, test-and-check, and release workflows; run tests…
TianzhuQin Aug 16, 2025
09a5de8
ci: limit workflows to manual trigger and install HonestDiDFEct from …
TianzhuQin Aug 16, 2025
4374b23
Coding lint revise
TianzhuQin Aug 16, 2025
cb660a1
ci: re-enable auto triggers on push/PR; release workflow also runs on…
TianzhuQin Aug 16, 2025
d1c8d61
ci: install HonestDiDFEct using devtools::install_github as in local …
TianzhuQin Aug 16, 2025
d76ae66
ci: use Rscript shell for R steps to avoid PowerShell -e ambiguity on…
TianzhuQin Aug 16, 2025
815718a
CI: RGL_USE_NULL
TianzhuQin Aug 17, 2025
d8bee74
CI: simdata missing
TianzhuQin Aug 17, 2025
5fc2538
CI: simdata missing
TianzhuQin Aug 17, 2025
9ac917a
CI: simdata missing
TianzhuQin Aug 17, 2025
cf5dc82
docs: rename man/att.cumu.rd -> man/att.cumu.Rd to avoid case-insensi…
TianzhuQin Aug 17, 2025
c69af5f
data: split data/fect.RData into individual .rda files so data(simdat…
TianzhuQin Aug 17, 2025
0fa05bc
CI: diminishing warnings
TianzhuQin Aug 17, 2025
3e87d5c
ci: only run R-CMD-check on PRs to master; disable auto triggers for …
TianzhuQin Aug 17, 2025
c63d2db
ci: only run R-CMD-check on PRs to master; disable auto triggers for …
TianzhuQin Aug 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
^.*\.Rproj$
^\.Rproj\.user$
^src/.*\.(o|so|dll)$
^\.github$
^pkgdown/.*$
^.*\.Rproj$
^\.Rproj\.user$
^README\.Rmd$
^README\.md$
^NEWS\.md$
^_pkgdown\.yml$
^_pkgdown\.yml$
^LICENSE\.md$
^\.github$
^docs$
^vignettes$
^docs$
^vignettes$
^pkgdown$
70 changes: 70 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: R-CMD-check

on:
pull_request:
branches: [master]
workflow_dispatch:

jobs:
R-CMD-check:
name: ${{ matrix.config.os }} (R ${{ matrix.config.r }})
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-latest, r: "release" }
- { os: macos-latest, r: "release" }
- { os: windows-latest, r: "release" }

env:
R_KEEP_PKG_SOURCE: yes
_R_CHECK_CRAN_INCOMING_REMOTE_: false
_R_CHECK_FORCE_SUGGESTS_: false
RGL_USE_NULL: true

steps:
- uses: actions/checkout@v4
- name: Clean precompiled objects
shell: bash
run: |
rm -f src/*.o src/*.so src/*.dll || true

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::rcmdcheck
any::devtools
lzy318/HonestDiDFEct
local::.
needs: check

- name: Install HonestDiDFEct via devtools
shell: Rscript {0}
run: |
if (!requireNamespace('remotes', quietly=TRUE)) install.packages('remotes', repos='https://cloud.r-project.org')
if (!requireNamespace('HonestDiDFEct', quietly=TRUE)) remotes::install_github('lzy318/HonestDiDFEct', upgrade='never')

- name: Session info
shell: Rscript {0}
run: |
sessionInfo()

- name: Check (CRAN-like)
shell: Rscript {0}
run: |
rcmdcheck::rcmdcheck(args = c('--no-manual','--as-cran'), error_on = 'warning', check_dir = 'check')

- name: Upload check results
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-check
path: check
97 changes: 97 additions & 0 deletions .github/workflows/release-to-cran-and-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: release-to-cran-and-docs

on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
submit_to_cran:
description: "Submit to CRAN (requires secrets.GH_PAT and CRAN_EMAIL set)"
required: true
default: "false"
tag:
description: "Git tag to create (e.g., v2.0.3)"
required: true

jobs:
tag-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Clean precompiled objects
shell: bash
run: |
rm -f src/*.o src/*.so src/*.dll || true
- name: Create tag
run: |
git config user.name github-actions
git config user.email [email protected]
git tag ${{ github.event.inputs.tag }}
git push origin ${{ github.event.inputs.tag }}

submit-cran:
if: ${{ github.event.inputs.submit_to_cran == 'true' }}
needs: tag-release
runs-on: ubuntu-latest
env:
R_KEEP_PKG_SOURCE: yes
_R_CHECK_CRAN_INCOMING_REMOTE_: false
RGL_USE_NULL: true
GITHUB_PAT: ${{ secrets.GH_PAT }}
CRAN_EMAIL: ${{ secrets.CRAN_EMAIL }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
r-version: "release"
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::devtools
any::rcmdcheck
any::pkgdown
lzy318/HonestDiDFEct
local::.
needs: check
- name: Install HonestDiDFEct via devtools
shell: Rscript {0}
run: |
if (!requireNamespace('remotes', quietly=TRUE)) install.packages('remotes', repos='https://cloud.r-project.org')
if (!requireNamespace('HonestDiDFEct', quietly=TRUE)) remotes::install_github('lzy318/HonestDiDFEct', upgrade='never')
- name: CRAN checks (as-cran)
shell: Rscript {0}
run: |
rcmdcheck::rcmdcheck(args=c('--no-manual','--as-cran'), error_on='warning')
- name: Submit to CRAN (manual email)
shell: bash
run: |
Rscript -e "devtools::build('.')"
echo "Please email the built tar.gz to CRAN maintainers from $CRAN_EMAIL or use devtools::release() interactively."

pkgdown:
needs: tag-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, lzy318/HonestDiDFEct, local::.
- name: Install HonestDiDFEct via devtools
shell: Rscript {0}
run: |
if (!requireNamespace('remotes', quietly=TRUE)) install.packages('remotes', repos='https://cloud.r-project.org')
if (!requireNamespace('HonestDiDFEct', quietly=TRUE)) remotes::install_github('lzy318/HonestDiDFEct', upgrade='never')
- name: Build site
shell: Rscript {0}
run: |
pkgdown::build_site(preview = FALSE)
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
83 changes: 83 additions & 0 deletions .github/workflows/test-and-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: test-and-check

on:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
env:
R_KEEP_PKG_SOURCE: yes
_R_CHECK_CRAN_INCOMING_REMOTE_: false
_R_CHECK_FORCE_SUGGESTS_: false
RGL_USE_NULL: true
steps:
- uses: actions/checkout@v4
- name: Clean precompiled objects
shell: bash
run: |
rm -f src/*.o src/*.so src/*.dll || true
- uses: r-lib/actions/setup-r@v2
with:
r-version: "release"
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::devtools
any::testthat
lzy318/HonestDiDFEct
local::.
needs: tests
cache-version: 2
- name: Install HonestDiDFEct via devtools
shell: Rscript {0}
run: |
if (!requireNamespace('remotes', quietly=TRUE)) install.packages('remotes', repos='https://cloud.r-project.org')
if (!requireNamespace('HonestDiDFEct', quietly=TRUE)) remotes::install_github('lzy318/HonestDiDFEct', upgrade='never')
- name: Run tests
shell: Rscript {0}
run: |
devtools::test()

cran-check:
needs: test
runs-on: ubuntu-latest
env:
R_KEEP_PKG_SOURCE: yes
_R_CHECK_CRAN_INCOMING_REMOTE_: false
_R_CHECK_FORCE_SUGGESTS_: false
RGL_USE_NULL: true
steps:
- uses: actions/checkout@v4
- name: Clean precompiled objects
shell: bash
run: |
rm -f src/*.o src/*.so src/*.dll || true
- uses: r-lib/actions/setup-r@v2
with:
r-version: "release"
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::rcmdcheck
lzy318/HonestDiDFEct
local::.
needs: check
cache-version: 2
- name: Install HonestDiDFEct via devtools
shell: Rscript {0}
run: |
if (!requireNamespace('remotes', quietly=TRUE)) install.packages('remotes', repos='https://cloud.r-project.org')
if (!requireNamespace('HonestDiDFEct', quietly=TRUE)) remotes::install_github('lzy318/HonestDiDFEct', upgrade='never')
- name: CRAN incoming checks
shell: Rscript {0}
run: |
rcmdcheck::rcmdcheck(args = c('--no-manual','--as-cran'), error_on='warning', check_dir='check')
- name: Upload check results
if: failure()
uses: actions/upload-artifact@v4
with:
name: cran-check-results
path: check
30 changes: 21 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ Version: 2.0.3
Date: 2025-06-20
Authors@R:
c(person("Licheng", "Liu", , "[email protected]", role = c("aut")),
person("Ziyi", "Liu", , "[email protected]", role = c("aut", "cre")),
person("Ziyi", "Liu", , "[email protected]", role = c("aut")),
person("Ye", "Wang", , "[email protected]", role = c("aut")),
person("Yiqing", "Xu", , "[email protected]", role = c("aut")),
person("Tianzhu", "Qin", , "[email protected]", role = c("aut", "cre")),
person("Shiyun", "Hu", , "[email protected]", role = c("aut")),
person("Rivka", "Lipkovitz", , "[email protected]", role = c("aut")))
Maintainer: Ziyi Liu <zyliu2023@berkeley.edu>
Description: Provides tools for estimating causal effects in panel data using counterfactual methods, as well as other modern DID estimators. It is designed for causal panel analysis with binary treatments under the parallel trends assumption. The package supports scenarios where treatments can switch on and off and allows for limited carryover effects. It includes several imputation estimators, such as Gsynth (Xu 2017), linear factor models, and the matrix completion method. Detailed methodology is described in Liu, Wang, and Xu (2024)<arXiv:2107.00856> and Chiu et al (2025)<arXiv:2309.15983>.
Maintainer: Tianzhu Qin <tianzhu@stanford.edu>
Description: Provides tools for estimating causal effects in panel data using counterfactual methods, as well as other modern DID estimators. It is designed for causal panel analysis with binary treatments under the parallel trends assumption. The package supports scenarios where treatments can switch on and off and allows for limited carryover effects. It includes several imputation estimators, such as Gsynth (Xu 2017), linear factor models, and the matrix completion method. Detailed methodology is described in Liu, Wang, and Xu (2024) <doi:10.48550/arXiv.2107.00856> and Chiu et al. (2025) <doi:10.48550/arXiv.2309.15983>.
URL: https://yiqingxu.org/packages/fect/
NeedsCompilation: yes
License: MIT + file LICENSE
Expand All @@ -30,18 +31,29 @@ Imports:
ggplot2,
future,
mvtnorm,
dplyr
dplyr,
future.apply,
reshape2,
rlang,
scales
Suggests:
panelView
panelView,
testthat (>= 3.0.0),
did,
DIDmultiplegtDYN,
HonestDiDFEct,
ggrepel
SystemRequirements: A C++11 compiler
Depends: R (>= 3.5.0)
LinkingTo: Rcpp, RcppArmadillo
RoxygenNote: 7.3.2
Packaged: 2024-01-26 03:25:56 UTC; ziyil
Encoding: UTF-8
Author: Shiyun Hu [aut],
Rivka Lipkovitz [aut],
Licheng Liu [aut],
Author: Licheng Liu [aut],
Ziyi Liu [aut, cre],
Ye Wang [aut],
Yiqing Xu [aut] (<https://orcid.org/0000-0003-2041-6671>)
Yiqing Xu [aut] (<https://orcid.org/0000-0003-2041-6671>),
Tianzhu Qin [aut],
Shiyun Hu [aut],
Rivka Lipkovitz [aut]
Config/testthat/edition: 3
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ importFrom("gridExtra", "grid.arrange", "arrangeGrob")
importFrom("grid", "textGrob", "gpar")
importFrom("fixest", "feols")
importFrom(dplyr, "%>%", "group_by", "mutate")
importFrom("future.apply", "future_lapply")
importFrom("reshape2", "melt")
importFrom("rlang", "sym")
importFrom("scales", "pretty_breaks")

export(esplot)
export(get.cohort)
Expand Down
2 changes: 1 addition & 1 deletion R/boot.R
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ fect.boot <- function(Y,
group = boot.group,
time.on.seq.group = group.time.on,
time.off.seq.group = group.time.off
))
), silent = TRUE)
} else if (method == "ife") {
boot <- try(fect.fe(
Y = Y[, boot.id], X = X.boot, D = D.boot, W = W.boot,
Expand Down
2 changes: 1 addition & 1 deletion R/default.R
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ fect.default <- function(formula = NULL, data, # a data frame (long-form)
tempID <- unique(data[, id])
for (i in tempID) {
subpos <- which(data[, id] == i)
subtime <- data[data$id == i,]$time
subtime <- data[subpos, time]
subd <- data[subpos, Dname]
if (sum(subd) >= 1) {
tr.time <- subtime[which(subd == 1)]
Expand Down
Loading
Loading