On Sep 29, 2010, at 10:29 , Niels Richard Hansen wrote: > The functions drop.terms and [.terms ignores if the intercept > has been explicitly removed. Is that a deliberate feature?
Perhaps rather an unimplemented one. The root cause is that both functions use reformulate() on the "term.labels" attribute, and there is no way to specify that you want to reformulate into a no-intercept formula. On the other hand, the modeling code will happily proceed with a no-intercept model even if there is no "-1" in formula part of a terms object, e.g. > x <- terms(y~a+b) > attr(x,"intercept") <- 0 > lm(x) Call: lm(formula = x) Coefficients: a b 0.2263 0.4178 > formula(x) y ~ a + b so I suppose that there is no really good excuse not to carry the "intercept" attribute over. As usual, with code as old as this, there is always the risk that something actually relies on current behavior. -- Peter Dalgaard Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@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.