[R] passing constrasts=FALSE to contrast functions -- why does this exist?

2010-06-11 Thread Nathaniel Smith
Hello, I've noticed that all contrast functions, like contr.treatment, contr.poly, etc., take a logical argument called 'contrasts'. The default is TRUE, in which case they do their normal thing of returning a n x n-1 matrix whose columns are linearly-independent of the intercept. If

[R] The curious special case of ~ (a + b)/c

2010-06-05 Thread Nathaniel Smith
This isn't at all an urgent practical question, but recently while exploring the details of how R formulas are interpreted, I learned of this funny special case for how / interacts with +. In all of the following cases, the multiplication-like operator simply distributes over addition: (a + b):c

Re: [R] The curious special case of ~ (a + b)/c

2010-06-05 Thread Nathaniel Smith
On Sat, Jun 5, 2010 at 2:01 PM, RICHARD M. HEIBERGER r...@temple.edu wrote: The / is used for nesting and is defined by A/B == A + (B %in% A) thus (a+b)/c == (a+b) + c %in% (a+b) == a + b + a:b:c ...I guess I could then ask why %in% is defined that way, but actually this rephrasing somehow