time <- seq(1:24)
pure <- matrix(time,24,18)
pure <- cos((pure + col(pure))*pi/12)
matplot(pure,type="l")
p <- cosinor(time,pure)
set.seed(42)
noisey <- pure + rnorm(24*18)
n <- cosinor(time,noisey)
small.pure <- pure[c(6:18),]
small.noisey <- noisey[c(6:18),]
sp <- cosinor(time[c(6:18)],small.pure)
spo <- cosinor(time[c(6:18)],small.pure,opti=TRUE)
sn <- cosinor(time[c(6:18)],small.noisey)
sno <- cosinor(time[c(6:18)],small.noisey,opti=TRUE)
sum.df <- data.frame(pure=p,noisey = n, small=sp,small.noise = sn, small.opt=spo,small.noise.opt=sno)
round(sum.df,2)
round(circadian.cor(sum.df[,c(1,3,5,7,9,11)]),2) #compare alternatives
round(cor(sum.df[,c(2,4,6,8,10,12)]),2)
Run the code above in your browser using DataLab