Skip to content
Prev 12628 / 398502 Next

[S] Labels wrong with lrm

On Sat, 28 Jul 2001 fharrell at virginia.edu wrote:

            
I think this can't be fixed in general.  There is simply no way to know
whether pol(age,kx) contains two variables (like interaction(age,kx)) or
one variable, and if so, which is the variable and which the parameter.

The termplot() function has a function carrier.names() that guesses that
the first argument is the only variable, which is a useful heuristic until
you have log(0.5+x) as a term.

You can get the results of all.vars broken down by term like
I(log(0.5 + x)) ~ pol(age, kx) + ns(sbp, df) + factor(race, labels =
races) +
    sex
av[match(all.vars(parse(text=term)),av)])
$"pol(age, kx)"
[1] "age" "kx"

$"ns(sbp, df)"
[1] "sbp" "df"

$"factor(race, labels = races)"
[1] "race"  "races"

$sex
[1] "sex"

(actually you only get the RHS of the formula, but that shouldn't be hard
to fix)

You might also look at how nlme and Jim Lindsey's nonlinear models
functions solve the question of whether a name refers to a a variable or a
parameter.

	-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._