[Rd] Bugs? when dealing with contrasts

Gabor Grothendieck ggrothendieck at gmail.com
Thu Apr 22 13:30:16 CEST 2010


On Thu, Apr 22, 2010 at 2:32 AM, Peter Dalgaard <pdalgd at gmail.com> wrote:
> Gabor Grothendieck wrote:
>> On Wed, Apr 21, 2010 at 4:26 PM, Peter Dalgaard <pdalgd at 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.
>

OK. Thanks.  I guess that's fair.

> (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.mes at cbs.dk  Priv: PDalgd at gmail.com
>



More information about the R-devel mailing list