Calculate groupwise means, presenting the result as a model in the style of lm.
mm(formula, data = parent.frame(), fun = mean, drop = TRUE, ...)A formula. The left-hand side specifies the variable over
which the mean will be taken. The right-hand side gives the grouping variables,
separated by &.
A data frame to which the formula variables refer. If not specified, variables will be taken from the current environment.
The function used to calculate the means. Default: mean.
Logical flag indicating whether to drop unoccupied groups. Default TRUE.
NOT YET IMPLEMENTED.
Additional arguments to be passed to the fun doing the calculation.
mm returns an object of class groupwiseModel. The functions
fitted.values, residuals, coefficients, and summary
are useful for extracting various features of the value returned by mm
mm is a sort of training function for lm, meant to provide a
basis for discussing inference and introducing resampling in a simple, intuitive setting
of groupwise means. lm provides a better, more general facility. When using
lm to recreate the results of mm, include all the interaction terms,
that is, use * instead of &. See the examples.