EVOLUTION-MANAGER
Edit File: medpolish.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Median Polish (Robust Twoway Decomposition) of a Matrix</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for medpolish {stats}"><tr><td>medpolish {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Median Polish (Robust Twoway Decomposition) of a Matrix</h2> <h3>Description</h3> <p>Fits an additive model (twoway decomposition) using Tukey's <em>median polish</em> procedure. </p> <h3>Usage</h3> <pre> medpolish(x, eps = 0.01, maxiter = 10, trace.iter = TRUE, na.rm = FALSE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>a numeric matrix.</p> </td></tr> <tr valign="top"><td><code>eps</code></td> <td> <p>real number greater than 0. A tolerance for convergence: see ‘Details’.</p> </td></tr> <tr valign="top"><td><code>maxiter</code></td> <td> <p>the maximum number of iterations</p> </td></tr> <tr valign="top"><td><code>trace.iter</code></td> <td> <p>logical. Should progress in convergence be reported?</p> </td></tr> <tr valign="top"><td><code>na.rm</code></td> <td> <p>logical. Should missing values be removed?</p> </td></tr> </table> <h3>Details</h3> <p>The model fitted is additive (constant + rows + columns). The algorithm works by alternately removing the row and column medians, and continues until the proportional reduction in the sum of absolute residuals is less than <code>eps</code> or until there have been <code>maxiter</code> iterations. The sum of absolute residuals is printed at each iteration of the fitting process, if <code>trace.iter</code> is <code>TRUE</code>. If <code>na.rm</code> is <code>FALSE</code> the presence of any <code>NA</code> value in <code>x</code> will cause an error, otherwise <code>NA</code> values are ignored. </p> <p><code>medpolish</code> returns an object of class <code>medpolish</code> (see below). There are printing and plotting methods for this class, which are invoked via by the generics <code><a href="../../base/html/print.html">print</a></code> and <code><a href="../../graphics/html/plot.html">plot</a></code>. </p> <h3>Value</h3> <p>An object of class <code>medpolish</code> with the following named components: </p> <table summary="R valueblock"> <tr valign="top"><td><code>overall</code></td> <td> <p>the fitted constant term.</p> </td></tr> <tr valign="top"><td><code>row</code></td> <td> <p>the fitted row effects.</p> </td></tr> <tr valign="top"><td><code>col</code></td> <td> <p>the fitted column effects.</p> </td></tr> <tr valign="top"><td><code>residuals</code></td> <td> <p>the residuals.</p> </td></tr> <tr valign="top"><td><code>name</code></td> <td> <p>the name of the dataset.</p> </td></tr> </table> <h3>References</h3> <p>Tukey, J. W. (1977). <em>Exploratory Data Analysis</em>, Reading Massachusetts: Addison-Wesley. </p> <h3>See Also</h3> <p><code><a href="median.html">median</a></code>; <code><a href="aov.html">aov</a></code> for a <em>mean</em> instead of <em>median</em> decomposition.</p> <h3>Examples</h3> <pre> require(graphics) ## Deaths from sport parachuting; from ABC of EDA, p.224: deaths <- rbind(c(14,15,14), c( 7, 4, 7), c( 8, 2,10), c(15, 9,10), c( 0, 2, 0)) dimnames(deaths) <- list(c("1-24", "25-74", "75-199", "200++", "NA"), paste(1973:1975)) deaths (med.d <- medpolish(deaths)) plot(med.d) ## Check decomposition: all(deaths == med.d$overall + outer(med.d$row,med.d$col, "+") + med.d$residuals) </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>