[Rd] bug in dummy.coef.lm? (PR#1048)
Prof Brian Ripley
Fri, 10 Aug 2001 12:56:02 +0100 (BST)
On Fri, 10 Aug 2001 email@example.com wrote:
> Hi -
> I'm running R 1.3.0 on i686-pc-linux-gnu
> > rm(x, y, z)
> > df <- data.frame(x=1:20,y=1:20,z=factor(1:20 <= 10))
> dummy.coef falls over:
> > dummy.coef.lm(lm(y ~ z * poly(x,1), data=df))
> Error in poly(x, 1): Object "x" not found
> > dummy.coef.lm(lm(y ~ z * I(x), data=df))
> Error in unique(c("AsIs", class(x))): Object "x" not found
> but works OK with:
> > dummy.coef.lm(lm(y ~ z * x, data=df))
> > dummy.coef.lm(lm(y ~ poly(x,1), data=df))
> > dummy.coef.lm(lm(y ~ I(x), data=df))
> > x <- df$x
> > y <- df$y
> > z <- df$z
> > dummy.coef.lm(lm(y ~ z * poly(x,1)))
> > dummy.coef.lm(lm(y ~ z * I(x)))
Not for me it doesn't ...
This is a known design problem: it's been like it for three years.
I think I know how to solve it ....
Note: ?dummy.coef says
There will be
little point in using `dummy.coef' for `contr.treatment'
contrasts, as the missing coefficients are by definition zero.
and what are the default contrasts in R?
Brian D. Ripley, firstname.lastname@example.org
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: email@example.com