Detecting cycle maxima (peaks) in noisy time series (In R?) -
this question algorithm determining number , location of maxima in sequence of numbers. thus, there statistical flavor question, more leaning towards programming, because not interested in specific statistical properties, , solution needs in r. use of statistics answer question ok, not requirement.
i want extract maxima of cycles in time series data (i.e., ordered sequence of numbers). example of such data solar flare time series (~11 year cycle, between 9 & 14 years). cycles don't repeat @ perfect interval, , peaks aren't same height.
i found recent paper describing algorithm this, , paper uses solar flares example (figure 5, scholkmann et al. 2012, algorithms). hoping algorithm, or equally effective algorithm, available r package.
link scholkmann paper on "automatic multiscale-based peak detection" http://www.mdpi.com/1999-4893/5/4/588
i've tried "turningpoints" function in "pastecs" package seemed sensitive (i.e., detected many peaks). thought of trying smooth time series first, i'm not sure if best approach (i'm no expert).
thanks pointers.
if peaks periodic (with fluctuating period), in sunspot example, can use hilbert transform or empirical mode decomposition smooth time series.
library(emd) x <- as.vector(sunspots) r <- emd(x) # keep 5 components -- may need more, or less. y <- apply( r$imf[,5:10], 1, sum ) + mean(r$residue) plot(x, type="l", col="grey") lines( y, type="l", lwd=2) n <- length(y) <- y[2:(n-1)] > y[1:(n-2)] & y[2:(n-1)] > y[3:n] points( which(i), y[i], pch=15 )
Comments
Post a Comment