From murdoch at stats.uwo.ca  Thu Dec 22 20:19:27 2005
From: murdoch at stats.uwo.ca (murdoch@stats.uwo.ca)
Date: Thu, 22 Dec 2005 20:19:27 +0100 (CET)
Subject: [Rd] Windows crash in confint() with nls fit (PR#8428)
Message-ID: <20051222191927.EA7E719A74@slim.kubism.ku.dk>

On 12/22/2005 1:23 PM, bolker at 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.

I see it in R-devel too.  It's in a strcmp; I'll see if I can track down 
the cause.

Duncan Murdoch

> 
> 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 at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Windows crash in confint() with nls fit (PR#8428)
murdoch@stats.uwo.ca