# Re: [R] [Re: Significance of confidence intervals in the Non-Linear Least Squares Program.]

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Fri, 28 Mar 2008 09:01:47 +0100

glenn andrews wrote:
> What should I be looking for in the output of the nls() routine that
> alerts me to the fact that the Hessian is potentially ill-conditioned?
>
Unreasonably large s.e.'s and large correlations in the variance-covariance matrix of estimates (cov2cor(vcov(nlmod)) or summary(nlmod, corr=TRUE)).

Notice that the former requires at least some feel for what is the natural scale of each parameter, which in turn requires subject-matter knowledge.

> Glenn
>
> Peter Dalgaard wrote:
>
>> glenn andrews wrote:
>>
>>> Thanks for the response. I was not very clear in my original request.
>>>
>>> What I am asking is if in a non-linear estimation problem using
>>> nls(), as the condition number of the Hessian matrix becomes larger,
>>> will the t-values of one or more of the parameters being estimated
>>> in general become smaller in absolute value -- that is, are low
>>> t-values a sign of an ill-conditioned Hessian?
>>>
>>
>> In a word: no. Ill-conditioning essentially means that there are one
>> or more directions in parameter space along which estimation is
>> unstable. Along such directions you get a large SE, but also a large
>> variability of the estimate, resulting in t values at least in the
>> usual "-2 to +2" range. The large variation may swamp a true effect
>> along said direction, though.
>>
>>> Typical nls() ouput:
>>>
>>> Formula: y ~ (a + b * log(c * x1^d + (1 - c) * x2^d))
>>>
>>> Parameters:
>>> Estimate Std. Error t value Pr(>|t|) a 0.11918 0.07835
>>> 1.521 0.1403 b -0.34412 0.27683 -1.243 0.2249 c 0.33757
>>> 0.13480 2.504 0.0189 *
>>> d -2.94165 2.25287 -1.306 0.2031
>>> Glenn
>>>
>>> Prof Brian Ripley wrote:
>>>
>>>
>>>
>>>> On Wed, 26 Mar 2008, glenn andrews wrote:
>>>>
>>>>
>>>>> I am using the non-linear least squares routine in "R" -- nls. I
>>>>> have a
>>>>> dataset where the nls routine outputs tight confidence intervals
>>>>> on the
>>>>> 2 parameters I am solving for.
>>>>>
>>>>
>>>> nls() does not ouptut confidence intervals, so what precisely did
>>>> you do?
>>>> I would recommend using confint().
>>>>
>>>> BTW, as in most things in R, nls() is 'a' non-linear least squares
>>>> routine: there are others in other packages.
>>>>
>>>>
>>>>> As a check on my results, I used the Python SciPy leastsq module
>>>>> on the
>>>>> same data set and it yields the same answer as "R" for the
>>>>> coefficients. However, what was somewhat surprising was the the
>>>>> condition number of the covariance matrix reported by the SciPy
>>>>> leastsq
>>>>> program = 379.
>>>>>
>>>>> Is it possible to have what appear to be tight confidence
>>>>> intervals that
>>>>> are reported by nls, while in reality they mean nothing because of
>>>>> the
>>>>> ill-conditioned covariance matrix?
>>>>>
>>>>
>>>> The covariance matrix is not relevant to profile-based confidence
>>>> intervals, and its condition number is scale-dependent whereas the
>>>> estimation process is very much less so.
>>>>
>>>> least-squares estimation), so please take it up with your
>>>>
>>>>
>>>
>>>
>>> ______________________________________________
>>> R-help_at_r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>>
>

```--
O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk)              FAX: (+45) 35327907

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help