[R] "/" operator in model formula
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Nov 12 17:00:16 CET 2003
On Wed, 12 Nov 2003, Landis, R Matthew wrote:
> Dear R-help folks,
>
> Can someone guide me to a source where I can learn more about the / operator
> in model formulae? I found a reference to it in Venables and Ripley's MASS,
> p. 142, where it says, in reference to ANCOVA: "Terms of the form a/x,
> where a is a factor, are best thought of as 'separate regression models of
> type 1 + x within the levels of a.'..."
See p.150 for a/b where b is a factor.
> This seems very appropriate to my analysis, where I am doing an ANCOVA of
> tree growth as a function of tree height (ht - continuous) separately for
> three species (spp) and three light levels (lt). The problem is, I'm not
> exactly sure how to interpret the results of this model specification, and I
> can't find any other references to it despite doing searches in the help
> pages, Google, Jonathon Baron's R site search, and other text books such as
> Dalgaard or Crawley.
>
> I've fit the model as: growth ~ spp*lt / ht -1, and compared the results to
> growth ~ spp*lt*ht.
>
> The coefficients are equivalent in both models, producing identical plots of
> predicted values. but the terms that appear in the summary table differ, as
> do the P-values, and I'm not sure how to interpret them. In the more
> standard model (growth ~ spp*lt*ht), I am clear on the fact that each level
> of the main effects is compared to the lowest level of that main effect
> (when using contr.treatment). But the alternative model (growth ~spp*lt /
> ht -1) contains all three levels of the main effect, spp.
That is caused by the -1.
The difference is between testing and crossing. In a / b the levels
of b are unrelated for different levels of a, whereas in a*b they are the
same levels.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list