Re: [Rd] Guidelines for writing model term functions (?)

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sat 03 Jul 2004 - 01:15:45 EST


Well, there are examples like log, too, and poly() is a good one.

poly, ns and bs are special because they participate in the safe prediction scheme (?SafePrediction). If you don't need that, just return a vector or matrix (whose columns will be treated as a set of vectors).

On Fri, 2 Jul 2004, Roger D. Peng wrote:

> Are there any general guidelines for writing functions that appear in
> model formulas for functions like lm()/glm()? The ones I can think of
> are ns()/bs() in `splines' and s() in `mgcv'. It seems that ns()/bs()
> basically create matrix with a number of attributes and a class, while
> s() returns a list of parameters. It seems that gam() in `mgcv' has
> its own way of dealing with formulas so maybe that's not a great
> example, but are there any suggestions for writing a function that
> might appear in the formula for, say, lm() or glm()?

-- 
Brian D. Ripley,                  ripley@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

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
Received on Sat Jul 03 01:18:50 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:45:01 EST