Readme file
SERIES
B
Statistical
Methodology
A wavelet- or lifting-scheme-based imputation method, by T. J. Heaton and B. W. Silverman, pages 567–587 1-dimensional wavelet imputation
To use wavelets you will first need to download and install the WaveThresh package from Bristol. Now save the following files in your working directory
main.R
PosteriorSamples.R
ForwardTrans.R
EbayesThreshCode.R
and then source them into your R workspace. The main function you will wish to use for imputation is called
WaveletImpute(...)
See the main.R file for full instructions on its options and arguments. Below we show its implementation on the Blocks function and also include the code for our simulation study.
Examples and Simulation Study
Initially download the following two files containing the standard wavelet Bumps and Blocks function for our examples. For what follows you will wish to call these "Bumps" and "Blocks".
Bumps.txt
Blocks.txt
Example 1 - Blocks Site 810
Suppose that we observe, subject to noise, the Blocks function at all sites except 810 which we wish to estimate (here we will use the quasi-Cauchy prior):
set.seed(413)
Sites <- 1:1024
BlocksNoisy <- Blocks + rnorm(1024, sd = sd(Blocks)/7)
BlocksSite810Laplace <- WaveletImpute(Sites, BlocksNoisy, Miss = 810, prior = "laplace", Iter = 5000)
hist(BlocksSite810Laplace$Estimate[1,500:5000])
Hopefully you should obtain a histogram with values close to the underlying functions of 4.20 (the actual imputed values, using the set.seed(413), can be found in BlocksSite810Laplace.txt)
Example 2 - Bumps Site 411
Alternatively, suppose we observe the Bumps function at all sites except 411. Here we use the Laplace prior:
set.seed(414)
Sites <- 1:1024
BumpsNoisy <- Bumps + rnorm(1024, sd = sd(Bumps)/7)
BumpsSite410Laplace <- WaveletImpute(Sites, BumpsNoisy, Miss = 410, prior = "laplace", Iter = 40000)
hist(BumpsSite411$Estimate[1,500:40000])
The results you get can be found in BumpsSite410Laplace.txt
Example 3 - Simulation Study (note this takes ~10 hrs to run completely)
Our simulation study can be run with the code in file
SimulationStudy.R
The results for the Blocks and Bumps function can be found in the files
BlocksResults.txt (with set.seed = 721)
BumpsResults.txt (with set.seed = 335)
2-dimensional lifting scheme imputation
The R code for the lifting scheme has not yet been made public. Once the package has been released then I will include my R code in this portion of my webpage. Currently this is
http://www.stats.ox.ac.uk/~theaton/Papers/WaveletImputation.html
but I am relocating to Sheffield so may change. In the meantime the datasets from the paper can be found as
MaartenfuncData.txt
Rain.txt
For MaartenfuncData.txt, the first and second columns list the (x,y) coordinates of the 100 sampled points. The third column records the value of the underlying Maartenfunc function. The fourth column contains the function after addition of noise (RSNR = 5).
For rain.txt, the data set contains a lot of information which can be understood by reading the necessary help files on the NADP website (http://nadp.sws.uiuc.edu/). For our paper we are only interested in rain$latitude (latitude of the site), rain$longitude (longitude of the site) and rain$X.Precip. (annual rainfall at the site). The data was analysed on a log-scale with a Variance estimate (after taking logs) of 0.05.
T. J. Heaton
Department of Statistics
University of Oxford
1 South Parks Road
Oxford
OX1 3TG
UK
E-mail: theaton@stats.ox.ac.uk
|