search for: do_sampl

Displaying 13 results from an estimated 13 matches for "do_sampl".

Did you mean: do_sample
2006 Jan 21
1
A patch for do_sample: check replace arg
.... The following patch provides an implementation. + seth Diff is against svn Revision: 37141 --- a/src/main/random.c Sat Jan 21 10:54:11 2006 -0800 +++ b/src/main/random.c Sat Jan 21 11:17:20 2006 -0800 @@ -453,15 +453,18 @@ /* with/without replacement according to r. */ SEXP attribute_hidden do_sample(SEXP call, SEXP op, SEXP args, SEXP rho) { - SEXP x, y, prob; + SEXP x, y, prob, sreplace; int k, n, replace; double *p; checkArity(op, args); n = asInteger(CAR(args)); args = CDR(args); k = asInteger(CAR(args)); args = CDR(args); - replace = asLogical(CAR(args...
2010 Aug 16
2
Random Number Generators and Sample
I am trying to get documentation about the random number generator used in "sample". The help for sample does not mention it. Can anyone point me in the right direction. Thanks [[alternative HTML version deleted]]
2005 Apr 12
3
where is internal function of sample()?
Hi there, I am trying to write a c++ shared library for R. I need a function which has the same functionality as sample() in R, i.e., does permutation, sample with/without replacement. Does R have internal sample routine so that I can call it directly? I did not find it in R.h, Rinternal.h. Thanks
2018 Sep 20
2
A different error in sample()
FWIW, I suspect this is related to the function R_unif_index that was introduced in src/main/RNG.c around revision 72356, or the way this function is used in do_sample in src/main/random.c. 20.9.18 08:19, Wolfgang Huber scripsit: > Besides wording of the documentation re truncating vs rounding, there is > something peculiar going on with the fractional part of n: > > > table(sample.int(2.5, 1e6, replace = TRUE)) > > ???? 1????? 2?????...
2017 Oct 17
4
uniform sampling without replacement algorithm
Let us consider the current uniform sampling without replacement algorithm. It resides in function do_sample in https://svn.r-project.org/R/trunk/src/main/random.c Its complexity is obviously O(n), where the sample is selected from 1...n, since the algorithm has to create a vector of length n. So when the sample size is much lesser than n, the algorithm is not effective. Algorithms with average comple...
2017 Oct 18
0
uniform sampling without replacement algorithm
...l sample() that we don't care about the order. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Oct 17, 2017 at 10:55 AM, Pavel S. Ruzankin <ruzankin at math.nsc.ru> wrote: > Let us consider the current uniform sampling without replacement > algorithm. It resides in function do_sample in > https://svn.r-project.org/R/trunk/src/main/random.c > Its complexity is obviously O(n), where the sample is selected from 1...n, > since the algorithm has to create a vector of length n. So when the sample > size is much lesser than n, the algorithm is not effective. Algorithms wi...
2018 Sep 20
0
A different error in sample()
>>>>> Wolfgang Huber >>>>> on Thu, 20 Sep 2018 08:47:47 +0200 writes: > FWIW, I suspect this is related to the function > R_unif_index that was introduced in src/main/RNG.c around > revision 72356, or the way this function is used in > do_sample in src/main/random.c. Yes, it is just the use of 'dn' instead of 'n' - a one letter thinko I'd say. But *no*, it's much older than revision 72356; e.g., it's already in R version 3.0.0 (2013-04-03) -- "Masked Marvel" but not yet in R version 2.15....
2012 Mar 05
2
source for function sample() in package base?
Hi all, were can i find the sources for the function sample() (the one from the base package) thanks in advance, -- View this message in context: http://r.789695.n4.nabble.com/source-for-function-sample-in-package-base-tp4447796p4447796.html Sent from the R help mailing list archive at Nabble.com.
2018 Sep 20
3
A different error in sample()
Good day, The use of "rounding" also doesn't make sense. If The number is halfway between two integers, it is rounded to the nearest even integer. > round(2.5) [1] 2 -------------------------------------- Dario Strbenac University of Sydney Camperdown NSW 2050 Australia
2017 Oct 18
1
uniform sampling without replacement algorithm
> From: "Pavel S. Ruzankin" <ruzankin at math.nsc.ru> > Let us consider the current uniform sampling without replacement > algorithm. It resides in function do_sample in > https://svn.r-project.org/R/trunk/src/main/random.c > Its complexity is obviously O(n), where the sample is selected from > 1...n, since the algorithm has to create a vector of length n. So when > the sample size is much lesser than n, the algorithm is not effective. Recent R...
1997 Jul 09
1
R-beta: Problem with `rpois'
There is a problem with `rpois'. It does seem to take care about the order of the arguments. This is an example: > rpois(n=1,lambda=2) [1] 3 > rpois(lambda=2,n=1) [1] 2 0 It obviously uses the first argument as the number of samples to be drawn, which is wrong. I used Version 0.49 Beta (April 23, 1997). Fredrik
1997 Jul 09
1
R-beta: Problem with `rpois'
There is a problem with `rpois'. It does seem to take care about the order of the arguments. This is an example: > rpois(n=1,lambda=2) [1] 3 > rpois(lambda=2,n=1) [1] 2 0 It obviously uses the first argument as the number of samples to be drawn, which is wrong. I used Version 0.49 Beta (April 23, 1997). Fredrik
2018 Sep 19
3
A different error in sample()
Although it seems to be pretty weird to enter a numeric vector of length one that is not an integer as the first argument to sample(), the results do not seem to match what is documented in the manual. In addition, the results below do not support the use of round rather than truncate in the documentation. Consider the code below. The first sentence in the details section says: "If x has