[Rd] under certain conditions, model.matrix appears to lack one (PR#648)

ripley@stats.ox.ac.uk ripley@stats.ox.ac.uk
Mon, 28 Aug 2000 13:27:02 +0200 (MET DST)


On Mon, 28 Aug 2000, Rashid Nassar wrote:

> Dear Professor Ripley,
> 
> Thank you very much for your kind explanation.  If I may lamely say
> something in my defence, even as I apologize for my error: I mistook the
> sentence "the (quoted) name of a function" to mean "optionally quoted"
> because of the parentheses surrounding "quoted", and was encouraged by the
> fact that R did not complain when I gave the unquoted form and that it did
> implement a change (although not the desired one), and (even more lamely)
> the fact that none of the examples on the help page show the function
> quoted, although I now realize that in the example the function has an
> argument, and is not given simply the name of the function. 
> 
> Again, thank you for taking the time to reply and point out my mistake.

That was not what I was trying to do!   If this had not already been fixed
as a result of another bug fix, it would be a bug we needed to address.


> 
> Rashid Nassar
> 
> 
> On Mon, 28 Aug 2000, Prof Brian D Ripley wrote:
> 
> > Date: Mon, 28 Aug 2000 07:28:19 +0100 (BST)
> > From: Prof Brian D Ripley <ripley@stats.ox.ac.uk>
> > To: rnassar@duke.edu
> > Cc: r-devel@stat.math.ethz.ch, R-bugs@biostat.ku.dk
> > Subject: Re: [Rd] under certain conditions, model.matrix appears to lack one column (PR#646)
> > 
> > On Sun, 27 Aug 2000 rnassar@duke.edu wrote:
> > 
> > > Dear R Team,
> > > 
> > > # Summary of the problem: setting contrasts as 
> > >    > contrasts(g) <- contr.treatment 
> > > or > contrasts(g) <- matrix(c(1,-1,0),ncol=1)
> > > (i.e. without quotes around `contr.treatment' or `contr.sum', etc.)
> > > and fitting an lm model without an intercept results in a model matrix
> > > that lacks one column.
> > 
> > Right, but first is not allowed by (?contrasts)
> > 
> >      ctr: either a matrix whose columns give coefficients for contrasts
> >           in the levels of `x', or the (quoted) name of a function
> >           which computes such matrices.
> > 
> > and the second is arguably correct: you chose to use only two columns.
> > However, the behaviour is different in the development version, 
> > which does not code x in models such as this, and so does not
> > have the problem.
> > 
> > That is not precisely what S does, but seems a sane way of interpreting the
> > contradictory information given (which is that you don't want an intercept
> > and that you only want two columns for the coding matrix for x!  That
> > applies to the function case too: there the coding matrix is evaluated
> > before knowing if contrast are required, that is using argument contrasts =
> > FALSE).
> > 
> > -- 
> > Brian D. Ripley,                  ripley@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 272860 (secr)
> > Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> > 
> > 
> 

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._