Random problems with R

09/18/2018
by   Kellie Ottoboni, et al.
0

R (Version 3.5.1 patched) has an issue with its random sampling functionality. R generates random integers between 1 and m by multiplying random floats by m, taking the floor, and adding 1 to the result. Well-known quantization effects in this approach result in a non-uniform distribution on { 1, …, m}. The difference, which depends on m, can be substantial. Because the sample function in R relies on generating random integers, random sampling in R is biased. There is an easy fix: construct random integers directly from random bits, rather than multiplying a random float by m. That is the strategy taken in Python's numpy.random.randint() function, among others. Example source code in Python is available at https://github.com/statlab/cryptorandom/blob/master/cryptorandom/cryptorandom.py (see functions getrandbits() and randbelow_from_randbits()).

READ FULL TEXT

page 1

page 2

page 3

page 4

research
07/10/2023

Badgers: generating data quality deficits with Python

Generating context specific data quality deficits is necessary to experi...
research
05/18/2022

Torchhd: An Open-Source Python Library to Support Hyperdimensional Computing Research

Hyperdimensional Computing (HDC) is a neuro-inspired computing framework...
research
05/25/2021

LENs: a Python library for Logic Explained Networks

LENs is a Python module integrating a variety of state-of-the-art approa...
research
12/23/2022

NARS vs. Reinforcement learning: ONA vs. Q-Learning

One of the realistic scenarios is taking a sequence of optimal actions t...
research
06/16/2021

Automating Augmentation Through Random Unidimensional Search

It is no secret amongst deep learning researchers that finding the right...
research
06/30/2023

Comparative study of subset selection methods for rapid prototyping of 3D object detection algorithms

Object detection in 3D is a crucial aspect in the context of autonomous ...
research
10/02/2019

ROS Rescue : Fault Tolerance System for Robot Operating System

In this chapter we discuss the problem of master failure in ROS1.0 and i...

Please sign up or login with your details

Forgot password? Click here to reset