Variable Transformations |
Many statistical analyses assume that the data are normally distributed. If a variable is not normally distributed, it is often possible to improve normality by using an appropriate transformation of the variable. The three transformations used most often for this purpose are the logarithmic, square root, and inverse transformations.
The following steps apply a logarithmic transformation to the driltime variable of the Miningx data set. Because the driltime variable is nonnegative, a logarithmic transformation is well-defined.
Select Graph Histogram from the main menu and create a histogram of the driltime variable.
The histogram is shown in Figure 32.1.
Clearly, the driltime variable is not normally distributed. You might explore whether some transformation of driltime is approximately normal. To begin, you might try a logarithmic transformation.
Select Analysis Variable Transformation from the main menu.
The Variable Transformation wizard in Figure 32.2 appears.
The first page of the wizard enables you to select a transformation family and a specific transformation within that family. The logarithmic transformation is available from several items in the Family list, including the Common family. This transformation is of the form , so you need to specify the variable and the parameter .
The transformation log(Y+a) is highlighted by default. Since this is the desired transformation, you can proceed to the next page of the wizard.
Click Next.
The wizard displays the page shown in Figure 32.3. Note that the transformation appears on the page’s title bar.
Select the driltime variable, and click Set Y.
The parameter is an offset that is useful if your variable contains nonpositive values. For these data, you can accept the default value of .
Click Next.
The wizard displays the page shown in Figure 32.4. You can use this page to specify a variable name (and, optionally, a label) for the new variable.
For this example, you can accept the default variable name.
Click Finish.
SAS/IML Studio adds the new variable, Log_driltime, as the last variable in the data set. You can horizontally scroll through the data table to see the variable.
To complete this example, you can visualize the distribution of the new variable. Select Graph Histogram from the main menu and create a histogram of the Log_driltime variable.
The histogram shows improved normality, but the transformed data distribution is still skewed to the right. (See Figure 32.5.)
Copyright © SAS Institute, Inc. All Rights Reserved.