[R] sporadic errors with nlrq() / optim()

roger koenker rkoenker at uiuc.edu
Fri May 7 00:03:33 CEST 2004


I've recently updated nlrq to get rid of these warnings.  Peter's diagnosis
of the optim problem seems entirely consistent with the evidence: my mac
running R-devel was Jim's source on the error free case.  And my solaris
machine (running 1.9.0 unpatched) does eventually have a problem with
optim:

140
141
142
Error in optim(par = 1, fn = model.step, method = "L-BFGS-B", lower = 
0,  :
         non-finite value supplied by optim
In addition: There were 50 or more warnings (use warnings() to see the 
first 50)
 > traceback()
3: optim(par = 1, fn = model.step, method = "L-BFGS-B", lower = 0,
        upper = 1, Step = Step, model = model, pars = Pars, control = 
optim.ctrl)
2: nlrq.calc(m, ctrl, trace)
1: nlrq(y ~ SSfpl(x, A, B, xmid, scal), data = test)

Roger

url:	www.econ.uiuc.edu/~roger        	Roger Koenker
email	rkoenker at uiuc.edu			Department of Economics
vox: 	217-333-4558				University of Illinois
fax:   	217-244-6678				Champaign, IL 61820

On May 6, 2004, at 4:50 PM, Leonard assis wrote:

>
> Only theese: :(
>
>
> 495
> 496
> 497
> 498
> 499
> There were 50 or more warnings (use warnings() to see the first 50)
>>
>> warnings()
> Warning messages:
> 1: multi-argument returns are deprecated in: return(coef, w)
> 2: multi-argument returns are deprecated in: return(coef, w)
> 3: multi-argument returns are deprecated in: return(coef, w)
> 4: multi-argument returns are deprecated in: return(coef, w)
> 5: multi-argument returns are deprecated in: return(coef, w)
> 6: multi-argument returns are deprecated in: return(coef, w)
> 7: multi-argument returns are deprecated in: return(coef, w)
> 8: multi-argument returns are deprecated in: return(coef, w)
> 9: multi-argument returns are deprecated in: return(coef, w)
> 10: multi-argument returns are deprecated in: return(coef, w)
> ...
> 50: multi-argument returns are deprecated in: return(coef, w)
> []s
> Leonard Assis
> Estatístico /  CONFE 7439
> UIN : 41-764-523 /  Skype : lmassis /  msn : lmassis at msn.com
>
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Leonard assis
> Sent: Thursday, May 06, 2004 6:42 PM
> To: 'Peter Dalgaard'; 'Rogers, James A [PGRD Groton]'
> Cc: r-help at stat.math.ethz.ch
> Subject: RE: [R] sporadic errors with nlrq() / optim()
>
> In my computer, there's no error
>
> WIN XP
> PENTIUM4 1.67GHz
> 1GB RAM
> R 1.9.0 Patched
>
>
> []s
> Leonard Assis
> Estatístico /  CONFE 7439
> UIN : 41-764-523 /  Skype : lmassis /  msn : lmassis at msn.com
>
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Peter Dalgaard
> Sent: Thursday, May 06, 2004 6:21 PM
> To: Rogers, James A [PGRD Groton]
> Cc: 'r-help at stat.math.ethz.ch'
> Subject: Re: [R] sporadic errors with nlrq() / optim()
>
> "Rogers, James A [PGRD Groton]" <James_A_Rogers at groton.pfizer.com> 
> writes:
>
>> Dear List,
>>
>> Apologies if this is a known problem ... I wasn't able to find it on
>> the bug list, but it is a problem that does not seem to occur with a
>> MAC build of R 2.0, so perhaps this problem has already been addressed
>> for
> the future.
>>
>> I am getting *sporadic* errors when refitting the same model to the
>> same data set, using nlrq() in the nlrq package. The algorithm is not
>> stochastic, so I would expect to get errors either every time, or 
>> never.
>>
>> ###
>>
>> library(stats) # or library(nls) if using R < 1.9.0
>> library(nlrq)
>>
>> test <- data.frame(x = c(7.60090245954208, 6.90775527898214,
>> 6.21460809842219, 5.52146091786225, 4.60517018598809,
>> 3.91202300542815,
>> 3.2188758248682 , 2.52572864430826, 1.83258146374831,
>> 7.60090245954208, 6.90775527898214, 6.21460809842219,
>> 5.52146091786225, 4.60517018598809, 3.91202300542815, 3.2188758248682
>> , 2.52572864430826, 1.83258146374831, 6.21460809842219, 
>> 6.21460809842219),
>>                    y = c( 11.0161506644269, 9.84267541313937,
>> 8.66146668057266, 7.48099216286952, 6.50578406012823,
>> 6.24027584517077, 5.63121178182137, 5.71702770140622,
>> 5.64190707093811, 10.8983676287705, 9.91857318995417,
>> 8.74608021735751, 7.58120982619635, 6.361302477573 , 5.91889385427315,
>> 5.63835466933375 , 5.80211837537706, 5.64897423816121,
>> 8.6195692580331 , 8.70367275835886)
>>                    )
>>
>> i <- 1
>> while(i < 500) {    # I usually hit an error within 50 iterations
>>   cat(i, "\n")
>>   nlrq(y ~ SSfpl(x, A, B, xmid, scal), data = test)
>>   i <- i + 1
>> }
>>
>> ###
>>
>> Errors occur with version 1.8.1 and 1.9.0 on both Windows (two
>> different
>> machines) and UNIX, but not on version 2.0 on a MAC (these are the
>> only R version - OS permutations I was able to get reports on easily).
>>
>> Anyone understand what is happening here?
>
> There's no "version 2.0", only "2.0.0 Under development (unstable)".
> If you look at the NEWS file for that version (or for 1.9.0-patched) 
> under
> 1.9.1 changes, you'll find
>
>    o   The L-BFGS-B option of optim() apparently needs part of its
>         workspace zeroed.  (PR#6720)
>
> which gave problems of the sort you experiences.
>
> -- 
>    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




More information about the R-help mailing list