dwt.vt: Variance Transformation Operation - MRA

Description Usage Arguments Value References Examples

View source: R/dwt_vt.R

Description

Variance Transformation Operation - MRA

Usage

1
dwt.vt(data, wf, J, method, pad, boundary, cov.opt = c("auto", "pos", "neg"))

Arguments

data

A list of response x and dependent variables dp.

wf

Name of the wavelet filter to use in the decomposition.

J

Specifies the depth of the decomposition. This must be a number less than or equal to log(length(x),2).

method

Either "dwt" or "modwt".

pad

The method used for extend data to dyadic size. Use "per", "zero", or "sym".

boundary

Character string specifying the boundary condition. If boundary=="periodic" the default, then the vector you decompose is assumed to be periodic on its defined interval, if boundary=="reflection", the vector beyond its boundaries is assumed to be a symmetric reflection of itself.

cov.opt

Options of Covariance matrix sign. Use "pos", "neg", or "auto".

Value

A list of 8 elements: wf, method, boundary, pad, x (data), dp (data), dp.n (variance trasnformed dp), and S (covariance matrix).

References

Z Jiang, A Sharma, and F Johnson. WRR

Percival, D. B. and A. T. Walden (2000) Wavelet Methods for Time Series Analysis, Cambridge University Press.

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
data(rain.mon)
data(obs.mon)

## response SPI - calibration
SPI.cal <- SPI.calc(window(rain.mon, start=c(1949,1), end=c(1979,12)),sc=12)

## create paired response and predictors dataset for each station
data.list <- list()
for(id in 1:ncol(SPI.cal)){
  x <- window(SPI.cal[,id], start=c(1950,1), end=c(1979,12))
  dp <- window(obs.mon, start=c(1950,1), end=c(1979,12))
  data.list[[id]] <- list(x=as.numeric(x), dp=matrix(dp, nrow=nrow(dp)))
}

## variance transformation
dwt.list<- lapply(data.list, function(x) dwt.vt(x, wf="d4", J=7, method="dwt", pad="zero", boundary="periodic"))

## plot original and reconstrcuted predictors for each station
for(i in 1:length(dwt.list)){
  # extract data
  dwt <- dwt.list[[i]]
  x <- dwt$x  			      # response
  dp <- dwt$dp			      # original predictors
  dp.n <- dwt$dp.n       # variance transformed predictors

  plot.ts(cbind(x,dp))
  plot.ts(cbind(x,dp.n))

}

zejiang-unsw/WASP_1.0.0 documentation built on May 6, 2020, 7:49 p.m.