Description Usage Arguments Value References See Also Examples
This function plots the detected events from a time series.
1 | plotevents(events, cluster = FALSE, mycl, ...)
|
events |
an object of class ‘events’. |
cluster |
logical, if TRUE then the detected events are highlighted using different colors for different clusters |
mycl |
a vector specifying which cluster each event belongs to |
... |
other arguments that can be passed to plot |
...
Yanfei Kang, Danijel Belusic and Kate Smith-Miles (2014). Detecting and Classifying Events in Noisy Time Series. J. Atmos. Sci., 71, 1090-1104. http://dx.doi.org/10.1175/JAS-D-13-0182.1.
noiseTests
, eventExtraction
, eventDetection
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | ##################################
# 1st art eg (white noise)
##################################
set.seed(123)
n=128
types=c('box','rc','cr','sine')
shapes=matrix(NA,20,n)
for (i in 1:20){
shapes[i,]=cbfs(type=types[sample(1:4,1)])
}
whitenoise=ts2mat(rnorm(128*20),128)
# generate x which randomly combine the four types of events with each two of them
# separated by noise
x=c(rnorm(128),t(cbind(shapes,whitenoise)))
plot(x,ty='l')
w=128; alpha=0.05
# event detection
## Not run:
events=eventDetection(x,w,'white',FALSE,alpha,'art')
clustering events
cc=eventCluster(events,4)
myclkm=cc$cl
# plot the clustered events
plotevents(events,cluster=TRUE, myclkm)
## End(Not run)
##################################
# 2nd art eg (red noise)
##################################
set.seed(123)
# generate a time series with red noise; this is the same with the one used
# in Kang et al. (2014)
coeff=0.5;s=1
x=c(arima.sim(list(order = c(1,0,0),ar=coeff),n=500,sd=s),
cbfs_red('rc'),arima.sim(list(order = c(1,0,0),ar=coeff),n=400,sd=s),
cbfs_red('cr'),arima.sim(list(order = c(1,0,0),ar=coeff),n=400,sd=s),
cbfs_red('box'),arima.sim(list(order = c(1,0,0),ar=coeff),n=400,sd=s),
cbfs_red('sine'),arima.sim(list(order = c(1,0,0),ar=coeff),n=1000,sd=s),
arima.sim(list(order = c(1,0,0),ar=0.8),n=1100,sd=4))
w=128; alpha=0.05
# event detection
## Not run:
events=eventDetection(x,w,'red',parallel=FALSE,alpha,'art')
# plot events without clustering
plotevents(events)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.