[R] Fitting a sine wave using solver

Carl Witthoft carl at witthoft.com
Sat Nov 22 20:32:52 CET 2008

To follow Dieter's comment,

You can in fact fit a data to a sine in Excel using LINEST.  I've done 
it.  I don't recommend it :-) .

What I did was create columns containing sin(x) and cos(x) , roughly 
speaking, and fit using

LINEST([y=values],{sines, cosines},...)

Ya need the cosines or something similar to get rid of phase ambiguity.

But using either FFTs or glm()  should do fine.

And stay away from Excel!  :-(


More information about the R-help mailing list