public class ScaleFilterEx1 extends Object
Applies scaling methods to three data sets.
In this example three sets of data, \(X_0\), \(X_1\), and \(X_2\) are scaled using the methods described in the following table:
Variables and Scaling Methods
Variable | Method | Description |
\(X_0\) |
\(0\) |
No Scaling |
\(X_1\) |
\(4\) |
Bounded \(Z\)-score scaling using the mean and standard deviation of \(X_1\) |
\(X_2\) |
\(5\) |
Bounded \(Z\)-score scaling using the median and mean absolute deviation (MAD) of \(X_2\) |
The bounds, measures of center and spread for \(X_1\) and \(X_2\) are:
Scaling Limits and Measures of Center and Spread
Variable |
Real Limits |
Target Limits |
Measure of Center |
Measure of Spread |
\(X_1\) |
\((-6, +6)\) |
\((-3, +3)\) |
\(3.4\) |
\(1.7421\) |
\(X_2\) |
\((-3, +3)\) |
\((-3, +3)\) |
\(2.4\) |
\(1.3343\) |
The real and target limits are used for bounded scaling. The measures of center and spread are used to calculate z-scores. Using these values for \(x_1[0]=3.5\) yields the following calculations:
For \(x_1[0]\) the scale factor is calculated using the real and target limits in the above table:
$$r = (3-(-3))/(6-(-6)) = 0.5$$The z-score for \(x_1[0]\) is calculated using the measures of center and spread:
$$z_1[0] = (3.5 - 3.4)/1.7421 = 0.057402$$Since method=4 is used for \(x_1\), this z-score is bounded (scaled) using the real and target limits:
$$z_1(bounded) = r(z_1[0]) - r(\text{realMin}) + \text{targetMin}$$ $$ = 0.5(0.057402) - 0.5(-6) + (-3) = 0.029$$The calculations for \(x_2[0]\) are nearly identical, except that since method=5 for \(x_2\), the median and MAD replace the mean and standard deviation used to calculate \(z_1(bounded):\) $$r = (3-(-3))/(3-(-3)) = 1$$ $$z_2[0] = (3.1 - 2.4)/1.3343 = 0.525$$ $$ z_2(bounded) = r(z_2[0]) - r(\text{realMin}) + \text{targetMin}$$ $$ = 1(0.525) - 1(-3) + (-3) = 0.525$$
Constructor and Description |
---|
ScaleFilterEx1() |
public static void main(String[] args)
Copyright © 2020 Rogue Wave Software. All rights reserved.