I have analyzed a circadian experiment using a cosinor model of the form: ~ group + group:(sin + cos) where sin and cos is sine and cosine transformation of the time of sampling and group encodes two experimental conditions.
By testing the groupA:sin and groupA:cos columns I have detected circadian genes, and I have similarly found differential circadian genes.
Reviewers are now asking the we test for differences in amplitude and differences in phase shift, rather than an overall difference in circadianicity.
Using the trigonometric identity:
a * cos(t) + b * sin(t) = sqrt(a^2 + b^2) * sin(t + atan(a/b))
for b != 0 and -pi/2 < atan(a/b) < pi/2
Is it possible to test whether these transformed coefficients are different from 0, something along the lines of:
makeContrasts(
deltaAmplitude = sqrt(groupA:sin^2 + groupA:cos^2) - sqrt(groupB:sin^2 + groupB:cos^2),
deltaPhase = atan(groupA:cos/groupA:sin) - atan(groupB:cos/groupB:sin),
levels = design
)
within the framework of edgeR? Alternatively, is it somehow possible in the modeling step to specify a model like
model.matrix(~ group + group * sin(t + phase))
I realize the makeContrasts and model.matrix I have specified here are incorrect/nonsensical but hopefully they convey what I hope to do.
