Hi everyone, I am trying to fit a sine function on one year of wind data. I have two questions below.
Looking around on the net I managed to get the following: Sine Equation: y = a + b * sin( c + d*x ) b is the amplitude, c is the phase shift, d is something deal with periodicty of data*.* This can be linearised by sin( c+dx ) = cos(c) * sin(dx) + sin(c) * cos(dx). If one calls dx = x1 y = a + b * sin( c + d*x ) y = a + b * [cos(c) * sin(x1) + sin(c) * cos(x1)] y = a + b * cos(c) * sin(x1) + b * sin(c) * cos(x1) y = a + b1 * sin(x1) + b2 * cos(x1) where b1 = b * cos(c) and b2 = b * sin(c) This works fine for me as I am not interested in the value for b and c. By trial and error I also detemined that the sensibel value for d is 1/58. I have 366 days of data and want to fit a single sine onto it. *First question*: 1/ 58 = (2 pi) / 366. I guess 366 is the period of my data, I have 366 days. so *d = (2 pi) / Period*. Is this correct. *Second question*: I reckon that all of this looks very DIY. Is there a better way to do this in R? Maybe through a package I dont know? Thanks in advance Paolo [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.