1. The question of "linear" vs. "nonlinear" means "linear in the parameters to be estimated. All the examples you have given so far are linear in the parameters to be estimated. The fact that they are nonlinear in "x" is immaterial.

2. With this hint and the posting guide "http://www.R-project.org/posting-guide.html";, you may find more information. A search there exposed much discussion of "robust regression" and even "robust nonlinear regression", if you actually still need that. In addition, I found useful information on robust regression in Venables and Ripley (2002) Modern Applied Statistics with S, 4th ed. (Springer).

hope this helps. spencer graves

cstrato wrote:

Dear all

Here is a hopefully better example with regards to
nonlinear robust fitting:

# fitting a polynomial:
x <- seq(-10,10,0.2)
y <- 10*x + 4*x*x - 2*x*x*x
plot(x,y)
z <- jitter(y,amount=300)
plot(x,z)
df <- as.data.frame(cbind(x,z))
nf <- nls(z ~ a*x + b*x*x + c*x*x*x, data=df,
+           start=list(a=4,b=2,c=1), trace = TRUE)
127697531 :  4 2 1
2974480 :  10.972123  3.793426 -1.942278

# introducing outliers before fitting the  polynomial:
z1 <- z
z1[c(16,22,23,34,36,42,67,69,72,76)] <-
+ c(2000,1900,2000,1900,1600,1600,500,-2000,-1700,-1800)
plot(x,z1)
df1 <- as.data.frame(cbind(x,z1))
nf1 <- nls(z1 ~ a*x + b*x*x + c*x*x*x, data=df1,
+           start=list(a=4,b=2,c=1), trace = TRUE)
159359174 :  4 2 1
24098548 :  -59.053288   4.169518  -1.072027

# plotting the results:
y1 <- 10.97*x + 3.79*x*x - 1.94*x*x*x
y2 <- -59.05*x + 4.17*x*x - 1.07*x*x*x
oldpar <- par(pty="s",mfrow=c(2,2),mar=c(5,5,4,1))
plot(x,y)
plot(x,z1)
plot(x,y1)
plot(x,y2)
par(oldpar)

In my opinion this fit could hardly be considered
to be robust.

Are there functions in R which can do robust fitting?
(Sorrowly, at the moment I could not test the package
nlrq mentioned by Roger Koenker)

Best regards
Christian
_._._._._._._._._._._._._._._._
C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
V.i.e.n.n.a       A.u.s.t.r.i.a
_._._._._._._._._._._._._._._._

______________________________________________
[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

______________________________________________ [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