Sampling using the roulette method yields incorrect samples
- Vorherrschende Sprache
- R
- Sterne
- 3
- Forks
- 4
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.