Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

histde

Histogram density estimate


Description

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

Usage

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

Details

If binw is missing, the default binwidth is 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.

Value

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

See Also

Examples

## positive data example
set.seed(8192)
x <- 2^rnorm(100)
fhat <- histde(x=x)
plot(fhat, col=3)
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

ks

Kernel Smoothing

v1.12.0
GPL-2 | GPL-3
Authors
Tarn Duong [aut, cre], Matt Wand [ctb], Jose Chacon [ctb], Artur Gramacki [ctb]
Initial release
2021-02-06

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.