Re: [R] Fit a sine to data

2008-05-23 Thread apjaworski
cc project.org Subject [R] Fit a sine to data

Re: [R] Fit a sine to data

2008-05-23 Thread Peter Dalgaard
Juan Manuel Barreneche wrote: > i guess nls or gnls should work > Yes. Notice though that this is really a linear problem because of the trigonometric identity sin(x+b) = cos(b) * sin(x) + sin(b) * cos(x) which means that you can reparametrize c*sin(x+b) (you forgot the multiplier, did you

Re: [R] Fit a sine to data

2008-05-23 Thread Juan Manuel Barreneche
i guess nls or gnls should work JM El Viernes, 23 de Mayo de 2008 10:47, Zroutik Zroutik escribió: > Dear R-users, > > I'd like to fit a sine function to my data. The result should have a format > (and thus the formula, too) > > y ~ a + sin(x+b) > > where y and x are vectors, and a and b are

[R] Fit a sine to data

2008-05-23 Thread Zroutik Zroutik
Dear R-users, I'd like to fit a sine function to my data. The result should have a format (and thus the formula, too) y ~ a + sin(x+b) where y and x are vectors, and a and b are (yet) unknown values. The data sets (vectors x and y) are OK, and I can do a simple lm fitting lm(y~x), or lm(y~I(sin