Hi, I wonder if anyone has written any code to implement the suggestions of Smart et al (2004) in the Bulletin of the Ecological Society of America for a new way of graphically presenting the results of logistic regression (see www.esapubs.org/bulletin/backissues/085-3/bulletinjuly2004_2column.htm#t ools1 for the full text)? I couldn't find anything relating to this sort of graphical representation of logistic models in the archives, but maybe someone has solved it already? In short, Smart et al suggest that a logistic regression be presented as a combination of the two histograms for successes and failures (with one presented upside down at the top of the figure, the other the right way up at the bottom) overlaid by the probability function (ie logistic curve). It's somewhat hard to describe, but is nicely illustrated in the full text version above. I think it is a sensible way of presenting these results and am keen to do so - at the moment I can only do this by generating the two histograms and the logistic curve separately (using hist() and lines()), then copying and pasting the graphs out of R and inverting one in a graphics package, before overlying the others. I'm sure this could be done within R and would be a handy plotting function to develop. Has anyone done so, or can anyone give me any pointers to doing this? I really nead to know how to invert a histogram and how to overlay this with another histogram "the right way up". Any thoughts would be welcome. Thanks in advance, Colin ...
Beale, Colin wrote:> Hi, > > I wonder if anyone has written any code to implement the suggestions of > Smart et al (2004) in the Bulletin of the Ecological Society of America > for a new way of graphically presenting the results of logistic > regression (see > www.esapubs.org/bulletin/backissues/085-3/bulletinjuly2004_2column.htm#t > ools1 for the full text)? I couldn't find anything relating to this sort > of graphical representation of logistic models in the archives, but > maybe someone has solved it already? In short, Smart et al suggest that > a logistic regression be presented as a combination of the two > histograms for successes and failures (with one presented upside down at > the top of the figure, the other the right way up at the bottom) > overlaid by the probability function (ie logistic curve). It's somewhat > hard to describe, but is nicely illustrated in the full text version > above. I think it is a sensible way of presenting these results and am > keen to do so - at the moment I can only do this by generating the two > histograms and the logistic curve separately (using hist() and lines()), > then copying and pasting the graphs out of R and inverting one in a > graphics package, before overlying the others. I'm sure this could be > done within R and would be a handy plotting function to develop. Has > anyone done so, or can anyone give me any pointers to doing this? I > really nead to know how to invert a histogram and how to overlay this > with another histogram "the right way up". > > Any thoughts would be welcome. >My reaction was that I had seen some R code in a Bulletin of the ESA that someone sent me. A quick search revealed this: <http://www.esapubs.org/bulletin/backissues/086-1/bulletinjan2005.htm#et> which has the code. Bob -- Bob O'Hara Dept. of Mathematics and Statistics P.O. Box 68 (Gustaf H??llstr??min katu 2b) FIN-00014 University of Helsinki Finland Telephone: +358-9-191 51479 Mobile: +358 50 599 0540 Fax: +358-9-191 51400 WWW: http://www.RNI.Helsinki.FI/~boh/ Journal of Negative Results - EEB: http://www.jnr-eeb.org
Frank E Harrell Jr
2005-Sep-14 11:29 UTC
[R] Graphical presentation of logistic regression
Beale, Colin wrote:> Hi, > > I wonder if anyone has written any code to implement the suggestions of > Smart et al (2004) in the Bulletin of the Ecological Society of America > for a new way of graphically presenting the results of logistic > regression (see > www.esapubs.org/bulletin/backissues/085-3/bulletinjuly2004_2column.htm#t > ools1 for the full text)? I couldn't find anything relating to this sort > of graphical representation of logistic models in the archives, but > maybe someone has solved it already? In short, Smart et al suggest that > a logistic regression be presented as a combination of the two > histograms for successes and failures (with one presented upside down at > the top of the figure, the other the right way up at the bottom) > overlaid by the probability function (ie logistic curve). It's somewhat > hard to describe, but is nicely illustrated in the full text version > above. I think it is a sensible way of presenting these results and am > keen to do so - at the moment I can only do this by generating the two > histograms and the logistic curve separately (using hist() and lines()), > then copying and pasting the graphs out of R and inverting one in a > graphics package, before overlying the others. I'm sure this could be > done within R and would be a handy plotting function to develop. Has > anyone done so, or can anyone give me any pointers to doing this? I > really nead to know how to invert a histogram and how to overlay this > with another histogram "the right way up". > > Any thoughts would be welcome. > > Thanks in advance, > ColinFrom what you describe, that is a poor way to represent the model except for judging discrimination ability (if the model is calibrated well). Effect plots, odds ratio charts, and nomograms are better. See the Design package for details. -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University
On Wed, 14 Sep 2005, Beale, Colin wrote:> Hi, > > I wonder if anyone has written any code to implement the suggestions of > Smart et al (2004) in the Bulletin of the Ecological Society of America > for a new way of graphically presenting the results of logistic > regression (see > www.esapubs.org/bulletin/backissues/085-3/bulletinjuly2004_2column.htm#t > ools1 for the full text)? I couldn't find anything relating to this sort > of graphical representation of logistic models in the archives, but > maybe someone has solved it already? In short, Smart et al suggest that > a logistic regression be presented as a combination of the two > histograms for successes and failures (with one presented upside down at > the top of the figure, the other the right way up at the bottom) > overlaid by the probability function (ie logistic curve). It's somewhat > hard to describe, but is nicely illustrated in the full text version > above. I think it is a sensible way of presenting these results and am > keen to do so - at the moment I can only do this by generating the two > histograms and the logistic curve separately (using hist() and lines()), > then copying and pasting the graphs out of R and inverting one in a > graphics package, before overlying the others. I'm sure this could be > done within R and would be a handy plotting function to develop. Has > anyone done so, or can anyone give me any pointers to doing this? I > really nead to know how to invert a histogram and how to overlay this > with another histogram "the right way up". >I think if you take a peek at hist.default you will find it is pretty straightforward. All that happens in hist.default is there is a lot of stuff about choosing the breaks for the bins, then some C code is called to get the counts, then the information is assembled and plot is called where the object plotted is of class histogram. If you then look at plot.histogram (getAnywhere(plot.histogram)) you find all it really does is plot some rectangles. Just change the plotting bit. If you want an example of how it might be done, you can look at log.hist in my package HyperbDist (or a more recent version logHist.R on my homepage at http://www.stat.auckland.ac.nz/~dscott/) David Scott _________________________________________________________________ David Scott Department of Statistics, Tamaki Campus The University of Auckland, PB 92019 Auckland NEW ZEALAND Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000 Email: d.scott at auckland.ac.nz Graduate Officer, Department of Statistics
Marcelino de la Cruz
2005-Sep-16 15:29 UTC
[R] Graphical presentation of logistic regression
As an anecdotical information about the paper in the ESA Bulletin, the data to graph the examples are from Jari Oksanen's package gravy. Unfortunately, the graphs were not well edited and even my favourite one (fig. 3) was completely missing. You can see in the Erratum from volume 86(2) http://www.esapubs.org/bulletin/backissues/086-2/et_bulletin86_2print.pdf what I was trying to represent. The code only tries to efficiently represent raw data in the traditional logistic plot that most ecologist are familiar with. Cheers Marcelino