Fit of a Two-Way Table (Formula Method)

DESCRIPTION:

Returns a list containing estimated row and column effects as well as a grand effect and the residuals. The default is to give estimates from a median polish.

USAGE:

twoway.formula(formula=formula(data), data=sys.parent(), subset, 
               na.action, trim=.5, iter=6, eps=<<see below>>, print=F) 

REQUIRED ARGUMENTS:

formula
a formula defining the response and the two predictors. Its form is: z ~ x * y The z variable is a numeric response. Missing values ( NAs) are allowed. The x represents the row variable. The y represents the column variable.

OPTIONAL ARGUMENTS:

data
an optional data frame in which to find the objects mentioned in formula.
subset
expression saying which subset of the rows of the data should be used in the fit. This can be a logical vector (which is replicated to have length equal to the number of observations), or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included.
na.action
a function to filter missing data. This is applied to the model.frame after any subset argument has been used. The default (with na.fail) is to create an error if any missing values are found. A possible alternative is na.omit, which deletes observations that contain one or more missing values.
trim
optional trimming fraction for carrying out the analysis. The default value corresponds to using medians. trim=0 will cause analysis by means, .25 by midmeans, etc.
iter
maximum number of full (both row and column) sweeps.
eps
error tolerance. If eps is given, the algorithm will iterate until the maximum change in row or column effects is less than eps. The default is to iterate until the specified number of iterations or until converged to the accuracy of the machine arithmetic. It is not always possible to converge to a unique answer.
print
logical flag: if TRUE, the maximum change in row/column effects in the last iteration is printed.

VALUE:

list with 4 components, resid, row, col, and grand, such that x[i,j] equals grand + row[i] + col[j] + resid[i,j]
grand
overall location estimate of the data.
row
vector of row effects.
col
vector of column effects.
resid
matrix of residuals from the fit.
call
an image of the call that produced the object.

DETAILS:

This is the formula version of twoway. The response z is converted to a table (matrix) cross classified by the values of x and y. This matrix is then passed to twoway.default. For further details see the twoway documentation.

SEE ALSO:

.

EXAMPLES:

twoway(coal ~ x * y, data=coal.ash)