[R] loess crash

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Sep 16 15:07:36 CEST 2002


John Deke <jdeke2 at comcast.net> writes:

> Here's a simple example that yields the crash:
> 
> library(modreg)
> data1 <- array(runif(500*5),c(500,5))
> colnames(data1) <- c("x1","x2","x3","x4","x5")
> y <-
> 3+2*data1[,"x1"]+15*data1[,"x2"]+13*data1[,"x3"]-8*data1[,"x4"]+14*data1[,"x5"]+rnorm(500)
> data2 <- cbind(y,data1)
> data2 <- as.data.frame(data2)
> result1 <- loess(y~x1+x2+x3+x4,data2)
> 
> To get the crash, I just add x5--
> 
> result1 <- loess(y~x1+x2+x3+x4+x5,data2)
> 
> And bammo -- I'm dead. It doesn't even pause -- Rgui crashes, and I
> mean really crashes -- the program is terminated, I get the little
> Windows dialogue saying that a log file is being generated -- the
> whole dramatic death scene.
> 
> I know its a computationally intensive thing, but the one that doesn't
> crash (with four explanatory variables) runs almost instantly. Its
> hard to see how adding a fifth could be so catastrophic. But I am
> somewhat new to this particular methodology....

Ok, this is easily reproducible on Linux and with the debugger. It
looks pretty squarely like a memory overrun condition, specifically at
(in /src/library/modreg/src/loessf.f)

380           call dsvdc(u,15,k,k,sigma,g,u,15,e,15,work,21,info)

which is getting called with k=21, where the 15 is supposed to be the
leading dimension of u, and (k,k) are the actual dimensions. So dsvdc
starts writing into places where it shouldn't and things basically go
downhill from there, ending with a null pointer reference and a
corrupted stack.

So basically, you're not meant to do that... R could do with a safety
check there, though.


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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