Bernardo Rangel Tura <[EMAIL PROTECTED]> writes:

> I have a problem with nls() and my research data. Look this example:
> 
> X2000<-c(1.205268,2.850695,5.100860,8.571610,15.324513,25.468599,39.623418,61.798856,91.470006,175.152509)
> age<-c(37,42,47,52,57,62,67,72,77,82)
> fit <- nls(X2000~R*exp(A*age),start=list(R=.1,A=.1))
> 
> Error mensage:
> 
> Error in nls(X2000 ~ R * exp(A * age), start = list(R = 0.1, A = 0.1)) : 
>         singular gradient
> In addition: Warning message: 
> no finite arguments to min; returning Inf
> 
> How I fix this problem? Other command? 

The problem is your starting value for R.  This is a case where the
"plinear" algorithm is very helpful because you only need a starting
estimate for A, the nonlinear parameter.

> fm1 = nls(X2000 ~ exp(A*age), start = c(A = .1), alg = 'plinear', trace = TRUE)
172.7589 : 0.10000000 0.04645409 
161.7483 : 0.10315347 0.03619599 
161.6661 : 0.10343465 0.03539847 
161.6656 : 0.10345546 0.03534014 
161.6656 : 0.10345698 0.03533590 
161.6656 : 0.10345709 0.03533559 
> summary(fm1)

Formula: X2000 ~ exp(A * age)

Parameters:
     Estimate Std. Error t value Pr(>|t|)    
A    0.103457   0.004578  22.598 1.56e-08 ***
.lin 0.035336   0.012841   2.752    0.025 *  
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 

Residual standard error: 4.495 on 8 degrees of freedom

Correlation of Parameter Estimates:
           A
.lin -0.9983

Notice that you have extremely high correlation of these parameter
estimates.  Also it is unlikely that you will have homoscedastic
(i.e. same variance) errors on those observations so you may want to
consider fitting log(X2000) to age, which would be a linear model.

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to