[R] R crashes when loading rgl package before minqa package

Gaspard Lequeux Gaspard.Lequeux at biomath.ugent.be
Thu Sep 30 17:44:49 CEST 2010


Hej,

On Thu, 30 Sep 2010, Ravi Varadhan wrote:

> You data is not good enough for the model that you are trying to fit (or 
> conversely, the model is not appropriate for the data).

Yes. I agree. However, this should not cause R to crash. (Around 100.000 
models are fitted, and it is not possible to look at the data by hand 
first. Bogus results are filtered out afterwards.)

/Gaspard



> Some of the parameters in your model will not be estimable because there is no information in the data.
>
> See the following:
>
> xvals = c(1,2,4,5,7,8,9,10,11,12,14,15,16,18,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36)
>
> yvals = c(857.7597,975.8624,978.2655,979.3034,965.5919,983.8946,992.2512,992.1178,979.5379,974.4269,968.4113,991.5210,977.3361,985.7800,975.5220,974.6880,973.8102,980.7295,982.0034,984.7993,978.4948,970.4351,969.0718,983.7892,976.3637,980.7833,987.1665,976.6000,975.1332,971.0757,989.4693)
>
> initpar = c(-5.1471384, -3861.8905839, 979.2616002, 0.2572355, 27.5705764)
>
> fn <- function(x) {
> yft = x[2] + (x[3] - x[2])/((1 + exp(x[1] * (log(xvals) - log(x[4]))))^x[5])
> return(yft)
> }
>
> plot(xvals, yvals, type="p")
> lines(xvals, fn(initpar))
>
> Hope this helps,
> Ravi.
>
> ____________________________________________________________________
>
> Ravi Varadhan, Ph.D.
> Assistant Professor,
> Division of Geriatric Medicine and Gerontology
> School of Medicine
> Johns Hopkins University
>
> Ph. (410) 502-2619
> email: rvaradhan at jhmi.edu
>
>
> ----- Original Message -----
> From: Ravi Varadhan <rvaradhan at jhmi.edu>
> Date: Thursday, September 30, 2010 10:15 am
> Subject: Re: [R] R crashes when loading rgl package before minqa package
> To: Gaspard Lequeux <Gaspard.Lequeux at biomath.ugent.be>
> Cc: r-help at r-project.org
>
>
>> I get this on Windows (it does not crash):
>>
>> > library(minqa)
>> > library(rgl)
>> > newuoa(initpar, optimft)
>>  Error in newuoa(initpar, optimft) :
>>    non-finite x values not allowed in calfun
>>  In addition: Warning message:
>>  In log(x[4]) : NaNs produced
>> >
>>
>>  This tells me that you should be constraining your parameter x[4]
>> (may be even x[5]) to be non-negative:
>>
>>  Here is what I get with `bobyqa':
>>
>> > bobyqa(initpar, optimft, lower=c(-Inf, -Inf, -Inf, 0, 0))
>>  parameter estimates: -5.311767080681, -3861.89005072333,
>> 979.239647766226, 0.268156271922112, 27.6418856936228
>>  objective: 1457.20987728737
>>  number of function evaluations: 78
>> >
>>
>>
>>  Ravi.
>>
>>  ____________________________________________________________________
>>
>>  Ravi Varadhan, Ph.D.
>>  Assistant Professor,
>>  Division of Geriatric Medicine and Gerontology
>>  School of Medicine
>>  Johns Hopkins University
>>
>>  Ph. (410) 502-2619
>>  email: rvaradhan at jhmi.edu
>>
>>
>>  ----- Original Message -----
>>  From: Gaspard Lequeux <Gaspard.Lequeux at biomath.ugent.be>
>>  Date: Wednesday, September 29, 2010 11:40 am
>>  Subject: [R] R crashes when loading rgl package before minqa package
>>  To: r-help at r-project.org
>>
>>
>> >  Hej,
>> >
>> >  Calling newuoa (from the minqa package) makes R crash when the
>> > package rgl is loaded first. This however only on certain selected
>> data.
>> >
>> >  The data used for testing (saved to 'bugs.R'):
>> >
>> >
>> >  xvals = c(1,2,4,5,7,8,9,10,11,12,14,15,16,18,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36)
>> >
>> >  yvals = c(857.7597,975.8624,978.2655,979.3034,965.5919,983.8946,992.2512,992.1178,979.5379,974.4269,968.4113,991.5210,977.3361,985.7800,975.5220,974.6880,973.8102,980.7295,982.0034,984.7993,978.4948,970.4351,969.0718,983.7892,976.3637,980.7833,987.1665,976.6000,975.1332,971.0757,989.4693)
>> >
>> >  initpar = c(-5.1471384, -3861.8905839, 979.2616002, 0.2572355, 27.5705764)
>> >
>> >  optimft <- function(x) {
>> >    yft = x[2] + (x[3] - x[2])/((1 + exp(x[1] * (log(xvals) - log(x[4]))))^x[5])
>> >    return(sum((yvals - yft)^2))
>> >  }
>> >
>> >
>> >  Sequence of commands needed to make the bug appear:
>> >
>> >  <Start R>
>> >  source('bugs.R')
>> >  library(minqa)
>> >  library(rgl)
>> >  newuoa(initpar, optimft)
>> >   => OK
>> >
>> >  <Start R>
>> >  source('bugs.R')
>> >  library(rgl)
>> >  library(minqa)
>> >  newuoa(initpar, optimft)
>> >    => Crash: segfault: address 0x18, cause 'memory not mapped'
>> >
>> >  I found the bug using the package qpcR, where rgl is loaded when
>> > loading qpcR while minqa is only loaded later, when needed.
>> >
>> >
>> >  Running on Debian squeeze 64 bit.
>> >  R version: R version 2.11.1 (2010-05-31) x86_64-pc-linux-gnu
>> >  rgl version: 0.91
>> >  minqa version:  1.1.9
>> >  Rcpp version: 0.8.6 (loaded by minqa)
>> >
>> >  Kind regards,
>> >
>> >  Gaspard Lequeux
>> >
>> >  ______________________________________________
>> >  R-help at r-project.org mailing list
>> >
>> >  PLEASE do read the posting guide
>> >  and provide commented, minimal, self-contained, reproducible code.
>>
>>  ______________________________________________
>>  R-help at r-project.org mailing list
>>
>>  PLEASE do read the posting guide
>>  and provide commented, minimal, self-contained, reproducible code.
>
>



More information about the R-help mailing list