wlm: Wavelet linear models

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

View source: R/wlm.R

Description

Fits wavelet linear models. Also the generator function of the wlm class, which inherits from the list class.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
wlm(
  dat,
  times,
  resp,
  pred,
  norm,
  scale.min = 2,
  scale.max.input = NULL,
  sigma = 1.05,
  f0 = 1
)

Arguments

dat

A list of matrices representing the data (or in the case of one location, a list of vectors). All the same dimensions (respectively, lengths)

times

The times at which measurements were made, spacing 1

resp

Index in dat for the response variable of the model

pred

Vector of indices in dat for the predictor variables of the model; must differ from resp

norm

The normalization of wavelet transforms to use. One of "none", "powall", "powind". See details.

scale.min

The smallest scale of fluctuation that will be examined. At least 2.

scale.max.input

The largest scale of fluctuation that will be examined. Note that if this is set too high relative to the length of the timeseries it will be truncated.

sigma

The ratio of each time scale examined relative to the next timescale. Greater than 1.

f0

The ratio of the period of fluctuation to the width of the envelope

Details

Normalization is as specified in the documentation for coh, HOWEVER, only the "powall" option is currently implemented, other choices throw an error. Details are specified in appendices S7 and S9 of Sheppard et al, 2018. The output modval is v in appendix S7, and coefs are the betas in equation 12 in that appendix.

Value

wlm returns an object of class wlm. Slots are:

dat

The input data list, but reordered and subsetted so the response is first and only used predictors are included

times

The times associated with the data

norm

The input

wtopt

The inputted wavelet transform options scale.min, scale.max.input, sigma, f0 in a list

wts

List of transforms, normalized as specified in norm. Same length as the output dat, each entry a locations x time x timescales array of transforms.

timescales

The timescales associated with the wavelet transforms of the data

coefs

A list (data frame, actually) of complex vectors, each of length the same as timescales. These are the model coefficients (which depend on timescale), and correspond to the wts.

modval

The model values.

coher

Appropriately normalized version of coherence of the model and response transforms. See details.

Author(s)

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

References

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

wlm_methods, wlmtest, syncexpl, predsync, browseVignettes("wsyn")

Examples

1
2
3
4
5
6
7
8
times<-1:30
dat<-list(v1=matrix(rnorm(300),10,30),v2=matrix(rnorm(300),10,30),v3=matrix(rnorm(300),10,30),
          v4=matrix(rnorm(300),10,30),v5=matrix(rnorm(300),10,30))
dat<-lapply(FUN=function(x){cleandat(x,times,1)$cdat},X=dat)
resp<-2
pred<-c(1,3,4)
norm<-"powall"
res<-wlm(dat,times,resp,pred,norm)

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