Skip to content
Prev 56436 / 63424 Next

bug: sample( x, size, replace = TRUE, prob= skewed.probs) produces uniform sample

When  `length( skewed.probs ) > 200' uniform samples are generated in R-devel.

R-3.5.1 behaves as expected.

`epsilon` can be a lot bigger than illustrated and still the uniform distribution is produced.


Chuck
+   s200=table(cut(tab200, brks)),
+   p200=round(xtabs(p200 ~ cut( seq_along(p200), brks)) * 10000 ,1),
+   s201=table(cut(tab201, brks )),
+   p201=round(xtabs(p201 ~ cut( seq_along(p201), brks)) * 10000 ,1))
          s200 p200 s201   p201
(0,99]    5017 4950  984 4925.4
(99,199]  4925 5000  959 4975.1
(199,200]   58   50    9   49.8
(200,201]    0    0    6   49.8
(201,Inf]    0    0 8042    0.0
R Under development (unstable) (2019-03-02 r76189)
Platform: x86_64-apple-darwin18.2.0 (64-bit)
Running under: macOS Mojave 10.14.3

Matrix products: default
BLAS: /Users/cberry/projects/R/R-devel/lib/libRblas.dylib
LAPACK: /Users/cberry/projects/R/R-devel/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.6.0