Re: [Rd] Windows crash in confint() with nls fit (PR#8428)

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Fri 23 Dec 2005 - 15:09:21 GMT

Actually, only the default algorithm is supported: algorithm="plinear" is broken too. I've just added a check for the default algorithm in R-patched, as the fix is better done on the R-devel code base (which supports weights).

On Thu, 22 Dec 2005 murdoch@stats.uwo.ca wrote:

> I've found the problem, but someone who knows more about nls() will have
> to fix it.
>
> The problem is that in the demo code below, n1 ends up being an nls
> object, but n1$call$control is NULL. profiler.nls() assumed that the
> nls object passed to it has a non-NULL element there, and doesn't check.
>
> I've fixed the code so now it doesn't crash, but it now dies with this
> error instead:
>
> > confint(n1) ## boom
> Waiting for profiling to be done...
> Error in prof$getProfile() : 'control$maxiter' absent
>
> I'll commmit my change to R-devel and R-patched shortly.
>
> Duncan Murdoch
>
>
>
>
>
> On 12/22/2005 1:23 PM, bolker@zoo.ufl.edu wrote:
>> Full_Name: Ben Bolker
>> Version: 2.2.1
>> OS: Windows XP and 2000
>> Submission from: (NULL) (128.227.60.124)
>>
>>
>> The following code, using confint() to try
>> to get confidence intervals on an nls object
>> that has been fitted with algorithm="port"
>> reliably crashes R 2.2.0 and 2.2.1 with the
>> latest version of MASS on a Windows 2000 and
>> a Windows XP machine here. I *think* earlier
>> versions of MASS may not have crashed, but
>> I have now updated the versions on most of
>> my machines and don't have a test version handy.
>>
>> On XP, I get an error-report-do-you-want-
>> to-send-this-to-Microsoft dialog box. On 2000
>> I get a "Rgui has generated errors ..." dialog box.
>>
>> I can get this far:
>>
>> debug: profiledModel <- .Call("nls_iter", fittedModel, ctrl, trace,
>> PACKAGE = "stats")
>>
>> Browse[1]> where
>> where 1: prof$getProfile()
>> where 2: profile.nls(object, which = parm, alphamax = (1 - level)/4)
>> where 3: profile(object, which = parm, alphamax = (1 - level)/4)
>> where 4: confint.nls(n1)
>> where 5: confint(n1)
>>
>> I'm not set up to debug compiled code on Windows, and I haven't
>> been able to reproduce the problem on Linux.
>>
>> set.seed(1001)
>> x = runif(200)
>> a =1
>> b = 1
>> c = -0.1
>> y = a+b*x+c*x^2+rnorm(200,sd=0.05)
>> plot(x,y)
>> curve(a+b*x+c*x^2,add=TRUE)
>> n1 = nls(y~a+b*x+c*I(x^2),start=c(a=1,b=1,c=0.1),algorithm="port")
>> confint(n1) ## boom
>>
>> N.B.: It only crashes if algorithm="port" is specified.
>>
>> ## [1] "Windows 2000 Professional (build 2195) Service Pack 4.0"
>> ##
>> ## > R.version
>> ## _
>> ## platform i386-pc-mingw32
>> ## arch i386
>> ## os mingw32
>> ## system i386, mingw32
>> ## status
>> ## major 2
>> ## minor 2.0
>> ## year 2005
>> ## month 10
>> ## day 06
>> ## svn rev 35749
>> ## language R
>> ##
>> ## MASS
>> ##
>> ## Version: 7.2-23
>> ## Date: 2005-12-08
>> ##
>> ##
>>
>> ## "Windows XP Professional (build 2600) Service Pack 2.0"
>> ## _
>> ##platform i386-pc-mingw32
>> ##arch i386
>> ##os mingw32
>> ##system i386, mingw32
>> ##status
>> ##major 2
>> ##minor 2.0
>> ##year 2005
>> ##month 10
>> ##day 06
>> ##svn rev 35749
>> ##language R
>>
>> ##
>> ##Version: 7.2-23
>> ##Date: 2005-12-08 ## CRASH
>>
>> ##> R.version
>> ## _
>> ##platform i386-pc-mingw32
>> ##arch i386
>> ##os mingw32
>> ##system i386, mingw32
>> ##status
>> ##major 2
>> ##minor 2.1
>> ##year 2005
>> ##month 12
>> ##day 20
>> ##svn rev 36812
>> ##language R
>> ## CRASH
>>
>> ______________________________________________
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sat Dec 24 02:17:49 2005

This archive was generated by hypermail 2.1.8 : Fri 23 Dec 2005 - 21:22:22 GMT