[R] where is "average shifted histogram"?

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jul 29 09:59:04 CEST 2004

On 29 Jul 2004, Peter Dalgaard wrote:

> Eckart Bindewald <eckart_bindewald at yahoo.de> writes:
> > Hello!
> > In the book Modern Applied Statistics with S (4th ed),
> > section 5.6 the concept of the "average shifted
> > histogram" or ASH is mentionend. Also it is mentioned
> > in the same section "The code used is in the scripts
> > for this chapter" (from figure caption 5.8, analysis
> > of the geyser duration data).
> > *However*, I have trouble finding the code for that
> > function! Admittedly, I am a newby to R. Where exactly
> > do I find the scripts to that chapter? Commands like
> > library(MASS), or help.search("average shifted
> > histogram") did not help.
> The scripts are in simple files installed with the package. So you
> need to go to the install directory and read them from there. A
> canonical way of finding it from within R is
> .path.package("MASS")
> dir(file.path(.path.package("MASS"),scripts))
> file.show(file.path(.path.package("MASS"),"scripts","ch05.R"))
> That being said, I couldn't off-hand spot anything ASH-like in the
> file. This might either be a difference between the R and S versions,
> or just that the remark in the figure caption does not spefically  
> relate to ASH (haven't got the book at hand just now). 

It's in the MASS3 script but not the MASS4 one.  So look in 

file.show(system.file("scripts3", "ch05.R", package = "MASS"))

at the top of section 5.6.  It is done by hand.  There is a simple 
function to do so in package ash (on CRAN), but really you should be using 
kernel methods as described in the book.

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

More information about the R-help mailing list