Yuliya Matveyeva
2010-Oct-10 15:33 UTC
[R] segfault caused by `icfit` in `interval` package
Dear R community, I am using the R package `interval` in order to perform some modelling tests of the NPMLE convergence in the case of censoring. So all I am doing is drawing a sample from exponential distribution, making it a censored sample and computing the NPMLE of its distribution function. But when run on Linux Calculate 10.4 the program keeps crashing and reporting a segmentation fault after the call to the `icfit` function when the sample size gets to 70. When run on Windows 7 it seems to be fine. That is why I am totally confused and have decided to ask for help. I have attached the code I am running which results in a segmentation fault if run on Linux Calculate. It has the seed set to the value which leads to this error. But it is important to note that if the parameters used in the program and the seed are changed it doesn't necessarily crash. Here is the description of my R version and OS:> sessionInfo()R version 2.10.1 (2009-12-14) i686-pc-linux-gnu locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base After calling `icfit` the program quits with the following output (I have replaced the output concerning the arguments passed to initcomputeMLE by <<<<< arguments passed to initcomputeMLE>>>>> so that the description of the output wouldn't be too long): *** caught segfault *** address 0xc, cause 'memory not mapped' Traceback: 1: .Call("ComputeMLEForR", R, B, max.inner, max.outer, tol) 2: computeMLE(R, B, max.inner = max.inner, max.outer = max.outer, tol tol) 3: initcomputeMLE(<<<<< arguments passed to initcomputeMLE>>>>>) 4: do.call(initfit, args = list(L = L, R = R, Lin = Lin, Rin = Rin, A A)) 5: doTryCatch(return(expr), name, parentenv, handler) 6: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 7: tryCatchList(expr, classes, parentenv, handlers) 8: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") LONG <- 75L msg <- conditionMessage(e) sm <- strsplit(msg, "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste(prefix, "\n ", sep = "") } else prefix <- "Error : " msg <- paste(prefix, conditionMessage(e), "\n", sep = "") .Internal(seterrmessage(msg[1L])) if (!silent && identical(getOption("show.error.messages"), TRUE)) { cat(msg, file = stderr()) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error"))}) 9: try(do.call(initfit, args = list(L = L, R = R, Lin = Lin, Rin = Rin, A = A))) 10: icfit.default(L = left, R = right) 11: icfit(L = left, R = right) Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace I would greatly appreciate any help provided. Sincerely yours, Yuliya Matveyeva.
Please try with the R-2.12.0 ReleaseCandidate and thwe most recent version of the package (please report its version number!). If it still fails, it may be a good idea to contact the package maintainer of interval first. Uwe Ligges On 10.10.2010 17:33, Yuliya Matveyeva wrote:> Dear R community, > I am using the R package `interval` in order to perform some modelling > tests of the > NPMLE convergence in the case of censoring. So all I am doing is drawing a > sample > from exponential distribution, making it a censored sample and computing the > NPMLE of > its distribution function. But when run on Linux Calculate 10.4 the program > keeps > crashing and reporting a segmentation fault > after the call to the `icfit` function when the sample size gets to 70. > When run on Windows 7 it seems to be fine. > That is why I am totally confused and have decided to ask for help. > > I have attached the code I am running which results in a segmentation fault > if run on Linux Calculate. > It has the seed set to the value which leads to this error. But it is > important to note > that if the parameters used in the program and the seed are changed it > doesn't > necessarily crash. > > Here is the description of my R version and OS: > >> sessionInfo() > R version 2.10.1 (2009-12-14) > i686-pc-linux-gnu > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=en_US.UTF-8 LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > After calling `icfit` the program quits with the following output > (I have replaced the output concerning the arguments passed to > initcomputeMLE by > <<<<< arguments passed to initcomputeMLE>>>>> so that the description of the > > output wouldn't be too long): > > *** caught segfault *** > address 0xc, cause 'memory not mapped' > > Traceback: > 1: .Call("ComputeMLEForR", R, B, max.inner, max.outer, tol) > 2: computeMLE(R, B, max.inner = max.inner, max.outer = max.outer, tol > tol) > 3: initcomputeMLE(<<<<< arguments passed to initcomputeMLE>>>>>) > 4: do.call(initfit, args = list(L = L, R = R, Lin = Lin, Rin = Rin, A > A)) > 5: doTryCatch(return(expr), name, parentenv, handler) > 6: tryCatchOne(expr, names, parentenv, handlers[[1L]]) > 7: tryCatchList(expr, classes, parentenv, handlers) > 8: tryCatch(expr, error = function(e) { call<- conditionCall(e) if > (!is.null(call)) { if (identical(call[[1L]], > quote(doTryCatch))) call<- sys.call(-4L) dcall<- > deparse(call)[1L] prefix<- paste("Error in", dcall, ": ") > LONG<- 75L msg<- conditionMessage(e) sm<- strsplit(msg, > "\n")[[1L]] w<- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type > = "w") if (is.na(w)) w<- 14L + nchar(dcall, type = "b") > + nchar(sm[1L], type = "b") if (w> LONG) > prefix<- paste(prefix, "\n ", sep = "") } else prefix<- "Error : > " msg<- paste(prefix, conditionMessage(e), "\n", sep = "") > .Internal(seterrmessage(msg[1L])) if (!silent&& > identical(getOption("show.error.messages"), TRUE)) { cat(msg, > file = stderr()) .Internal(printDeferredWarnings()) } > invisible(structure(msg, class = "try-error"))}) > 9: try(do.call(initfit, args = list(L = L, R = R, Lin = Lin, Rin = Rin, > A = A))) > 10: icfit.default(L = left, R = right) > 11: icfit(L = left, R = right) > > Possible actions: > 1: abort (with core dump, if enabled) > 2: normal R exit > 3: exit R without saving workspace > 4: exit R saving workspace > > I would greatly appreciate any help provided. > Sincerely yours, > Yuliya Matveyeva. > > > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.