[R] Extracting P-values from the lrm function in the rms library

From: Josh B <joshb41_at_yahoo.com>
Date: Fri, 18 Jun 2010 19:14:05 -0700 (PDT)

Hello again R users,

I have a devilishly hard problem, which should be very simple. I hope someone out there will have the answer to this on the tip of their tongue.

Please consider the following toy example:

x <- read.table(textConnection("y x1 x2

indv.1 bagels 4 6
indv.2 donuts 5 1
indv.3 donuts 1 10
indv.4 donuts 10 9
indv.5 bagels 0 2
indv.6 bagels 2 9
indv.7 bagels 8 5
indv.8 bagels 4 1
indv.9 donuts 3 3
indv.10 bagels 5 9
indv.11 bagels 9 10
indv.12 bagels 3 1
indv.13 donuts 7 10
indv.14 bagels 2 10
indv.15 bagels 9 6"), header = TRUE)

I am fitting a polynomial model to this dataset, namely:

mod.poly3 <- lrm(y ~ pol(x1, 3) + pol(x2, 3), data=x)

Here's my problem. If I look at the output, I can see a list of P-values (try typing "mod.poly3" and enter to see what I mean). But... how do I access this list of P-values? What I mean is, how can I "liberate" this list of P-values from the full output? How do I turn that list of P-values into a vector, for example, that I can save off to a file, by itself?

Specific code that gets the job done is what I'm after. Be wary of the anova() command. It gives DIFFERENT output than what I want. I want EXACTLY the list of P-values I see when I type "mod3.poly" and enter.

I have googled this problem, and none of the answers actually give me the output I'm asking for here. Specifically, I found these links -- all dead-ends:

https://stat.ethz.ch/pipermail/r-help/2005-August/078210.html <== Nope. Doesn't give right output.
http://r.789695.n4.nabble.com/extracting-p-value-from-an-lrm-object-td854071.html <== Nope. The output is different.
http://www.mathkb.com/Uwe/Forum.aspx/stat-consult/1381/Extracing-p-values-from-lrm-object <== Nope. Wrong output.

Can anyone crack this seemingly simple problem? Surprisingly the answer was not revealed using str(mod3.poly) either.

Thanks in advance,

Josh Banta, Ph.D
Center for Genomics and Systems Biology
New York University
100 Washington Square East
New York, NY 10003
Tel: (212) 998-8465
	[[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 19 Jun 2010 - 06:59:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 19 Jun 2010 - 12:10:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive