[R] retrieving coefficients from nls() when it fails to converge

Spencer Graves spencer.graves at pdf.com
Thu Oct 16 19:33:16 CEST 2003


      Have you considered "optim"?  That has produced something for me 
when I got nothing from "nls".  You may wish to call "optim" a second 
time with the output from the first;  you might actually get different 
answers.  Please specify "hessian=TRUE", as follows: 

      fit0 <- optim(..., hessian=TRUE)

      Then "eigen(fit$hessian, symmetric=TRUE)" may tell you why "nls" 
did not converge. 

      The standard advice in such cases is to reconsider what you really 
want and then fewer parameters and / or reparameterize;  see e.g., Bates 
and Watts (1988) Nonlinear Regression Analysis and Its Applications 
(Wiley). 

      hope this helps.  spencer graves

Potter, David M wrote:

>Hi --
>
>I am fitting four-parameter logistic regression models using nls(),
>typically within the body of a loop.  Sometimes a fit fails to converge and
>yet I would like to pull off the coefficients from the last iteration and
>use them to compute backfitted (i.e., inverse prediction) values.
>
>Note: To ignore the fit completely, but have the loop continue, I have
>successfully used try(), but in this case the fits are sufficient for
>getting backfitted values (even though the coefficients are poorly
>estimated), so I need the actual coefficients.
>
>R information:
>
>platform i386-pc-mingw32
>arch     i386           
>os       mingw32        
>system   i386, mingw32  
>status                  
>major    1              
>minor    7.1            
>year     2003           
>month    06             
>day      16             
>language R  
>
>Thanks for your help.
>
>David
>
>__
>David M. Potter
>Groton Nonclinical Statistics
>Pfizer Global Research and Development
>
>
>
>LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>  
>




More information about the R-help mailing list