Skip to content

'prob' argument for dqrng::dqsample #45

@s3alfisc

Description

@s3alfisc

Hi - first of all, thanks for a great package - it speeds up my code quite a bit!

Do you have any plans to support the prob argument in dqrng::dqsample? It would be super beneficial in my use case -
I would like to generate so called 'Mammen weights' for a wild bootstrap, which require such an argument. Right now, I use dqsample for some weights distributions, but have to switch back to sample() for Mammen weights. This in turn causes some trouble with setting a 'global seed' - for Mammen weights, the user of my package would have to set it via set.seed() outside of the bootstrap, and for all other weights use dqrng::dqset.seed() (but of course that is not your problem to solve!)

library(dqrng)

dqrng::dqset.seed(89899807)

n <- 10
mammen_dqrng <- 
  dqrng::dqsample(c(-1, 1) * (sqrt(5) + c(-1, 1))/2, n, replace = TRUE,
                            prob = (sqrt(5) + c(1, -1))/(2 * sqrt(5)))
# Warning message:
#   In dqsample.int(length(x), size, replace, prob) :
#   Using 'prob' is not supported yet. Using default 'sample.int'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions