Re: [R] Formula with no intercept

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Wed, 16 Apr 2008 21:18:24 +0100 (BST)

On Wed, 16 Apr 2008, Doran, Harold wrote:

> R may not be giving you what you want, but it is doing the right thing.
> You can change what the base category is through contrasts but you can't
> get the marginal effects for every level of all factors because this
> creates a linear dependence in the model matrix.

I suspect that Time*Group - 1 or Time*(Group-1) come closer to the aim. It is the first factor in the model which is coded without contrasts in a no-intercept model.

Once you include interactions I think the 'convenience' is largely lost, and packages such as multcomp can post-hoc test any (coherent) set of hypotheses you choose, irrespective of the model parametrization.

>> -----Original Message-----
>> From: r-help-bounces_at_r-project.org
>> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Gang Chen
>> Sent: Monday, April 14, 2008 5:38 PM
>> To: r-help_at_stat.math.ethz.ch
>> Subject: [R] Formula with no intercept
>>
>> I'm trying to analyze a model with two variables, one is
>> Group with two levels (male and female), and other is Time
>> with four levels (T1, T2, T3 and T4). And for the convenience
>> of post-hoc testing I wanted to consider a model with no
>> intercept for factor Time, so I tried formula
>>
>> Group*(Time-1)
>>
>> However this seems to give me the following terms in the model
>>
>> GroupMale, GroupFemale, TimeT2, TimeT3, TimeT4,
>> GroupMale:TimeT2, GroupMale:TimeT3, GroupMale:TimeT4,
>> GroupFemale:TimeT2, GroupFemale:TimeT3, GroupFemale:TimeT4
>>
>> which is not exactly what I wanted. Also it seems (Group-1)*Time and
>> (Group-1)*(Time-1) also give me exactly the same set of terms
>> as Group*(Time-1).
>>
>> So I have some conceptual trouble understanding this. And how
>> could I create a model with terms including all the levels of
>> factor Time?
>>
>> Thanks,
>> Gang
>>
>> ______________________________________________
>> R-help_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
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

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 16 Apr 2008 - 20:35:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 Apr 2008 - 17:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive