A few simple questions from a novice R user. (I am running R version 0.62.3 Beta (Sept 8, 1998) under Windows NT.) 1) How do I time the execution of a function/program in R for Windows? Is there the equivalent of a dos.time function? 2) Can anyone send me details on the random number generator used by R (period, etc.). Also, why is it different from the SuperDuper RNG in S? 3) Will there be an l1fit function in future releases of R? Thanks in advance. FC. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Francisco Cribari writes: > A few simple questions from a novice R user. (I am running > R version 0.62.3 Beta (Sept 8, 1998) under Windows NT.) > > 1) How do I time the execution of a function/program in R > for Windows? Is there the equivalent of a dos.time function? I'm not sure about this one. One of those doing the Windows port will probably reply. > 2) Can anyone send me details on the random number generator > used by R (period, etc.). Also, why is it different from > the SuperDuper RNG in S? It used to be SuperDuper (some years ago), but was replaced by a version of Wichmann-Hill generator (Applied Statistics Algorithm AS183) which claims a period of > 6.95 * 10^12. By default, a random seed is chosen using the system clock, but you can initialize the generator with a particular seed using an expression like .Random.seed <- c(1000, 2000, 3000) The manual entry obtained with ?Random has more details. (It would be nice to offer users a choice, but what should the choices be?). > 3) Will there be an l1fit function in future releases > of R? As with most R code, this depends on someone taking an interest and providing the code. There are a number of published algorithms for l1 fitting so it is just a matter of grabbing one of these and following the way that "lm" builds the design matrix and does the fitting. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, Nov 04, 1998 at 03:53:03PM +0000, Francisco Cribari wrote:> A few simple questions from a novice R user. (I am running > R version 0.62.3 Beta (Sept 8, 1998) under Windows NT.) > > 1) How do I time the execution of a function/program in R > for Windows? Is there the equivalent of a dos.time function?You can use proc.time() and system.time(...) (look to the help). However, you will get only the elapsed time (the other entries are setted to NA). guido -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Following up on the RNG discussions, I suggest the (GPL'ed) C code for the 'Mersenne Twister'. This RNG has a couple of quite impressibe features, see the quote below. The quote is from a second implementation by Shawn Cokus which adds even more speed. The code is available via the quoted URL. The algorithm was published in one of the ACM journals early this year. // This is the ``Mersenne Twister'' random number generator MT19937, which // generates pseudorandom integers uniformly distributed in 0..(2^32 - 1) // starting from any odd seed in 0..(2^32 - 1). This version is a recode // by Shawn Cokus (Cokus at math.washington.edu) on March 8, 1998 of a version by // Takuji Nishimura (who had suggestions from Topher Cooper and Marc Rieffel in // July-August 1997). [...] // According to the URL <http://www.math.keio.ac.jp/~matumoto/emt.html> // (and paraphrasing a bit in places), the Mersenne Twister is ``designed // with consideration of the flaws of various existing generators,'' has // a period of 2^19937 - 1, gives a sequence that is 623-dimensionally // equidistributed, and ``has passed many stringent tests, including the // die-hard test of G. Marsaglia and the load test of P. Hellekalek and // S. Wegenkittl.'' It is efficient in memory usage (typically using 2506 // to 5012 bytes of static data, depending on data type sizes, and the code // is quite short as well). It generates random numbers in batches of 624 // at a time, so the caching and pipelining of modern systems is exploited. // It is also divide- and mod-free. -- Linux is not only free; it is, arguably, a better operating system, offering a degree of stability and an ability to scale up that NT cannot match. -- The Economist, Oct 3, 1998 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._