Skip to content

Commit

Permalink
Merge pull request #13 from TsaiLintung/cran
Browse files Browse the repository at this point in the history
CRAN release
  • Loading branch information
TsaiLintung authored Oct 30, 2024
2 parents a771fec + d05baef commit 18ad248
Show file tree
Hide file tree
Showing 27 changed files with 145 additions and 78 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
^pkgdown$
^doc$
^Meta$
^CRAN-SUBMISSION$
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 1.0.0
Date: 2024-09-10 17:40:51 UTC
SHA: e65472a724613f5001e18df2fd0a124d1698a178
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: fastdid
Type: Package
Title: Fast Staggered Difference-in-Difference Estimators
Version: 0.9.9
Date: 2024-09-08
Version: 1.0.2
Date: 2024-10-25
Authors@R: c(
person("Lin-Tung","Tsai",
role = c("aut", "cre", "cph"),
Expand All @@ -14,10 +14,10 @@ Authors@R: c(
family = "Tseng", ,
role = "ctb"))
Maintainer: Lin-Tung Tsai <[email protected]>
Description: A fast and flexible implementation of Callaway and Sant'Anna's (2021)<https://www.sciencedirect.com/science/article/pii/S0304407620303948> staggered Difference-in-Differences (DiD) estimators and its extensions, fastdid reduces the computation time from hours to seconds, and incorporates extensions such as time-varying covariates and multiple events.
Description: A fast and flexible implementation of Callaway and Sant'Anna's (2021)<doi:10.1016/j.jeconom.2020.12.001> staggered Difference-in-Differences (DiD) estimators, 'fastdid' reduces the computation time from hours to seconds, and incorporates extensions such as time-varying covariates and multiple events.
License: MIT + file LICENSE
Imports:
data.table,
data.table (>= 1.15.0),
stringr,
BMisc,
collapse,
Expand Down
14 changes: 13 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# fastdid 1.0.2

- Fixed Typo for CRAN

# fastdid 1.0.1

- Fixed Typo for CRAN

# Version 1.0.0

- Release to CRAN!

# Version 0.9.9

- add double did (see the vignette for the introduction)
Expand Down Expand Up @@ -38,4 +50,4 @@
# Version 0.9.1

- now supprts estimation for multiple outcomes in one go!
- data validation: no longer check missing values for columns not used.
- data validation: no longer check missing values for columns not used.
5 changes: 3 additions & 2 deletions R/aux_funcs.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ coerce_dt <- function(dt, p){
if(!is.na(p$cohortvar2)){return(coerce_dt_doub(dt, p))} #in doubledid.R

#chcek if there is availble never-treated group
if(!is.infinite(dt[, max(G)]) & p$control_option != "notyet"){
warning("no never-treated availble, effectively using not-yet-treated control")
if(!is.infinite(dt[, max(G)])){
if(p$control_option == "both"){warning("no never-treated availble, effectively using not-yet-but-eventually-treated as control")}
if(p$control_option == "never"){stop("no never-treated availble.")}
}

if(p$allow_unbalance_panel){
Expand Down
11 changes: 6 additions & 5 deletions R/double_did.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ ming <- function(GG){

coerce_dt_doub <- function(dt, p){

#chcek if there is availble never-treated group
if(!is.infinite(dt[, max(ming(G))]) & p$control_option != "notyet"){
warning("no never-treated availble, effectively using not-yet-treated control")
}

setnames(dt, "G", "G1")
dt[, mg := pmin(G1, G2)]
setorder(dt, time, mg, G1, G2, unit) #for sort one quick access

#check if there is availble never-treated group
if(!is.infinite(dt[, max(mg)])){
if(p$control_option == "both"){warning("no never-treated availble, effectively using not-yet-but-eventually-treated as control")}
if(p$control_option == "never"){stop("no never-treated availble.")}
}

if(p$allow_unbalance_panel){ #let unit start from 1 .... N, useful for knowing which unit is missing
dt_inv_raw <- dt[dt[, .I[1], by = unit]$V1]
setorder(dt_inv_raw, mg, G1, G2)
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@
[![R-CMD-check](https://github.com/TsaiLintung/fastdid/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/TsaiLintung/fastdid/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

fastdid implements the Difference-in-Differences (DiD) estimators in [Callaway and Sant'Anna's (2021)](https://www.sciencedirect.com/science/article/pii/S0304407620303948). fastdid is
fastdid implements the Difference-in-Differences (DiD) estimators in [Callaway and Sant'Anna's (2021)](https://doi.org/10.1016/j.jeconom.2020.12.001). fastdid is

- fast, reducing the computation time with millions of units from hours to [seconds](https://tsailintung.github.io/fastdid/articles/misc.html#performance),
- flexible, allowing extensions such as [time-varying covariates](https://arxiv.org/abs/2406.15288) and [multiple events](https://arxiv.org/abs/2409.05184).

# Getting Started

fastdid can be installed from GitHub.
fastdid can be installed from CRAN,

```
install.packages("fastdid")
```

or the latest developmental version can be installed via GitHub,

```
# install.packages("devtools")
Expand Down
11 changes: 9 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## Resubmission
This is a resubmission. In this version I have:

* Update the package name in DESCRIPTION.

* Change the titles of vignette to be more meaningful.

* Re-scale the image in vignette misc.

## R CMD check results

0 errors | 0 warnings | 0 note

* This is a new release.
6 changes: 3 additions & 3 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/LICENSE.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions docs/articles/double.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions docs/articles/misc.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 18ad248

Please sign in to comment.