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.
Secondly: Is the fact that I have trouble finding a
routine for the average shifted histogram method a
hint, that the method is outdated, and instead method
X or Y should be used? The problem I am trying to
solve is to smoothe a two-dimensional data set, the
y-values change very rapidly between one and zero. The
function "loess" in R seems to do a very reasonable
job for that problem, but I would like to use a second
and different method.
Any help is highly appreciated!
Thanks,
Eckart Bindewald
Eckart Bindewald wrote:> 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. > > Secondly: Is the fact that I have trouble finding a > routine for the average shifted histogram method a > hint, that the method is outdated, and instead method > X or Y should be used? The problem I am trying to > solve is to smoothe a two-dimensional data set, the > y-values change very rapidly between one and zero. The > function "loess" in R seems to do a very reasonable > job for that problem, but I would like to use a second > and different method. > > Any help is highly appreciated! > > Thanks, > > Eckart Bindewald >Try: install.packages("ash") library(ash) I have found "loess" (or possibly "locfit" in the package of the same name) more flexible though. --sundar
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). -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
>>>>> "PD" == Peter Dalgaard <p.dalgaard at biostat.ku.dk> >>>>> on 29 Jul 2004 08:02:54 +0200 writes:PD> 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. PD> The scripts are in simple files installed with the PD> package. So you need to go to the install directory and PD> read them from there. A canonical way of finding it from PD> within R is PD> .path.package("MASS") which requires that "MASS" has been attached {as by library()}. PD> dir(file.path(.path.package("MASS"),scripts)) PD> file.show(file.path(.path.package("MASS"),"scripts","ch05.R")) eehm, as the "." in ".path.package()" suggests, there should be a more canonical way --- and there is, using system.file() : dir(system.file("scripts", package = "MASS")) ## [1] "ch01.R" "ch02.R" "ch03.R" "ch04.R" "ch05.R" "ch06.R" "ch07.R" "ch08.R" ## [9] "ch09.R" "ch10.R" "ch11.R" "ch12.R" "ch13.R" "ch14.R" "ch15.R" "ch16.R" ##[17] "README" file.show(system.file(file.path("scripts","ch05.R"), package = "MASS")) -- Martin