One-Dimensional Wavelet Regression Estimation

This section takes you through the features of one-dimensional wavelet regression estimation using one of the Wavelet Toolbox™ specialized tools. The toolbox provides a graphical interface tool to explore some de-noising schemes for equally or unequally sampled data.

For the examples in this section, switch the extension mode to symmetric padding, using the command

dwtmode('sym')

Regression for Equally-Spaced Observations

  1. Start the Regression Estimation 1-D Tool.

    From the MATLAB® prompt, type

    wavemenu
    

    The Wavelet Toolbox Main Menu appears.

    Click the Regression Estimation 1-D menu item. The discrete wavelet analysis tool for one-dimensional regression estimation appears.

  2. Load data.

    From the File menu, choose the Load Data for Fixed Design Regression option.

    When the Load data for Fixed Design Regression dialog box appears, select the MAT-file noisbloc.mat, which should reside in the MATLAB folder toolbox/wavelet/wavedemo.

    Click the OK button. The noisy blocks data is loaded into the Regression Estimation 1-D - Fixed Design tool.

    The loaded data denoted (X,Y) and the processed data obtained after a binning, are displayed.

  3. Choose the processed data.

    The default value for the number of bins is 256 for this example. Enter 64 in the Nb bins (number of bins) edit box, or use the slider to adjust the value. The new binned data to be processed appears.

    The binned data appears to be very smoothed. Select 1000 from the Nb bins edit and press Enter or use the slider. The new data to be processed appears.

    The binned data appears to be very close to the initial data, since noisbloc is of length 1024.

  4. Perform a Wavelet Decomposition of the processed data.

    Select the haar wavelet from the Wavelet menu and select 5 from the Level menu, and then click the Decompose button. After a pause for computation, the tool displays the detail coefficients of the decomposition.

  5. Perform a regression estimation.

    While a number of options are available for fine-tuning the estimation algorithm, we'll accept the defaults of fixed form soft thresholding and unscaled white noise. The sliders located to the right of the window control the level dependent thresholds, indicated by yellow dotted lines running horizontally through the graphs on the left part of the window.

    Continue by clicking the Estimate button.

    You can see that the process removed the noise and that the blocks are well reconstructed. The regression estimate (in yellow) is the sum of the signals located below it: the approximation a5 and the reconstructed details after coefficient thresholding.

    You can experiment with the various predefined thresholding strategies by selecting the appropriate options from the menu located on the right part of the window or directly by dragging the yellow horizontal lines with the left mouse button.

    Let us now illustrate the regression estimation using the graphical interface for randomly or irregularly spaced observations, focusing on the differences from the previous situation.

Regression for Randomly-Spaced Observations

  1. From the File menu, choose the Load > Data for Stochastic Design Regression option. When the Load data for Stochastic Design Regression dialog box appears, select the MAT-file ex1nsto.mat, which should reside in the MATLAB folder toolbox/wavelet/wavedemo. Click the OK button. This short set of data (of size 500) is loaded into the Regression Estimation 1-D -- Stochastic Design tool.

    The loaded data denoted (X,Y), the histogram of X, and the processed data obtained after a binning are displayed. The histogram is interesting, because the values of X are randomly distributed. The binning step is essential since it transforms a problem of regression estimation for irregularly spaced X data into a classical fixed design scheme for which fast wavelet transform can be used.

  2. Select the sym4 wavelet from the Wavelet menu, select 5 from the Level menu, and enter 125 in the Nb bins edit box. Click the Decompose button. The tool displays the detail coefficients of the decomposition.

  3. From the Select thresholding method menu, select the item Penalize low and click the Estimate button.

  4. Check Overlay Estimated Function to validate the fit of the original data.

Importing and Exporting Information from the Graphical Interface

Saving Function

This tool lets you save the estimated function to disk. The toolbox creates a MAT-file in the current folder with a name you choose.

To save the estimated function from the present estimation, use the menu option File > Save Estimated Function. A dialog box appears that lets you specify a folder and filename for storing the function. Type the name fex1nsto. After saving the function data to the file fex1nsto.mat, load the variables into your workspace:

load fex1nsto  
whos 
NameSizeBytesClass
thrParams1x5580cell array
wname1x48char array
xdata1x1251000double array
ydata1x1251000double array

The estimated function is given by xdata and ydata. The length of these vectors is equal to the number of bins you choose in step 2. In addition, the parameters of the estimation process are given by the wavelet name contained in wname:

wname

wname =
    sym4

and the level dependent thresholds contained in thrParams, which is a cell array of length 5 (the level of the decomposition). For i from 1 to 5, thrParams{i} contains the lower and upper bounds of the interval of thresholding and the threshold value (since interval dependent thresholds are allowed). For more information, see One-Dimensional Adaptive Thresholding of Wavelet Coefficients in the Wavelet Toolbox User's Guide.

For example, for level 1,

thrParams{1}

ans = 
    -0.4987 0.4997 1.0395

Loading Data

To load data for regression estimation, your file must contain at least one vector. If your file contains only one vector, this vector is considered as ydata and an xdata vector is automatically generated.

If your file contains at least two vectors, they must be called xdata and ydata or x and y.

These vectors must be the same length.

For example, load the file containing the data considered in the previous example:

clear
load ex1nsto
whos 
NameSizeBytesClass
x1x5004000double array
y1x5004000double array

At the end of this section, turn back the extension mode to zero padding using the command

dwtmode('zpd')
Was this topic helpful?