[R] terms.formula
Roger Koenker
roger at ysidro.econ.uiuc.edu
Mon Mar 10 13:21:38 CET 2003
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.
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.
url: www.econ.uiuc.edu Roger Koenker Dept. of Economics UCL,
email rkoenker at uiuc.edu Department of Economics Drayton House,
vox: 217-333-4558 University of Illinois 30 Gorden St,
fax: 217-244-6678 Champaign, IL 61820 London,WC1H 0AX, UK
vox: 020-7679-5838
More information about the R-help
mailing list