From a9ca70e453866ebadb74b2cb5d8618e6a62c4365 Mon Sep 17 00:00:00 2001 From: Kazuharu Yanagimoto Date: Mon, 9 Sep 2024 15:52:21 +0200 Subject: [PATCH] Fix variance computation --- DESCRIPTION | 2 +- NEWS.md | 1 + R/compute_projection.R | 2 +- man/figures/README-var_cage-1.svg | 202 +++++++++++++++--------------- 4 files changed, 104 insertions(+), 103 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b87d093..443d540 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: unitdid Title: Unit-level Difference-in-Difference Estimator -Version: 0.0.6 +Version: 0.0.6.1 Authors@R: person(given = "Kazuharu", family = "Yanagimoto", diff --git a/NEWS.md b/NEWS.md index 270f023..ce3c26a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,7 @@ New Features: Bug Fixes: - `varerr` and `coverr` is not correctly estimated when `k_min` is not 0 +- Formula for `varerr` and `coverr` was incorrect (v0.0.6.1) ## 0.0.5 diff --git a/R/compute_projection.R b/R/compute_projection.R index c13634a..b782ec2 100644 --- a/R/compute_projection.R +++ b/R/compute_projection.R @@ -128,7 +128,7 @@ altepsilon_ek <- function(data, iname, tname, ename, k_min, e, k) { mean_epsilon <- data |> dplyr::filter(!!rlang::sym(ename) + k_min > e + k, - !!rlang::sym(tname) < e + k) |> + !!rlang::sym(tname) < e + k_min) |> dplyr::summarize(mean_epsilon = stats::weighted.mean(zz000ytilde, w = zz000w), .by = !!rlang::sym(iname)) diff --git a/man/figures/README-var_cage-1.svg b/man/figures/README-var_cage-1.svg index e205c4c..9a7c836 100644 --- a/man/figures/README-var_cage-1.svg +++ b/man/figures/README-var_cage-1.svg @@ -330,19 +330,19 @@ - + - + - - - - - - - + + + + + + + @@ -353,22 +353,22 @@ - + - + - + - + - - - - - + + + + + @@ -382,19 +382,19 @@ - + - + - - - - + + + + - - + + @@ -405,22 +405,22 @@ - + - + - + - - - - - - - + + + + + + + @@ -434,19 +434,19 @@ - + - + - - - + + + - + - + @@ -457,22 +457,22 @@ - + - + - + - - - - - - - + + + + + + + @@ -486,19 +486,19 @@ - + - + - + - - + + - - + + @@ -509,22 +509,22 @@ - + - + - + - + - - - - - + + + + + @@ -538,19 +538,19 @@ - + - + - - - - - - - + + + + + + + @@ -561,22 +561,22 @@ - + - + - + - - - - - + + + + + @@ -719,14 +719,14 @@ - - - + + + - - - + + + @@ -734,19 +734,19 @@ - - - + + + - - - + + + - - - + + +