[R] Run times for tree(): R versus S-Plus
Potter, David M
david_m_potter at groton.pfizer.com
Mon Nov 22 16:25:21 CET 1999
Hello --
I have a noticed an appreciable difference in run times
between tree() in R and tree() in S-Plus. In the example
below, with 300 binary predictors, a single binary response
(which I am treating as a factor), and 300 observations, R
takes 29 seconds while S-Plus takes about 2 seconds.
For 1000 binary predictors and 1000 observations (results
not shown), R takes about 15 minutes while S-Plus takes
about 28 seconds.
Modifying the amount of heap memory requested by R at
startup affects the run times somewhat, but the difference
between R and S-Plus persists.
Has anybody else observed this? If so, is the difference
due to differences between the two tree() functions, or
perhaps differences in the way each program handles memory?
(I recognize that these functions, though they have the same
name, are different. I am just hoping to understand the
features of each that may explain the time difference.)
What follows is version information for R and S-Plus, as
well as example code for the 300 by 300 case. Any feedback
would be greatly appreciated.
David Potter
Mathematical & Statistical Sciences
Pfizer Central Research
======================================================================
R Information and Example Code:
Version: 0.65.1 Release (October 07, 1999)
Platform: Sun SPARC (2 GB Memory)
Start R with: R --vsize 20M --nsize 1000k
nobs _ 300
nvar _ 301
dat _ data.frame(matrix(rbinom(nobs*nvar,1,.5),nrow=nobs,ncol=nvar))
library(tree)
unix.time(fit.tree _ tree(as.factor(X301)~ ., data =
dat,mincut=10,minsize=20))
gives
> [1] 27.88 0.20 29.00 0.00 0.00
======================================================================
S-Plus Information:
Version: 3.4 Release 1
Platform: Sun SPARC (2 GB Memory)
nobs _ 300
nvar _ 301
dat _ data.frame(matrix(rbinom(nobs*nvar,1,.5),nrow=nobs,ncol=nvar))
unix.time(fit.tree _ tree(as.factor(X301)~ ., data =
dat,mincut=10,minsize=20))
gives:
> [1] 1.91 0.11 2.00 0.00 0.00
======================================================================
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list