Skip to content
Prev 369912 / 398503 Next

fitting cosine curve

On Tue, 20 Jun 2017, lily li wrote:

            
See

         Y.L. Tong (1976) Biometrics 32:85-94

The method is known as `cosinor' analysis.  It takes advantage of the 
*intrinsic* linearity of y = a + b * cos( omega*t - c ), when omega is 
given.

It you are scratching your head saying 'that thing is not linear', you 
need to go back to your linear models text and review what `linearity' 
actually refers to.  Also, reading the Tong paper is recomended as you 
will need the transformations given there in any case.

What you end up doing is fitting

 	fit <- lm(y~cos(t.times.omega)+sin(t.times.omega))

and then transforming coef(fit) to get back a, b, and c. So, you only need 
to have omega. If it is not obvious what value to use,  then that will be 
more of a challenge.

The paper gives asymptotics for the dispersion matrix of (a, b, c), I 
recall.
Seriously? See

https://en.wikipedia.org/wiki/List_of_trigonometric_identities#Shifts_and_periodicity

HTH,

Chuck