# NOT RUN {
library(OptCirClust)
x=c(40,41,42,50,51,52,60,61,62,70,71,72,80,81,82,90,91,92)
x <- x + rnorm(length(x))
clusterrange=c(2:5)
periodrange=c(80:120)/10
period<-estimate.period(x, periodrange, clusterrange)
cat("The estimated period is", period, "\n")
plot(x, rep(1, length(x)), type="h", col="purple",
ylab="", xlab="Noisy periodic data",
main="Period estimation",
sub=paste("Estimated period =", period))
k <- (max(x) - min(x)) %/% period
abline(v=min(x)+period/2 + period * (0:k), lty="dashed", col="green3")
# }
Run the code above in your browser using DataLab