Re: [R] HMisc/rms package questions

2010-08-17 Thread David Winsemius


On Aug 17, 2010, at 5:53 PM, Rob James wrote:

1) How does one capture the plots from the plsmo procedure? Simply  
inserting a routing call to a graphical device (such as jpeg, png,  
etc) and then running the plsmo procedure (and then dev.off()) does  
not route the output to the file system. 1b) Related to above, has  
anyone thought of revising the plsmo procedure to use ggplot? I'd  
like to capture several such graphs into a faceted arrangement.


(I don't use plsmo but here's a thought.) Since the rms/Hmisc combo is  
now using lattice for some of its plotting, I wonder if you need to  
add a print call around that plsmo call?


2) The 2nd issue is more about communications than software. I have  
developed a model using lrm() and am using plot to display the  
model. All that is  fairly easy. However, my coauthors are used to  
traditional methods, where baseline categories are rather broadly  
defined (e.g. males, age 25-40, height 170-180cm, BP 120-140, etc)  
and results are reported as odds-ratios, not as probabilities of  
outcomes.


Therefore, and understandably, they are finding the graphs which  
arise from lrm-Predict-plot difficult to interpret. Specifically,  
in one graph, the adjusted to population is defined one way, and in  
another graph of the same model (displaying new predictors) there  
will be a new  adjusted to population.


There is an adj.subtitle (at least I think that's its name) that lets  
you leave off those distracting annotations.


Sometimes the adjusted populations are substantially distinct,  
giving rise to event rates that vary dramatically across graphs.  
This can prove challenging when trying to present the set of graphs  
as parts of a whole.  It all makes sense; it just adds complexity to  
introducing these new methods.


I generally make the effort to educate my audience a bit. I first get  
then to agree that sharp jumps in risk at arbitrarily defined points  
are biologically and scientifically implausible in the extreme. I then  
show them the estimates from spline fits, and then I offer them  
aggregated counts of events and exposure but emphasize I emphasize  
that the the spline fits are a better description of what happens in  
the real world.




One strategy might be to manually define the baseline population  
across graphs; this way I could attempt to impose some content- 
specific coherence to the graphs, by selecting the baseline  
populations. Clearly this is do-able, but I have yet to see it done.  
I'd welcome suggestions and comments.




I have found the ref.zero parameter to be useful with Predict().


Thanks,

Rob


David Winsemius, MD
West Hartford, CT

__
R-help@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.


Re: [R] HMisc/rms package questions

2010-08-17 Thread Frank Harrell



Frank E Harrell Jr   Professor and ChairmanSchool of Medicine
 Department of Biostatistics   Vanderbilt University

On Tue, 17 Aug 2010, Rob James wrote:


1) How does one capture the plots from the plsmo procedure? Simply
inserting a routing call to a graphical device (such as jpeg, png, etc)
and then running the plsmo procedure (and then dev.off()) does not route
the output to the file system. 1b) Related to above, has anyone thought
of revising the plsmo procedure to use ggplot? I'd like to capture
several such graphs into a faceted arrangement.


Hi Rob,

plsmo in Hmisc uses base graphics, and I have captured its output many 
times using pdf() or postscript().


I'll bet that Hadley Wickham has an example that will help.  For 
lattice there is panel.plsmo.




2) The 2nd issue is more about communications than software. I have
developed a model using lrm() and am using plot to display the model.
All that is  fairly easy. However, my coauthors are used to traditional
methods, where baseline categories are rather broadly defined (e.g.
males, age 25-40, height 170-180cm, BP 120-140, etc) and results are
reported as odds-ratios, not as probabilities of outcomes.

Therefore, and understandably, they are finding the graphs which arise
from lrm-Predict-plot difficult to interpret. Specifically, in one
graph, the adjusted to population is defined one way, and in another
graph of the same model (displaying new predictors) there will be a new
adjusted to population. Sometimes the adjusted populations are
substantially distinct, giving rise to event rates that vary
dramatically across graphs. This can prove challenging when trying to
present the set of graphs as parts of a whole.  It all makes sense; it
just adds complexity to introducing these new methods.


I very simple example might help us with this one.

But odds ratios resulting from categorizing continuous variables are 
invalid.  They do not have the claimed interpretation.  In fact they 
have no interpretation in the sense that their interpretation is a 
function of the entire set of sample values.  You can get whatever 
odds ratios you need (with exact interpretations) using summary or 
contrast.  You can also modify plot to plot relative odds, relative to 
something of your choosing.


Frank

 

One strategy might be to manually define the baseline population across
graphs; this way I could attempt to impose some content-specific
coherence to the graphs, by selecting the baseline populations. Clearly
this is do-able, but I have yet to see it done. I'd welcome suggestions
and comments.

Thanks,

Rob

__
R-help@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.



__
R-help@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.