medpolish
Median Polish of a Matrix
Description
Tukey's median polish on a matrix.
Usage
medpolish(x, eps = 0.01, maxiter = 10, trace.iter = TRUE, na.rm = FALSE)
## S3 method for class 'medpolish':
print(x, digits = getOption("digits"), ...)
Arguments
x |
a numeric matrix. NAs are accepted.
|
eps |
a real number to specify the tolerance of convergence.
|
maxiter |
the maximal iteration number.
|
trace.iter |
a logical value. If TRUE (the default), each iteration number and
sum of the absolute residuals are printed.
|
na.rm |
a logical value. If TRUE, NAs are ignored.
If FALSE (the default), if there are NAs in the data, an error message is displayed.
|
x |
Usually an object produced by the medpolish function.
For print.medpolish, an object of class "medpolish".
|
digits |
For print.medpolish, the number of significant digits to display
when printing the output of medpolish.
|
Details
The Tukey median polish algorithm is described in the reference, Tukey, J. W. (1977).
The basic procedure is to decompose the original matrix
x into additive components:
- the overall effect.
- the row effects.
- the column effects.
- the residuals matrix.
If the sum of absolute residuals is not equal to zero, and if the ratio of its reduction is not less than
eps,
then the procedure above is iterated on the residuals matrix until it gets to the maximal iteration.
Value
returns an object of class "
medpolish" with following named components:
overall |
an overall constant value.
|
row |
a vector of row effects.
|
col |
a vector of column effects.
|
name |
the name of the dataset.
|
References
Tukey, J. W. 1977. Exploratory Data Analysis. Reading, MA: Addison-Wesley Pub.
See Also
Examples
x <- rbind(c(2.31, 4.5, 3.6, 1.2, 3.0),
c(4.4, 3.3, 4.1, 2.45, 6.2),
c(1.1, 4.3, 5.2, 3.7, 5.33))
medpolish(x)