[R] Issues when trying to fit a nonlinear regression model

Berwin A Turlach berw|n@tur|@ch @end|ng |rom gm@||@com
Mon Aug 21 05:21:42 CEST 2023


G'day Paul,

On Sun, 20 Aug 2023 12:15:08 -0500
Paul Bernal <paulbernal07 using gmail.com> wrote:

> Any idea on how to proceed in this situation? What could I do?

You are fitting a simple asymptotic model for which nls() can find good
starting values if you use the self starting models (SSxyz()).  Well,
Doug (et al.) choose to parameterise the asymptotic model differently,
but you can easily change to your parameterisation if you want:

```
fm1 <- nls(y ~ SSasymp(x, Asym, R0, lrc), data=mod14data2_random)
theta1 <- coef(fm1)["Asym"]
theta2 <- coef(fm1)["Asym"] - coef(fm1)["R0"]
theta3 <- exp(coef(fm1)["lrc"])

fm2 <- nls(y ~ theta1 - theta2 * exp(-theta3*x), 
           start=list(theta1=theta1, theta2=theta2, theta3=theta3),
           data=mod14data2_random)
summary(fm2)
```

Cheers,

	Berwin



More information about the R-help mailing list