Gabor Grothendieck wrote:
> On Wed, Apr 21, 2010 at 4:26 PM, Peter Dalgaard <pda...@gmail.com> wrote:
...
>> I.e., that R reverts to using indicator variables when the intercept is
>> absent.
> 
> Is there any nice way of getting contr.sum coding for the interaction
> as opposed to the ugly code in my post that I used to force it? i.e.
> cbind(1, model.matrix(~ fac)[,2:3] * scores)

I think not. In general, an interaction like ~fac:scores indicates three
lines with a common intercept and three different slopes, and changing
the parametrization is not supposed to change the model, whereas your
model inserts a restriction that the slopes sum to zero (if I understand
correctly). So if you want to fit "ugly" models, you get to do a little
ugly footwork.

(A similar, simpler, issue arises if you want to have a 2x2 design with
no effect in one column and/or one row (think clinical trial, placebo
vs. active, baseline vs. treated. You can only do this us explicit dummy
variables, not with the two classifications represented as factors.)


-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd....@cbs.dk  Priv: pda...@gmail.com

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to