[R] terms.formula
ripley@stats.ox.ac.uk
ripley at stats.ox.ac.uk
Mon Mar 10 13:43:05 CET 2003
On Mon, 10 Mar 2003, Roger Koenker wrote:
> I'm in the very initial stage of expanding the formula processing
> in my quantile regression function rq() to handle additive
> nonparametric components, say qss(x), or qss(x,z). I need some
> advice about strategy for formula processing. My initial foray
> was to use:
>
> terms(formula,specials="qss")
>
> and then modify the components of the resulting
> terms.object. But in changing formula at factors to drop the qss
> columns and rows, I ran afoul of methodsPackageMetaName
> which claimed that it was "being abused" by this.
That means it is being called with incorrect arguments (and you are using
without saying so R-devel aka `1.7.0 Under development (unstable)', for
which the R-devel is a more appropriate list).
I am really puzzled though: formula and terms are not S4 classes, so
why are you using formula at specials and formula at factors? A terms
object is documented in ?terms.object, and it does not have slots.
@ is *not* the operator to access attributes, and I think this is
quite correctly termed "being abused".
>
> if(!is.null(attr(formula,"specials"))){
> qss.col <- pmatch("qss",attr(formula,"term.labels"))
> qss.row <- formula at specials$qss
> formula at factors <- formula at factors[-qss.row,-qss.col,drop=FALSE]
> }
>
> My eventual objective is to be able to make the model.matrix
> corresponding to the linear, parametric part of the formula specified,
> and then to cbind additional columns corresponding to the
> nonparametric components and pass the whole thing to rq.fit.xxx,
> where estimation will be handled. So the essential question at
> this point is: how should I go about stripping off the qss
> components for subsequent use.
Access the attributes with the correct accessor functions and this should
be possible.
--
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
More information about the R-help
mailing list