s3alfisc / fwildclusterboot

Fast Wild Cluster Bootstrap Inference for Regression Models / OLS in R. Additionally, R port to WildBootTests.jl via the JuliaConnectoR.
https://s3alfisc.github.io/fwildclusterboot/
GNU General Public License v3.0
22 stars 4 forks source link

Use dqrng::dqrrademacher #134

Open s3alfisc opened 11 months ago

s3alfisc commented 11 months ago
rstub commented 2 months ago

Anyway I could help with this change?

BTW, I know you have been waiting a long time for weighted sampling in dqrng. For the time being, you could just throw an unfair coin:

                            mammen = function(n) {
                              ifelse(
                                dqrng::dqrunif(n) < (sqrt(5) + 1) / (2 * sqrt(5)),
                                (1 - sqrt(5)) / 2, 
                                (1 + sqrt(5)) / 2 
                              )
                            },

This is slower than you current implementation with sample(), but it would be controlled by the same state / seed as the other "dqrng" weights.

s3alfisc commented 2 months ago

Hi @rstub - this is already implemented =) I am only waiting for me to address a few changes for an ropensci review yet.

Changing the Mammen weights as in your suggestions sounds like a great plan. I'd be happy to accept a PR but can also just implement it myself =) I definitely agree that seed state uniformity definitely beats performance in this case!

Best, Alex

rstub commented 2 months ago

OK, I got confused by the two closed PRs. Great if things are working already. I think it is easier if you do the changes for the Mammen weights on your end. I might contribute a (faster) C++ version once the upcoming {dqrng} release is on CRAN.