Wavelet Analysis

Using Symbolic Names

Several of the wavelet subroutines take arguments that are options vectors that specify user input. For example, the third argument in a WAVFT subroutine call is an options vector that specifies which wavelet and which boundary treatment are used in computing the wavelet transform. Typical code that defines this options vector is as follows:

  
     optn    = j(1, 4, .); 
     optn[1] = 0;    
     optn[3] = 1;   
     optn[4] = 3;   

A problem with such code is that it is not easily readable. By using symbolic names readability is greatly enhanced. SAS macro variables provide a convenient mechanism for creating such symbolic names. For example, the previous code could be replaced by the following code:

  
      optn            = &waveSpec;    
      optn[&family]   = &daubechies;   
      optn[&member]   = 3; 
      optn[&boundary] = &zeroExtension; 

where the symbolic macro variables (names with a preceding ampersand) resolve to the relevant quantities. Symbolic names also improve code readability when substituted for integer arguments that control what actions a multipurpose subroutine performs. Consider the following code:

  
     call wavget(n,decomposition,1); 
     call wavget(fWavelet,decompostion,8); 

This code can be replaced by the following statements:

  
     call wavget(n,decomposition,&numPoints); 
     call wavget(fWavelet,decompostion,&fatherWavelet); 

A set of symbolic names is defined in the autocall WAVINIT macro. The following tables list the symbolic names that are defined in this macro.

Table 20.1: Macro Variables for Wavelet Specification

Position

Admissible Values

Name

Value

Name

Value

&boundary

1

&zeroExtension

0

   

&periodic

1

   

&polynomial

2

   

&reflection

3

   

&antisymmetricReflection

4

&degree

2

&constant

0

   

&linear

1

   

&quadratic

2

&family

3

&daubechies

1

   

&symmlet

2

&member

4

1 - 10


Table 20.2: Macro Variables for Threshold Specification

Position

Admissible Values

Name

Value

Name

Value

&policy

1

&none

0

   

&hard

1

   

&soft

2

   

&garrote

3

&method

2

&absolute

0

   

&minimax

1

   

&universal

2

   

&sure

3

   

&sureHybrid

4

   

&nhoodCoeffs

5

&value

3

positive real

&levels

4

&all

-1

   

positive integer


Table 20.3: Symbolic Names for the Third Argument of WAVGET

Name

Value

&numPoints

1

&detailCoeffs

2

&scalingCoeffs

3

&thresholdingStatus

4

&specification

5

&topLevel

6

&startLevel

7

&fatherWavelet

8


Table 20.4: Macro Variables for the Second Argument of WAVPRINT

Name

Value

&summary

1

&detailCoeffs

2

&scalingCoeffs

3

&thresholdedDetailCoeffs

4


Table 20.5: Macro Variables for Predefined Wavelet Specifications

Name

 

&boundary

&degree

&family

&member

 

&waveSpec

{

.

.

.

.

}

&haar

{

&periodic

.

&daubechies

1

}

&daubechies3

{

&periodic

.

&daubechies

3

}

&daubechies5

{

&periodic

.

&daubechies

5

}

&symmlet5

{

&periodic

.

&symmlet

5

}

&symmlet8

{

&periodic

.

&symmlet

8

}


Table 20.6: Macro Variables for Predefined Threshold Specifications

Name

 

&policy

&method

&value

&levels

 

&threshSpec

{

.

.

.

.

}

&RiskShrink

{

&hard

&minimax

.

&all

}

&VisuShrink

{

&soft

&universal

.

&all

}

&SureShrink

{

&soft

&sureHybrid

.

&all

}