| histogram(haerdle) | R Documentation |
computes and plots a histogram
histogram(data, h, x0, plot.type=T, ...)
data |
a vector of data |
h |
bin width |
x0 |
start of first bin |
plot.type |
If TRUE, plot the histogram |
... |
further options to barplot |
If plot.type=F, a list of midpoint and est, the heights.
`Smoothing Techniques with Implementation in S', Wolfgang Haerdle, Springer, 1991
hist, frequency.polygon, histogram.normal.ref
data(buffalo)
# Figure 1.9
histogram(buffalo,10,0)
# Figure 1.16
par(mfrow=c(3,2))
histogram(buffalo,10,0)
histogram(buffalo,10,2)
histogram(buffalo,10,4)
histogram(buffalo,10,6)
histogram(buffalo,10,8)
grid <- 1+seq(20,138,2)
est<-numeric(length(grid))
for(i in seq(0,8,2)){
cw <- histogram(buffalo,10,i,FALSE)
est <- est+cw[[2]][(grid-i)%/%10]/5
}
barplot(est,grid[-1]-grid[-length(grid)],space=0,ylim=c(0,max(est)))
box()