alteryx / alteryx/AlteryxSim

Sampling using the roulette method yields incorrect samples

Aperta
#14 0 commenti 0 reazioni 1 assegnatario Rivendicata da @piguy314159265 Vedi su GitHub
bug
Lingua principale
R
Stelle
3
Fork
4
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

There are two issues at play here:
1. The roulette bins are being interpreted as right bounds, thereby resulting in negative values when the lowest bin is 0.
2. For large sample size (N), the histogram produced by this method is inconsistent with what is expected.

I traced the problem to [this line](https://github.com/alteryx/AlteryxSim/blob/master/R/sampling-processes.R#L136). Replacing it with this leads to more consistent histograms.

``` r
data <- data.frame(id = idVec, count = floor(valVec/sum(valVec)*count))
```

As discussed, there is some more book-keeping code that needs to be written to ensure that the sample size returned is identical to what is requested by the user.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.