histde function

Histogram density estimate

Histogram density estimate

Histogram density estimate for 1- and 2-dimensional data.

histde(x, binw, xmin, xmax, adj=0) ## S3 method for class 'histde' predict(object, ..., x)

Arguments

  • x: matrix of data values
  • binw: (vector) of binwidths
  • xmin,xmax: vector of minimum/maximum values for grid
  • adj: displacement of default anchor point, in percentage of 1 bin
  • object: object of class histde
  • ...: other parameters

Returns

A histogram density estimate is an object of class histde which is a list with fields: - x: data points - same as input

  • eval.points: vector or list of points at which the estimate is evaluated

  • estimate: density estimate at eval.points

  • binw: (vector of) bandwidths

  • nbin: (vector of) number of bins

  • names: variable names

Details

If binw is missing, the default binwidth is bi=23(1/(d+2))pi(d/(2d+4))Sin(1/(d+2))b_i = 2*3^(1/(d+2))*pi^(d/(2d+4))*S_i*n^(-1/(d+2)), the normal scale selector.

If xmin is missing then it defaults to the data minimum. If xmax is missing then it defaults to the data maximum.

See Also

plot.histde

Examples

## positive data example set.seed(8192) x <- 2^rnorm(100) fhat <- histde(x=x) plot(fhat, border=6) points(c(0.5, 1), predict(fhat, x=c(0.5, 1))) ## large data example on a non-default grid set.seed(8192) x <- rmvnorm.mixt(10000, mus=c(0,0), Sigmas=invvech(c(1,0.8,1))) fhat <- histde(x=x, xmin=c(-5,-5), xmax=c(5,5)) plot(fhat) ## See other examples in ? plot.histde