Computes the wavelet phasor mean field from a matrix of spatiotemporal data. Also the
creator function for the wpmf
class. The wpmf
class inherits from the
tts
class, which inherits from the list
class.
wpmf(
dat,
times,
scale.min = 2,
scale.max.input = NULL,
sigma = 1.05,
f0 = 1,
sigmethod = "none",
nrand = 1000
)
A locations (rows) x time (columns) matrix
A vector of time step values, spacing 1
The smallest scale of fluctuation that will be examined. At least 2.
The largest scale of fluctuation guaranteed to be examined
The ratio of each time scale examined relative to the next timescale. Should be greater than 1.
The ratio of the period of fluctuation to the width of the envelop
Method for significance testing the wmpf, one of quick
, fft
, aaft
(see details)
The number of randomizations to be used for significance testing
wpmf
returns an object of class wpmf
. Slots are:
A matrix of complex numbers containing the wavelet phasor mean field, of dimensions length(times)
by the number of timescales. Entries not considered reliable (longer timescales, near the edges of the time span) are set to NA.
The times associated with the data and the wpmf
The timescales associated with the wpmf
A list with information from the significance testing. Format depends on sigmethod
(see details).
The data matrix (locations by time) from which the wpmf
was computed
The inputted wavelet transform options scale.min, scale.max.input, sigma, f0 in a list
For sigmethod
equal to quick
, the empirical wpmf is compared to a distribution of
magnitudes of sums of random phasors, using the same number of phasors as there are time series. The signif
output is a list with first element "quick
" and second element a vector of nrand
magnitudes of sums
of random phasors. For sigmethod
equal to fft
, the empirical wpmf is compared to wmpfs of
Fourier surrogate datasets. The signif
output is a list with first element "fft
", second element
equal to nrand
, and third element the fraction of surrogate-based wpmf magnitudes that the empirical wpmf
magnitude is greater than (times by timescales matrix). For sigmethod
equal to aaft
, aaft
surrogates are used instead. Output has similar format to the fft
case. Values other than quick
,
fft
, and aaft
for sigmethod
result in no significance testing.
Sheppard, L.W., et al. (2016) Changes in large-scale climate alter spatial synchrony of aphid pests. Nature Climate Change. DOI: 10.1038/nclimate2881
wpmf_methods
, wmf
, tts
, plotmag
,
browseVignettes("wsyn")
# NOT RUN {
times<-1:30 #generate time steps
#generate fake count data for 20 locations
dat<-matrix(rpois(20*length(times),20),nrow=20,ncol=length(times))
dat<-cleandat(dat=dat,times=times,clev=2)$cdat #detrend and demean
res<-wpmf(dat,times)
# }
Run the code above in your browser using DataLab