plotphase: For plotting the phases of values in 'tts' and 'coh' objects

Description Usage Arguments Author(s) References See Also Examples

View source: R/plotphase.R

Description

For plotting the phases of values in tts objects (and derived classes) against time and timescale, and coh objects against timescale

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
plotphase(object, ...)

## S3 method for class 'tts'
plotphase(object, filename = NA, ...)

## S3 method for class 'wt'
plotphase(object, filename = NA, ...)

## S3 method for class 'wmf'
plotphase(object, filename = NA, ...)

## S3 method for class 'wpmf'
plotphase(object, filename = NA, ...)

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

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

Arguments

object

A coh object.

...

Passed from the generic to specific methods. The plotphase.tss method passes it to fields::image.plot.

filename

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

bandprows

The rows of object$bandp for which to display p-value results in the 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

See Also

tts, wt, wmf, wpmf, coh, plotmag, plotrank, 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
31
32
33
34
35
36
#For a tts object
times<-1:100
timescales<-1:100
cplx<-complex(modulus=1,argument=seq(from=-pi,to=pi,length.out=100))
values1<-matrix(cplx,length(times),length(timescales))
tts1<-tts(times,timescales,values1)  
plotphase(tts1)

#For a coh oject
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=50,
         f0=0.5,scale.max.input=28)
res<-bandtest(res,c(2,4))
res<-bandtest(res,c(4,30))
res<-bandtest(res,c(8,12))
plotphase(res)

wsyn documentation built on June 19, 2021, 1:07 a.m.