# [R] nls() and nls2() behavior?

Walmes Zeviani walmeszeviani at hotmail.com
Tue May 11 17:24:13 CEST 2010

```I think the problem with nls() is the model specification. Look:

> y <- c(0.4334,0.3200,0.5848,0.6214,0.3890,0.5233,0.4753,
+        0.2104,0.3240,0.2827,0.3847,0.5571,0.5432,0.1326,0.3481)
> x <- c(0.3521,0.4334,0.3200,0.5848,0.6214,0.3890,0.5233,
+        0.1379,0.2104,0.3240,0.3404,0.3847,0.5571,0.5432,0.1326)
> dummy <- rep(c("m1","m2","m3"), c(7,3,5))
>
> d <- data.frame(y=y, x=x, dummy=dummy)
>
> n0 <- nls(y~b0[dummy]+b1*x, data=d,
+           start=list(b0=c(1,1,1), b1=1))
> summary(n0)

Formula: y ~ b0[dummy] + b1 * x

Parameters:
Estimate Std. Error t value Pr(>|t|)
b01  0.48616    0.13993   3.474  0.00520 **
b02  0.27626    0.09970   2.771  0.01820 *
b03  0.39994    0.12597   3.175  0.00884 **
b1  -0.01735    0.28352  -0.061  0.95230
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.1331 on 11 degrees of freedom

Number of iterations to convergence: 1
Achieved convergence tolerance: 2.713e-07

I don't know abou nls2().

Walmes.

-----
..ooo0
...................................................................................................
..(....)... 0ooo...                              Walmes Zeviani
...\..(.....(.....)...     Master in Statistics and Agricultural
Experimentation
....\_)..... )../....       walmeszeviani at hotmail.com, Lavras - MG, Brasil
............
(_/............................................................................................
--
View this message in context: http://r.789695.n4.nabble.com/nls-and-nls2-behavior-tp2173931p2173978.html
Sent from the R help mailing list archive at Nabble.com.

```