histogram(haerdle)R Documentation

Haerdle's histogram function

Description

computes and plots a histogram

Usage

histogram(data, h, x0, plot.type=T, ...)

Arguments

Required:
data a vector of data
h bin width
x0 start of first bin
plot.type If TRUE, plot the histogram
... further options to barplot

Value

If plot.type=F, a list of midpoint and est, the heights.

References

`Smoothing Techniques with Implementation in S', Wolfgang Haerdle, Springer, 1991

See Also

hist, frequency.polygon, histogram.normal.ref

Examples

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()


[Package Contents]