plotrank: Plots 'ranks' slot for 'coh' and 'wlmtest' objects

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/plotrank.R

Description

Plots the ranks slot for coh and wlmtest objects to help identify statistical significance of coherence

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
plotrank(object, ...)

## S3 method for class 'coh'
plotrank(object, sigthresh = 0.95, bandprows = "all", filename = NA, ...)

## S3 method for class 'wlmtest'
plotrank(object, sigthresh = 0.95, bandprows = "all", filename = NA, ...)

## Default S3 method:
plotrank(object, ...)

Arguments

object

A coh or wlmtest object. Must have a non-NA signif slot.

...

Passed from the generic to specific methods. Not currently used.

sigthresh

Significance threshold(s). Numeric vector with values between 0 and 1. Typically 0.95, 0.99, 0.999, etc. The threshhold(s) are plotted on the rank plot as dashed horizontal line(s).

bandprows

The rows of object$bandp for which to display p-value results in the plot

filename

Filename (without extension), for saving as pdf. Default value NA saves no file and uses the default graphics device.

Details

The plot shows the modulus of object$ranks$coher versus log(1/object$timescales). Horizontal axis ticks are labeled as timescales, but are spaced on the axis as log(1/timescale), i.e., log frequencies. p-values from object$bandp are displayed above the rank plot.

Author(s)

Thomas Anderson, anderstl@gmail.com, Jon Walter, jaw3es@virginia.edu; Lawrence Sheppard, lwsheppard@ku.edu; Daniel Reuman, reuman@ku.edu

References

Sheppard, L.W., et al. (2016) Changes in large-scale climate alter spatial synchrony of aphid pests. Nature Climate Change. DOI: 10.1038/nclimate2881

Sheppard, LW et al. (2019) Synchrony is more than its top-down and climatic parts: interacting Moran effects on phytoplankton in British seas. Plos Computational Biology 15, e1006744. doi: 10.1371/journal.pcbi.1006744

See Also

coh, wlmtest, bandtest, plotphase, plotmag, browseVignettes("wsyn")

Examples

 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
#For a coh object
times<-(-3:100)
ts1<-sin(2*pi*times/10)
ts2<-5*sin(2*pi*times/3)
artsig_x<-matrix(NA,11,length(times)) #the driver
for (counter in 1:11)
{
  artsig_x[counter,]=ts1+ts2+rnorm(length(times),mean=0,sd=1.5)
}
times<-0:100
artsig_y<-matrix(NA,11,length(times)) #the driven
for (counter1 in 1:11)
{
  for (counter2 in 1:101)
  {
    artsig_y[counter1,counter2]<-mean(artsig_x[counter1,counter2:(counter2+2)])
  }
}
artsig_y<-artsig_y+matrix(rnorm(length(times)*11,mean=0,sd=3),11,length(times))
artsig_x<-artsig_x[,4:104]
artsig_x<-cleandat(artsig_x,times,1)$cdat
artsig_y<-cleandat(artsig_y,times,1)$cdat
res<-coh(dat1=artsig_x,dat2=artsig_y,times=times,norm="powall",sigmethod="fast",
nrand=100,f0=0.5,scale.max.input=28)
#use larger nrand for a real application
res<-bandtest(res,c(2,4))
res<-bandtest(res,c(8,12))
plotrank(res)
  
#For a wlmtest object, see vignette

wsyn documentation built on Jan. 15, 2021, 3:37 p.m.