# [R] Robust nonlinear regression - sin(x)/x?

cstrato cstrato at aon.at
Mon Feb 2 22:38:55 CET 2004

Dear Ravi

Sorry, I forgot to mention that you have also  indicated
that I have only one parameter. Fitting using lm gives:
c=1.023 w/o and c=1.146 with outliers.

fit a polynomial of degree n?

Best regards
Christian

> A small correction to my previous email:
> You actually specify the following call to lm:
>
> y <- sin(x)/x
> lm(z ~ y - 1)
>
> to make sure that the intercept is not estimated.
>
> Ravi.
>
> ----- Original Message -----
> Date: Monday, February 2, 2004 2:46 pm
> Subject: Re: [R] Robust nonlinear regression - sin(x)/x?
>
>
>>You reall have only one parameter in your model, c = a/b. You
>>can't
>>identify both a and b from your model, therefore, you should fit
>>the
>>linear model:  lm(z ~ c* sin(x)/x)
>>
>>Ravi.
>>
>>----- Original Message -----
>>From: cstrato <cstrato at aon.at>
>>Date: Monday, February 2, 2004 2:28 pm
>>Subject: [R] Robust nonlinear regression - sin(x)/x?
>>
>>
>>>Dear all
>>>
>>>Since I did not receive any answer to my general question (?),
>>>let me ask a concrete question:
>>>
>>>How can I fit the simple function y = a*sin(x)/b*x?
>>>
>>>This is the code that I tried, but nls gives an error:
>>>
>>>x <- seq(1,10,0.1)
>>>y <- sin(x)/x
>>>plot(x,y)
>>>z <- jitter(y,amount=0.1)
>>>plot(x,z)
>>>df <- as.data.frame(cbind(x,z))
>>>nf <- nls(z ~ a*sin(x)/b*x, data=df,
>>>          start=list(a=0.8,b=0.9), trace = TRUE)
>>>
>>>I have followed the Puromycin sample which works fine:
>>>Pur.wt <- nls(rate ~ (Vm * conc)/(K + conc), data = Treated,
>>>              start = list(Vm = 200, K = 0.1), trace = TRUE)
>>>
>>>Do I make some mistake or is it not possible to fit sin(x)/x?
>>>
>>>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
>>>_._._._._._._._._._._._._._._._
>>>
>>>
>>>cstrato wrote:
>>>
>>>>Dear R experts
>>>>
>>>>This is a general question:
>>>>Does R have functions for nonlinear robust regression,
>>>>analogous to e.g. LTS?
>>>>
>>>>1, an abstract to generalize LTS for nonlinear regression
>>>>models, see: http://smealsearch.psu.edu/1509.html
>>>>2, an AD-model builder, see: http://otter-
>>
>>rsch.com/admodel/cc1.html> > but no mention of R/S
>>
>>>>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
>>>>_._._._._._._._._._._._._._._._
>>>>
>>>>______________________________________________
>>>>R-help at stat.math.ethz.ch mailing list
>>>>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>>>http://www.R-project.org/posting-guide.html
>>>>
>>>>
>>>
>>>______________________________________________
>>>R-help at stat.math.ethz.ch mailing list
>>>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>
>>project.org/posting-
>>
>>>guide.html
>>
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>guide.html
>
>
>
>