Description Usage Arguments Value References Examples
Variance Transformation Operation for Validation
1 |
data |
A list of response x and dependent variables dp. |
J |
Specifies the depth of the decomposition. This must be a number less than or equal to log(length(x),2). |
dwt |
A class of "at" data. Output from at.vt(). |
A list of 8 elements: wf, J, boundary, pad, x (data), dp (data), dp.n (variance trasnformed dp), and S (covariance matrix).
Z Jiang, A Sharma, and F Johnson. WRR
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 37 38 39 40 41 42 43 | 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 - calibration
dwt.list<- lapply(data.list, function(x) at.vt(x, wf="d4", J=7, pad="zero", boundary="periodic"))
##response SPI - validation
SPI.val <- SPI.calc(window(rain.mon, start=c(1979,1), end=c(2009,12)),sc=12)
## create paired response and predictors dataset for each station
data.list <- list()
for(id in 1:ncol(SPI.val)){
x <- window(SPI.val[,id], start=c(1980,1), end=c(2009,12))
dp <- window(obs.mon, start=c(1980,1), end=c(2009,12))
data.list[[id]] <- list(x=as.numeric(x), dp=matrix(dp, nrow=nrow(dp)))
}
#variance transformation - validation
dwt.list.val<- lapply(1:length(data.list), function(i) at.vt.val(data.list[[i]], J=7, dwt.list[[i]]))
## plot original and reconstrcuted predictors for each station
for(i in 1:length(dwt.list.val)){
# extract data
dwt <- dwt.list.val[[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))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.