Skip to content
Prev 12618 / 398502 Next

[S] Labels wrong with lrm

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:
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"

Frank Harrell
Jan Brogger wrote: