Learn R Programming

CVThresh (version 1.1.2)

cvwavelet.after.impute: Cross-Validation Wavelet Shrinkage after imputation

Description

This function performs level-dependent cross-validation wavelet shrinkage given the cross-validation scheme and imputation values.

Usage

cvwavelet.after.impute(y, ywd, yimpute,
    cv.index, cv.optlevel, cv.tol=0.1^3, cv.maxiter=100,
    filter.number=10, family="DaubLeAsymm", thresh.type="soft", ll=3)

Arguments

y

observation

ywd

DWT object

yimpute

imputed values according to cross-validation scheme

cv.index

test dataset index according to cross-validation scheme

cv.optlevel

thresholding levels

cv.tol

tolerance for cross-validation

cv.maxiter

maximum iteration for cross-validation

filter.number

specifies the smoothness of wavelet in the decomposition (argument of WaveThresh)

family

specifies the family of wavelets ``DaubExPhase" or ``DaubLeAsymm" (argument of WaveThresh)

thresh.type

specifies the type of thresholding ``hard" or ``soft" (argument of WaveThresh)

ll

specifies the lowest level to be thresholded

Value

Reconstruction and thresholding values by level-dependent cross-validation

yc

reconstruction

cvthresh

thresholding values by level-dependent cross-validation

Details

Calculating the threshold values and reconstructing noisy data \(y\), given the index of each testdata, imputed values according to cross-validation scheme and discrete wavelet transform of \(y\).

See Also

cvwavelet, cvtype, cvimpute.by.wavelet.

Examples

Run this code
# NOT RUN {
data(ipd)
y <- as.numeric(ipd); n <- length(y); nlevel <- log2(n)

set.seed(1)
cv.index <- cvtype(n=n, cv.bsize=2, cv.kfold=4, cv.random=TRUE)$cv.index
yimpute <- cvimpute.by.wavelet(y=y, impute.index=cv.index)$yimpute

ywd <- wd(y)

#out <- cvwavelet.after.impute(y=y, ywd=ywd, yimpute=yimpute,
#cv.index=cv.index, cv.optlevel=c(3:(nlevel-1)))

#ts.plot(ts(out$yc, start=1229.98, deltat=0.02, frequency=50),
#   main="Level-dependent Cross Validation", xlab = "Seconds", ylab="")

##### Specifying thresholding structure
# cv.optlevel <- c(3) # Threshold (level 3 to finest level) at the same time.
# cv.optlevel <- c(3, 5) # Threshold two groups of resolution levels,
                         # (level 3, 4) and  (level 5 to finest level).
# cv.optlevel <- c(3,4,5,6,7,8) # Threshold each resolution level 3 to 8.
# }

Run the code above in your browser using DataLab