Hi, Figure 13 of Emmanuel Paradis's "R for Beginners" was produced by termplot working on an aov object. The lower right-hand plot is labelled "Cook's distance plot", and I'd really like to produce a similar type of figure, but in a totally different context. (I'm not even sure what this kind of figure is called, perhaps an "impulse plot", where instead of a point at (x,y), there's a vertical bar running from the x-axis up to where the point would be). Can anyone give me pointers on where to look for more info. I've had a look in the places I could think of (plot.lm.R, termplot.R, plot.R, aov.R), and couldn't find anything. Maybe I overlooked it? Thanks -Frank Gibbons PhD, Computational Biologist, Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA. Tel: 617-432-3555 Fax: 617-432-3557 http://llama.med.harvard.edu/~fgibbons
On Thu, 28 Aug 2003, Frank Gibbons wrote:> Hi, > > Figure 13 of Emmanuel Paradis's "R for Beginners" was produced by termplot > working on an aov object. The lower right-hand plot is labelled "Cook's > distance plot", and I'd really like to produce a similar type of figure, > but in a totally different context. (I'm not even sure what this kind of > figure is called, perhaps an "impulse plot", where instead of a point at > (x,y), there's a vertical bar running from the x-axis up to where the point > would be).Often called an `index plot'. It's done by plot(type="h"). R seems to think that is `histogram-like', but the notation comes from S which calls it `high-density lines'. I've never found either intuitive notation.> Can anyone give me pointers on where to look for more info. I've had a look > in the places I could think of (plot.lm.R, termplot.R, plot.R, aov.R), and > couldn't find anything. Maybe I overlooked it?I suspect it was done by plot.lm(which=4), which does an index plot of Cook's distance. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On Thu, 28 Aug 2003, Frank Gibbons wrote:> Hi, > > Figure 13 of Emmanuel Paradis's "R for Beginners" was produced by termplot > working on an aov object.No, it was produced by plot() working on a aov object, as its caption indicates. The termplot() is Figure 14.> The lower right-hand plot is labelled "Cook's > distance plot", and I'd really like to produce a similar type of figure, > but in a totally different context. (I'm not even sure what this kind of > figure is called, perhaps an "impulse plot", where instead of a point at > (x,y), there's a vertical bar running from the x-axis up to where the point > would be).It's called a high-density plot, and you get it by specifying type="h" in a plot() command. It's mentioned on page 31 of `R for beginners' It is in the code for plot.lm, where you say you also looked: the cook's distance plot is created with plot(cook, type = "h", ylim = c(0, ymx), main = main, xlab = "Obs. number", ylab = "Cook's distance", ...) -thomas
Thanks to all who responded, and so promptly too: it works exactly as you describe.> > > > Figure 13 of Emmanuel Paradis's "R for Beginners" was produced by termplot > > working on an aov object. > >No, it was produced by plot() working on a aov object, as its caption >indicates. The termplot() is Figure 14.Thomas Lumley is quite right, it's produced by plot() (not termplot()), and it is mentioned on p31 of "R for beginners". My mistake. In the interest of self education, is there a more comprehensive source for plot-types that I should read? Ideally, this would be something with lots of figures, so that I could browse the figures to find what I want to do, and then look up how to do it. "R for Beginners" goes some way along this path, but perhaps there's something more comprehensive? Thanks again, -Frank PhD, Computational Biologist, Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA. Tel: 617-432-3555 Fax: 617-432-3557 http://llama.med.harvard.edu/~fgibbons
I'm (relatively) new to R myself, and recently found the documentation by Dr. William Cleveland et al at http://cm.bell-labs.com/cm/ms/departments/sia/project/trellis/ http://cm.bell-labs.com/cm/ms/departments/sia/project/trellis/software.writi ng.html It has been helpful, and covers S/Splus trellis graphics. In R, the equivalent is known as "lattice" graphics, and the syntax is virtually identical. Earlier today, Dr. Peter Dunn posted a notice to the R listserv announcing a workshop in Australia being led by Dr. John Maindonald... in that announcement, you will find "...John Maindonald, the author of the forthcoming book 'Data Analysis and Graphics Using R: An Example-Based Approach' (with John Braun)..." so apparently there is a forthcoming book detailing the graphical capabilities of R. I'm eagerly awaiting the opportunity to buy it and digest its contents! Until then, I think the links to the .ps and .pdf files above should serve well. Best wishes, david paul P.S. - You should keep in mind that there are two classes of graphical functions in S/Splus/R: "regular" functions and "trellis/lattice" functions. They operate very differently. After using a few of each, I must say that I am very impressed with the power and flexibility of the trellis/lattice plotting functions. -----Original Message----- From: Frank Gibbons [mailto:fgibbons at hms.harvard.edu] Sent: Thursday, August 28, 2003 1:53 PM To: R users Subject: Re: [R] Cook-distance-type plot (vertical bars) Thanks to all who responded, and so promptly too: it works exactly as you describe.> > > > Figure 13 of Emmanuel Paradis's "R for Beginners" was produced by > > termplot working on an aov object. > >No, it was produced by plot() working on a aov object, as its caption >indicates. The termplot() is Figure 14.Thomas Lumley is quite right, it's produced by plot() (not termplot()), and it is mentioned on p31 of "R for beginners". My mistake. In the interest of self education, is there a more comprehensive source for plot-types that I should read? Ideally, this would be something with lots of figures, so that I could browse the figures to find what I want to do, and then look up how to do it. "R for Beginners" goes some way along this path, but perhaps there's something more comprehensive? Thanks again, -Frank PhD, Computational Biologist, Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA. Tel: 617-432-3555 Fax: 617-432-3557 http://llama.med.harvard.edu/~fgibbons ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Apparently Analagous Threads
- possible bug in merge with duplicate blank names in 'by' field.
- LDA in R: how to extract full equation, especially constant term
- Using RSPerl with add-on package ctest and named parameters
- lda source code
- Trouble building R2.1.0 from source on Linux: package VR