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

2004-02-02 Thread cstrato
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 -

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

2004-02-02 Thread Spencer Graves
You didn't tell us what the error message nls gave, but it should be obvious: You can estimate either a or b in this model (or their ratio), but you can't estimate both. See any good book on nonlinear regression, e.g., Bates and Watts (1988) Nonlinear Regression and Its Applications

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

2004-02-02 Thread Ravi Varadhan
] 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

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

2004-02-02 Thread Peter Dalgaard
cstrato [EMAIL PROTECTED] writes: 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

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

2004-02-02 Thread Ravi Varadhan
] 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

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

2004-02-02 Thread cstrato
Dear all Thank you very much this time for the fast response and your many comments, and sorry for the stupid mistake. 1, The following gives the following error: nf - nls(z ~ a*sin(x)/(b*x), data=df, start=list(a=0.8,b=0.9), trace = TRUE) Error in nlsModel(formula, mf, start) :

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

2004-02-02 Thread cstrato
, 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

[R] Robust nonlinear regression - better example

2004-02-02 Thread cstrato
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, +

Re: [R] Robust nonlinear regression - better example

2004-02-02 Thread Spencer Graves
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

[R] Robust nonlinear regression

2004-01-30 Thread cstrato
Dear R experts This is a general question: Does R have functions for nonlinear robust regression, analogous to e.g. LTS? Searching google I have found 1, an abstract to generalize LTS for nonlinear regression models, see: http://smealsearch.psu.edu/1509.html 2, an AD-model builder, see: