Displaying 20 results from an estimated 2000 matches similar to: "Bias in R's random integers?"
2018 Sep 19
0
Bias in R's random integers?
On 19/09/2018 12:23 PM, Philip B. Stark wrote:
> No, the 2nd call only happens when m > 2**31. Here's the code:
Yes, you're right. Sorry!
So the ratio really does come close to 2. However, the difference in
probabilities between outcomes is still at most 2^-32 when m is less
than that cutoff. That's not feasible to detect; the only detectable
difference would happen if
2018 Sep 19
0
Bias in R's random integers?
On 19/09/2018 3:52 PM, Philip B. Stark wrote:
> Hi Duncan--
>
> Nice simulation!
>
> The absolute difference in probabilities is small, but the maximum
> relative difference grows from something negligible to almost 2 as m
> approaches 2**31.
>
> Because the L_1 distance between the uniform distribution on {1, ..., m}
> and what you actually get is large, there
2013 Apr 25
2
How are R version types named ? Any convention (like Hurricanes etc)
With reference to R News
News:
R version 3.0.0 (Masked Marvel) has been released on 2013-04-03.
R version 2.15.3 (Security Blanket) has been released on 2013-03-01
R version 2.15.2 (Trick or Treat) ....
R version 2.15.1 ("Roasted Marshmallows") ...
R version 2.15.0 ("Easter Beagle")
R version 2.14.0 ("Great Pumpkin")
Dear R help List,
How are these version types
2018 Sep 19
0
Bias in R's random integers?
For a well-tested C algorithm, based on my reading of Lemire, the unbiased
"algorithm 3" in https://arxiv.org/abs/1805.10941 is part already of the C
standard library in OpenBSD and macOS (as arc4random_uniform), and in the
GNU standard library. Lemire also provides C++ code in the appendix of his
piece for both this and the faster "nearly divisionless" algorithm.
It would be
2018 Sep 19
0
Bias in R's random integers?
On 19/09/2018 5:57 PM, David Hugh-Jones wrote:
>
> It doesn't seem too hard to come up with plausible ways in which this
> could give bad results. Suppose I sample rows from a large dataset,
> maybe for bootstrapping. Suppose the rows are non-randomly ordered, e.g.
> odd rows are males, even rows are females. Oops! Very non-representative
> sample, bootstrap p values are
2018 Sep 19
2
Bias in R's random integers?
A quick point of order here: arguing with Duncan in this forum is
helpful to expose ideas, but probably neither side will convince the
other; eventually, if you want this adopted in core R, you'll need to
convince an R-core member to pursue this fix.
In the meantime, a good, well-tested implementation in a
user-contributed package (presumably written in C for speed) would be
enormously
2018 Sep 19
4
Bias in R's random integers?
Hi Duncan--
Nice simulation!
The absolute difference in probabilities is small, but the maximum relative
difference grows from something negligible to almost 2 as m approaches
2**31.
Because the L_1 distance between the uniform distribution on {1, ..., m}
and what you actually get is large, there have to be test functions whose
expectations are quite different under the two distributions.
2018 Sep 19
2
Bias in R's random integers?
It doesn't seem too hard to come up with plausible ways in which this could
give bad results. Suppose I sample rows from a large dataset, maybe for
bootstrapping. Suppose the rows are non-randomly ordered, e.g. odd rows are
males, even rows are females. Oops! Very non-representative sample,
bootstrap p values are garbage.
David
On Wed, 19 Sep 2018 at 21:20, Duncan Murdoch <murdoch.duncan
2018 Sep 19
2
Bias in R's random integers?
No, the 2nd call only happens when m > 2**31. Here's the code:
(RNG.c, lines 793ff)
double R_unif_index(double dn)
{
double cut = INT_MAX;
switch(RNG_kind) {
case KNUTH_TAOCP:
case USER_UNIF:
case KNUTH_TAOCP2:
cut = 33554431.0; /* 2^25 - 1 */
break;
default:
break;
}
double u = dn > cut ? ru() : unif_rand();
return floor(dn * u);
}
On Wed, Sep
2012 Sep 11
3
R crashes when printing a named numeric vector of a specific class - Bug?
Dear useR's,
today I stumbled over an interesting phenomenon: First, I created a
named numeric vector with a certain class and several attributes via the
structure() function. After that, I implemented a simple print method
for this class. When calling this function it produces an endless loop
of print calls until R crashes. :/
What is going on here? Is this a bug or have I done something
2012 Oct 16
2
Windows 7 R (32/64bit) running under cygwin: package not found
Hi,
Using R 2.15.1 on Windows 7. Have installed both versions 32 and 64bit.
In both of them among others I have installed a package rgenoud
When I open R gui of 32bit and write library(rgenoud) it responds by
showing a functional rgenoud version 5.7-8. The same it does on Rgui
64bit.
Now I am working in cygwin (v. 1.12.4.0) with xwin. Normally before when
I had installed a package, I only had
2012 Sep 18
2
problem with vignettes when S4 classes in packages overlap
( A similar problem is also reported by Sebastian P. Luque with
library(maptools)
library(trip)
in the vignette as below ).
I am writing a vignette which loads RMySQL and RPostgreSQL. This
produces the warning:
Loading required package: DBI
Warning in .simpleDuplicateClass(def, prev) :
A specification for class ?dbObjectId? in package ?RPostgreSQL? seems
equivalent to one from package
2013 Feb 04
2
gettext weirdness
Hi,
I am trying to use the gettext() function to translate some text. I have
never used this function before, so, it's entirely possible that I am
doing something wrong. The issue that I am encountering is that
gettext() properly translates some text, but not some other.
Natural language was compiled in my R (installed from the Debian
repositories):
$ R
R version 2.15.1 (2012-06-22) --
2013 Feb 04
2
gettext weirdness
Hi,
I am trying to use the gettext() function to translate some text. I have
never used this function before, so, it's entirely possible that I am
doing something wrong. The issue that I am encountering is that
gettext() properly translates some text, but not some other.
Natural language was compiled in my R (installed from the Debian
repositories):
$ R
R version 2.15.1 (2012-06-22) --
2012 Aug 21
1
make check fails two tests on RHEL 6 build
I am installing R 2.15.1 onto RHEL 6, using gcc 4.7.0 with Intel MKL
10.3.7 and the following environment:
export BLAS_LIBS="-Wl,--start-group
/usr/caen/intel-12.1/mkl/lib/intel64/libmkl_gf_lp64.a
/usr/caen/intel-12.1/mkl/lib/intel64/libmkl_sequential.a
/usr/caen/intel-12.1/mkl/lib/intel64/libmkl_core.a -Wl,--end-group
-lpthread"
export LAPACK_LIBS="-Wl,--start-group
2012 Dec 31
3
weird bug with parallel, RSQlite and tcltk
Hello,
I spent a lot of a time on a weird bug, and I just managed to narrow it down.
In parallel code (here with parallel::mclappy, but I got it
doMC/multicore too), if the library(tcltk) is loaded, R hangs when
trying to open a DB connection.
I got the same behaviour on two different computers, one dual-core,
and one 2 xeon quad-core.
Here's the code:
library(parallel)
library(RSQLite)
2012 Nov 21
2
installing Rmpi on centos 6 with mpich
Hello everyone
im trying to install Rmpi library on centos 6. I have already installed
mpich2 1.4
[root@localhost ~]# R --version
> R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
> Copyright (C) 2012 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
> Platform: x86_64-redhat-linux-gnu (64-bit)
[root@localhost ~]# mpich2version
> MPICH2 Version:
2012 Jul 29
1
[BUG?] utils::prompt(name=f)
> ?prompt
[SNIP]
## Create a help file for each function in the .GlobalEnv:
for(f in ls()) if(is.function(get(f))) prompt(name = f)
> foo <- function(x) { cat(x, '\n')}
> prompt(name="foo")
Error in utils:::prompt(object, filename = filename, name = name, ...) :
argument "object" is missing, with no default
> version
platform
2012 Aug 18
1
texi2dvi error "Sweave" and "exams"
I have installed Sweave as recommended. http://lifeasclay.wordpress.com/tag/sweave/. Placing a test.Rnw file, for instance, in "/Library/Frameworks/R.framework/Versions/2.15/Resources/library/utils/Sweave" generates test.tex files that generate pdf files with LaTeX. To be honest, placing Rnw files seem to make sense. The "exams" package does require not this step. It uses
2013 Apr 18
1
Memory usage reported by gc() differs from 'top'
In help(gc) I read, "...the primary purpose of calling 'gc' is for the
report on memory usage".
What memory usage does gc() report? And more importantly, which memory
uses does it NOT report? Because I see one answer from gc():
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 14875922 794.5 21754962 1161.9 17854776 953.6
Vcells 59905567 457.1 84428913 644.2