Performs a median polish of two-way data (D.B. Baird).

### Options

`MAXCYCLE` = scalar |
Maximum number of iterations; default 50 |
---|---|

`TOLERANCE` = scalar |
Tolerance for convergence; default 0.0001 |

### Parameters

`DATA` = variates or pointers or matrices or tables |
Two-way data to be polished |
---|---|

`ROWS` = factors |
Row definitions for a `DATA` variate |

`COLUMNS` = factors |
Column definitions for a `DATA` variate |

`ROWEFFECTS` = variate |
Row effects removed from polished results |

`COLEFFECTS` = variate |
Column effects removed from polished results |

`POLISH` = variates or pointers or matrices or tables |
Polished result in same format as `DATA` |

`CENTRE` = scalars |
Estimate of overall centre point |

### Description

`MPOLISH`

performs a median polish of two-way data, supplied by the `DATA`

parameter. This can be a two-dimensional table, a matrix or a pointer of variates. Alternatively, it can be a single variate. The rows and columns are then defined by factors supplied by the `ROWS`

and `COLUMNS`

parameters, or by just the `COLUMNS`

parameter with the data valueS assumed to be sorted into row order within each column.

The `MAXCYCLE`

option sets a limit on the number of iterations. The `TOLERANCE`

option specifies the convergence criterion: convergence occurs when

`ABS(1-SUM(ABS(OldPolish)) / SUM(ABS(NewPolish))) < TOLERANCE`

The polished data can be saved by the `POLISH`

parameter, row effects by the `ROWEFFECTS`

parameter, column effects by the `COLEFFECTS`

parameter, and the overall centre point by the `CENTRE`

parameter.

Options: `MAXCYCLE`

, `TOLERANCE`

.

Parameters: `DATA`

, `ROWS`

, `COLUMNS`

, `ROWEFFECTS`

, `COLEFFECTS`

, `POLISH`

, `CENTRE`

.

### See also

Procedures: `MPOLISH`

, `ROBSSPM`

, `TUKEYBIWEIGHT`

.

Commands for: Calculations and manipulation.

### Example

CAPTION 'MPOLISH example'; STYLE=meta FACTOR [LEVELS=10; VALUES=8(1...10)] Block FACTOR [LABELS=!t(A,B,C,D,E,F,G,H); VALUES=(1...8)10] Treat "Log-Normally distributed effects & residuals" CALCULATE [SEED=130403] TMeans = EXP(GRNORMAL(8; 1; 2)) & [SEED=0] BMeans = EXP(GRNORMAL(10; 0.5; 1)) "Centre Effects around zero" CALCULATE TMeans,BMeans = TMeans,BMeans - MEDIAN(TMeans,BMeans) & Y = NEWLEVELS(Block;BMeans) + NEWLEVELS(Treat;TMeans) +\ EXP(GRNORMAL(80;1;0.5)) MPOLISH [TOLERANCE=0.0001] Y; ROWS=Block; COLUMNS=Treat;\ ROWEFFECTS=Blk_Effects; COLEFFECTS=Trt_Effects;\ POLISH=Residuals; CENTRE=Centre CAPTION 'True and estimated treatment effects'; STYLE=minor PRINT TMeans,Trt_Effects; FIELD=14; DECIMALS=1 CAPTION 'True and estimated block effects'; STYLE=minor PRINT BMeans,Blk_Effects; FIELD=14; DECIMALS=1 "Shade plot of residuals" TABULATE [CLASS=Block,Treat;PRINT=*] Residuals; MEANS=Res_Table DSHADE [TITLE='Residuals from MPOLISH'] Res_Table; PEN=!(4,2); NGROUPS=256