R-alpha: model.matrix(.) does not allow `contrasts' ..

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Thu, 4 Dec 1997 18:23:23 +0100

and this breaks  multinom from the nnet library
	[yes, Kurt, I'm working on that and I'll send you patches..]	

Is this a bug or an (half-)intentional difference to S ?


In R (0.50-0.60)

     model.matrix(formula =, data =)


   formula: A model formula or terms object

      data: A data frame created with `model.frame'

In S-plus

       model.matrix(object, ...)
       model.matrix.default(terms.object, data, contrasts)



  contrasts:     an optional list giving contrasts for some or  all
       of  the  factors  appearing  in  the  terms  object.   The
       elements of the list should have  the  same  name  as  the
       variable   and   should   be   either  a  contrast  matrix
       (specifically, any full-rank matrix with as many  rows  as
       there  are  levels  in  the factor), or else a function to
       compute such a matrix given the  number  of  levels.   The
       complete contrast list (anything given as an argument plus
       any  additional  contrast  matrices  computed)   will   be
       returned as the "contrasts" attribute of the model matrix,
       and hence as the "contrasts" component  of  fitted  models
       returned by lm() and its descendants.
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