Hi, This is most likely only a minor technicality, but I saw the following: On page 6 of the 'parallel' vignette (http://stat.ethz.ch/R-manual/R-devel/library/parallel/doc/parallel.pdf), the random-number generator "L'Ecuyer-CMRG" is said to have seed "(x_n, x_{n-1}, x_{n-2}, y_n, y_{n-1}, y_{n-2})". However, in L'Ecuyer et al. (2002), the seed is given with 'increasing' indices, so should rather be "(x_{n-2}, x_{n-1}, x_n, y_{n-2}, y_{n-1}, y_n)" (or, even more intuitively, "(x_{n-3}, x_{n-2}, x_{n-1}, y_{n-3}, y_{n-2}, y_{n-1})"). The question is how it's done in R (?): If as given in the vignette, one should maybe point this out as other (languages) following L'Ecuyer et al. (2002) might obtain different random numbers then. And if it's implemented as in L'Ecuyer, then one probably wants to adjust the vignette to reflect this. Other minor suggestions to improve the vignette (if that's what's also done in R; I couldn't easily figure that out from ./src/main/RNG.c): 1) when defining u_n, I would write u_n = z_n / (2^32-208) [as it is immediately clear then that one divides by the modulus of the first linear congruential generator + 1] 2) The case z_n=0 is not provided (for a reason?). If z_n=0, L'Ecuyer suggests to set u_n to "(2^32-209)/(2^32-208)". Cheers, Marius -- Marius Hofert, Dr. rer. nat. Assistant Professor Department of Statistics and Actuarial Science Faculty of Mathematics University of Waterloo 200 University Avenue West, Waterloo, ON, N2L 3G1 +1-519-888-4567, ext. 31394 (office M3 4207) http://math.uwaterloo.ca/~mhofert
On Tue, Feb 3, 2015 at 10:39 AM, Marius Hofert <marius.hofert at uwaterloo.ca> wrote:> Hi, > > This is most likely only a minor technicality, but I saw the > following: On page 6 of the 'parallel' vignette > (http://stat.ethz.ch/R-manual/R-devel/library/parallel/doc/parallel.pdf), > the random-number generator "L'Ecuyer-CMRG" is said to have seed > "(x_n, x_{n-1}, x_{n-2}, y_n, y_{n-1}, y_{n-2})". However, in L'Ecuyer > et al. (2002), the seed is given with 'increasing' indices, so should > rather be "(x_{n-2}, x_{n-1}, x_n, y_{n-2}, y_{n-1}, y_n)" (or, even > more intuitively, "(x_{n-3}, x_{n-2}, x_{n-1}, y_{n-3}, y_{n-2}, > y_{n-1})"). The question is how it's done in R (?):... in the meanwhile, I found out that this is indeed a typo in the vignette. I suggest to change it to "(x_{n-3}, x_{n-2}, x_{n-1}, y_{n-3}, y_{n-2}, y_{n-1})" on page 6 in the version of October 31, 2014.> If as given in the > vignette, one should maybe point this out as other (languages) > following L'Ecuyer et al. (2002) might obtain different random numbers > then. And if it's implemented as in L'Ecuyer, then one probably wants > to adjust the vignette to reflect this. > > Other minor suggestions to improve the vignette (if that's what's also > done in R; I couldn't easily figure that out from ./src/main/RNG.c): > 1) when defining u_n, I would write u_n = z_n / (2^32-208) [as it is > immediately clear then that one divides by the modulus of the first > linear congruential generator + 1] > 2) The case z_n=0 is not provided (for a reason?). If z_n=0, L'Ecuyer > suggests to set u_n to "(2^32-209)/(2^32-208)". > > Cheers, > Marius > > > > > -- > Marius Hofert, Dr. rer. nat. > Assistant Professor > Department of Statistics and Actuarial Science > Faculty of Mathematics > University of Waterloo > 200 University Avenue West, Waterloo, ON, N2L 3G1 > +1-519-888-4567, ext. 31394 (office M3 4207) > http://math.uwaterloo.ca/~mhofert-- Marius Hofert, Dr. rer. nat. Assistant Professor Department of Statistics and Actuarial Science Faculty of Mathematics University of Waterloo 200 University Avenue West, Waterloo, ON, N2L 3G1 +1-519-888-4567, ext. 31394 (office M3 4207) http://math.uwaterloo.ca/~mhofert
>>>>> Marius Hofert <marius.hofert at uwaterloo.ca> >>>>> on Sun, 8 Mar 2015 11:19:45 -0400 writes:> On Tue, Feb 3, 2015 at 10:39 AM, Marius Hofert > <marius.hofert at uwaterloo.ca> wrote: >> Hi, >> >> This is most likely only a minor technicality, but I saw the >> following: On page 6 of the 'parallel' vignette >> (http://stat.ethz.ch/R-manual/R-devel/library/parallel/doc/parallel.pdf), >> the random-number generator "L'Ecuyer-CMRG" is said to have seed >> "(x_n, x_{n-1}, x_{n-2}, y_n, y_{n-1}, y_{n-2})". However, in L'Ecuyer >> et al. (2002), the seed is given with 'increasing' indices, so should >> rather be "(x_{n-2}, x_{n-1}, x_n, y_{n-2}, y_{n-1}, y_n)" (or, even >> more intuitively, "(x_{n-3}, x_{n-2}, x_{n-1}, y_{n-3}, y_{n-2}, >> y_{n-1})"). The question is how it's done in R (?): > ... in the meanwhile, I found out that this is indeed a typo in the > vignette. I suggest to change it to "(x_{n-3}, x_{n-2}, x_{n-1}, > y_{n-3}, y_{n-2}, y_{n-1})" on page 6 in the version of October 31, 2014. Thank you, Marius. I've committed this change now. With regards: Martin >> If as given in the >> vignette, one should maybe point this out as other (languages) >> following L'Ecuyer et al. (2002) might obtain different random numbers >> then. And if it's implemented as in L'Ecuyer, then one probably wants >> to adjust the vignette to reflect this. >> >> Other minor suggestions to improve the vignette (if that's what's also >> done in R; I couldn't easily figure that out from ./src/main/RNG.c): >> 1) when defining u_n, I would write u_n = z_n / (2^32-208) [as it is >> immediately clear then that one divides by the modulus of the first >> linear congruential generator + 1] >> 2) The case z_n=0 is not provided (for a reason?). If z_n=0, L'Ecuyer >> suggests to set u_n to "(2^32-209)/(2^32-208)". >> >> Cheers, >> Marius >> >> >> >> >> -- >> Marius Hofert, Dr. rer. nat. >> Assistant Professor >> Department of Statistics and Actuarial Science >> Faculty of Mathematics >> University of Waterloo >> 200 University Avenue West, Waterloo, ON, N2L 3G1 >> +1-519-888-4567, ext. 31394 (office M3 4207) >> http://math.uwaterloo.ca/~mhofert > -- > Marius Hofert, Dr. rer. nat. > Assistant Professor > Department of Statistics and Actuarial Science > Faculty of Mathematics > University of Waterloo > 200 University Avenue West, Waterloo, ON, N2L 3G1 > +1-519-888-4567, ext. 31394 (office M3 4207) > http://math.uwaterloo.ca/~mhofert > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel