\HeaderA{rcModels}{Fit row-column model to a matrix}{rcModels}
\aliasA{rcModelMedianPolish}{rcModels}{rcModelMedianPolish}
\aliasA{rcModelPLM}{rcModels}{rcModelPLM}
\aliasA{rcModelWPLM}{rcModels}{rcModelWPLM}
\keyword{models}{rcModels}
\begin{Description}\relax
These functions fit row-column effect models to matrices
\end{Description}
\begin{Usage}
\begin{verbatim}
rcModelPLM(y)
rcModelWPLM(y, w)
rcModelMedianPolish(y)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{y}] A numeric matrix
\item[\code{w}] A matrix or vector of weights. These should be non-negative.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
These functions fit row-column models to the specified input
matrix. Specifically the model \deqn{y_{ij} = r_i + c_j +
\epsilon_{ij}}{y_ij = r_i + c_j + e_ij}
with \eqn{r_i}{} and \eqn{c_j}{} as row and column effects
respectively. Note that this functions treat the row effect as
the parameter to be constrained using sum to zero (for
\code{rcModelPLM} and \code{rcModelWPLM}) or median of zero (for
\code{rcModelMedianPolish}).

The \code{rcModelPLM} and \code{rcModelWPLM} functions use a
robust linear model procedure for fitting the model.

The function \code{rcModelMedianPolish} uses the median polish algorithm.
\end{Details}
\begin{Value}
A list with following items:
\begin{ldescription}
\item[\code{Estimates}] The parameter estimates. Stored in column effect then
row effect order
\item[\code{Weights}] The final weights used
\item[\code{Residuals}] The residuals
\item[\code{StdErrors}] Standard error estimates. Stored in column effect
then row effect order
\end{ldescription}
\end{Value}
\begin{Author}\relax
B. M. Bolstad \email{bmb@bmbolstad.com}
\end{Author}
\begin{SeeAlso}\relax
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
col.effects <- c(10,11,10.5,12,9.5)
row.effects <- c(seq(-0.5,-0.1,by=0.1),seq(0.1,0.5,by=0.1))

y <- outer(row.effects, col.effects,"+")
w <- runif(50)

rcModelPLM(y)
rcModelWPLM(y, w)
rcModelMedianPolish(y)

y <- y + rnorm(50)

rcModelPLM(y)
rcModelWPLM(y, w)
rcModelMedianPolish(y)
\end{ExampleCode}
\end{Examples}


