Median smoother

This macro calculates a median smoother with a default span of 3. The 1st observation of the smoothed data is the median of the 1st 3 data points (X1, X2, X3). The 2nd observation of the smoothed data is the median of the (X2, X3, X4). The 3rd observation is the median of (X3, X4, X5)… Thus, the smoothed data shows a moving median of the original data.

Download the Macro

Be sure that Minitab knows where to find your downloaded macro. Choose File > Options > General. Under Macro location browse to the location where you save macro files.

Important

If you use an older web browser, when you click the Download button, the file may open in Quicktime, which shares the .mac file extension with Minitab macros. To save the macro, right-click the Download button and choose Save target as.

Required Inputs

  • One or more columns of data to be smoothed
  • An equivalent number of empty columns to store the results

Optional Inputs

SPAN K
Use to specify a span other than the default of 3. The span equals the number of observations used to calculate the median.
Note

With the span = 3, the next to the last smoothed value is the median of the last 2 data values. The last smoothed value is equal to the last data value.

Running the Macro

Suppose you have data to be smoothed in C2, C3, and C4 and you want to store the smoothed data in C5, C6, and C7.To run the macro, choose View > Command Line/History and type:

 %MEDSMOOTH C2 - C4;
 STORE C5 - C7.

Click Run.