Skip to content

Commit 5d0b8f6

Browse files
committed
version 0.3.4 fix cran error due to bug in vignette
1 parent ce69e49 commit 5d0b8f6

31 files changed

+136
-82
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: fwildclusterboot
22
Title: Fast Wild Cluster Bootstrap Inference for Linear Regression Models
3-
Version: 0.3.3
3+
Version: 0.3.4
44
Date: 2021-04-12
55
Authors@R:
66
c(

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# fwildclusterboot 0.3.4
2+
3+
+ Fix CRAN errors caused by a small bug in the vignette
4+
15
# fwildclusterboot 0.3.3
26

37
+ implements full enumeration for Rademacher and Mammen Weights if $2^k<B$, where k is the number of clusters and B the number of bootstrap iterations

R/boot_algo2.R

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,35 @@ boot_algo2 <- function(preprocessed_object, boot_iter, point_estimate, impose_nu
199199
S_diag_XinvXXRu_S_b <- Matrix.utils::aggregate.Matrix(diag_XinvXXRuS_b, clustid[x])
200200
K_b <- S_diag_XinvXXRu_S_b - tcrossprod(SXinvXXrX_invXX, SuXb)
201201

202-
C <- eigenMapMatMult(as.matrix(K_a), v, nthreads)
203-
D <- eigenMapMatMult(as.matrix(K_b), v, nthreads)
202+
bigstatsr <- FALSE
203+
if(bigstatsr == FALSE){
204+
C <- eigenMapMatMult(as.matrix(K_a), v, nthreads)
205+
D <- eigenMapMatMult(as.matrix(K_b), v, nthreads)
206+
} else if(bigstatr == TRUE){
207+
208+
# matrix multiplication via bigstatsr
209+
C_fbm <- FBM(dim(K_a)[1], B)
210+
D_fbm <- FBM(dim(K_b)[1], B)
211+
# C
212+
big_apply(C, a.FUN = function(C_fbm, ind, K_a, v) {
213+
C_fbm[, ind] <- tcrossprod(K_a, v[ind, ])
214+
NULL ## you don't want to return anything here
215+
}, a.combine = 'c', ncores = nthreads, K_a = K_a, v = v)
216+
# D
217+
big_apply(D, a.FUN = function(D_fbm, ind, K_b, v) {
218+
D_fbm[, ind] <- tcrossprod(K_b, v[ind, ])
219+
NULL ## you don't want to return anything here
220+
}, a.combine = 'c', ncores = nthreads, K_b = K_b, v = v)
221+
222+
C <- C_fbm[]
223+
D <- D_fbm[]
224+
225+
}
226+
204227
CC[[x]] <- colSums(C * C)
205228
DD[[x]] <- colSums(D * D)
206229
CD[[x]] <- colSums(C * D)
230+
207231
}
208232
} else if (!is.null(W)) {
209233
# project out fe
@@ -225,8 +249,32 @@ boot_algo2 <- function(preprocessed_object, boot_iter, point_estimate, impose_nu
225249
S_diag_XinvXXRu_S_b <- S_diag_XinvXXRu_S_b - prod_b
226250
K_b <- S_diag_XinvXXRu_S_b - tcrossprod(SXinvXXrX_invXX, SuXb)
227251

228-
C <- eigenMapMatMult(as.matrix(K_a), v, nthreads)
229-
D <- eigenMapMatMult(as.matrix(K_b), v, nthreads)
252+
bigstatsr <- FALSE
253+
if(bigstatsr == FALSE){
254+
255+
C <- eigenMapMatMult(as.matrix(K_a), v, nthreads)
256+
D <- eigenMapMatMult(as.matrix(K_b), v, nthreads)
257+
258+
} else if(bigstatr == TRUE){
259+
260+
# matrix multiplication via bigstatsr
261+
C_fbm <- FBM(dim(K_a)[1], B)
262+
D_fbm <- FBM(dim(K_b)[1], B)
263+
# C
264+
big_apply(C, a.FUN = function(C_fbm, ind, K_a, v) {
265+
C_fbm[, ind] <- tcrossprod(K_a, v[ind, ])
266+
NULL ## you don't want to return anything here
267+
}, a.combine = 'c', ncores = nthreads, K_a = K_a, v = v)
268+
# D
269+
big_apply(D, a.FUN = function(D_fbm, ind, K_b, v) {
270+
D_fbm[, ind] <- tcrossprod(K_b, v[ind, ])
271+
NULL ## you don't want to return anything here
272+
}, a.combine = 'c', ncores = nthreads, K_b = K_b, v = v)
273+
274+
C <- C_fbm[]
275+
D <- D_fbm[]
276+
277+
}
230278
CC[[x]] <- colSums(C * C)
231279
DD[[x]] <- colSums(D * D)
232280
CD[[x]] <- colSums(C * D)

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
# fwildclusterboot
55

66
<!-- badges: start -->
7-
8-
<!-- [![packageversion](https://img.shields.io/badge/Package%20version-x86_64-w64-mingw32, x86_64, mingw32, x86_64, mingw32, , 4, 0.4, 2021, 02, 15, 80002, R, R version 4.0.4 (2021-02-15), Lost Library Book-orange.svg?style=flat-square)](commits/master) -->
7+
<!-- [![packageversion](https://img.shields.io/badge/Package%20version-x86_64-w64-mingw32, x86_64, mingw32, x86_64, mingw32, , 4, 0.5, 2021, 03, 31, 80133, R, R version 4.0.5 (2021-03-31), Shake and Throw-orange.svg?style=flat-square)](commits/master) -->
98

109
[![Lifecycle:
1110
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html)
@@ -43,9 +42,7 @@ subcluster bootstrapping for few treated clusters [(MacKinnon & Webb,
4342
(2018))](https://academic.oup.com/ectj/article-abstract/21/2/114/5078969).
4443

4544
<!-- The following features will be added in the future: -->
46-
4745
<!-- * support for multivariate hypotheses -->
48-
4946
<!-- * bootstrap distributions beyond the rademacher distribution -->
5047

5148
### The `boottest()` function
@@ -73,7 +70,7 @@ summary(feols_boot)
7370
#> Number of Clusters: 40
7471
#>
7572
#> term estimate statistic p.value conf.low conf.high
76-
#> 1 treatment 0.079 4.123 0 0.039 0.118
73+
#> 1 treatment 0.079 4.123 0 0.039 0.119
7774
```
7875

7976
For a longer introduction to the package’s key function, `boottest()`,

docs/404.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/LICENSE.html

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/fwildclusterboot.html

Lines changed: 18 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
-76 Bytes
Loading

docs/articles/index.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)