s-news
[Top] [All Lists]

Re: [R] Re: Labels wrong with lrm

To: "S-NEWS (E-post)" <s-news@lists.biostat.wustl.edu>
Subject: Re: [R] Re: Labels wrong with lrm
From: fharrell@virginia.edu
Date: Sat, 28 Jul 2001 14:03:40 -0400
Cc: rhelp <r-help@stat.math.ethz.ch>
Organization: University of Virginia
References: <Pine.GSO.4.31.0107281741540.23951-100000@toucan.stats>
Right Brian, I don't see it as a limitation, 
but an extension would be helpful.  An option to
all.vars to produce a list of vectors containing
names for variables in each "term" would be
especially helpful.  -Frank

P.S.  Thanks for pointing out also that all.vars
is in S - I had missed that.


Prof Brian Ripley wrote:
> 
> On Sat, 28 Jul 2001 fharrell@virginia.edu wrote:
> 
> > Dear Jan,
> >
> > Thank you very much for your excellent description of the
> > problem and the self-contained test code.  This is a
> > problem that I've been meaning to either document better
> > or solve for some time.  The root of the problem is with
> > the builtin S-Plus terms.inner function:
> >
> > > attr(terms.inner(asthma ~ pol(age,kx) + smok),'variables')
> > expression(age, kx, smok)
> >
> > You can see that terms.inner inappropriately includes kx
> > as an independent variable as it does not know that
> > the first argument to pol is the special variable.
> > When a constant replaces kx, all is well.
> >
> > As I am relying on the C code called by terms.inner to
> > do the job, I don't have a ready solution.  I would
> > be happy if someone comes up with a solution.  The
> > all.vars function in the R language has the same
> > limitation:
> >
> > all.vars(asthma ~ pol(age,kx) + smok)
> > [1] "asthma" "age"   "kx"   "smok"
> 
> Well,
> 
> 1) all.vars comes from S, and works the same under R.
> 
> 2) I don't think it is a limitation.  all.vars is described as
> 
> Description:
> 
>      Return a character vector containing all the names which occur in
>      an expression or call.
> 
> and kx is such a name.  Indeed, there is no way to know from just the
> formula if it is length n-vector or a scalar.   I don't know what pol()
> is, but guess it is from your library, in which case the interpretation
> may well depend on where (if anywhere) that library is in the search path.
> 
> If you want special-purpose names in formulae (like strata) you need to
> extend the formula-handling code.  Neither S4 nor R make that easy.
> 
> Brian
> 
> --
> 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 272860 (secr)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> 
> ---------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu.  To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>