OptimalNoBins: Optimal Number Of Bins

Description Usage Arguments Details Value Note Author(s) References Examples

View source: R/OptimalNoBins.R

Description

Optimal Number Of Bins is a kernel density estimation for fixed intervals.

Calculation of the optimal number of bins for a histogram.

Usage

1

Arguments

Data

Data

Details

The bin width ist defined with bw=3.49*stdrobust(1/(n)^1/3)

Value

optNrOfBins The best possible number of bins. Not less than 10 though

Note

This the second version of the function prior available in AdaptGauss

Author(s)

Alfred Ultsch, Michael Thrun

References

David W. Scott Jerome P. Keating: A Primer on Density Estimation for the Great Home Run Race of 98, STATS 25, 1999, pp 16-22.

See Also

ParetoRadius

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
Data = c(rnorm(1000),rnorm(2000)+2,rnorm(1000)*2-1)

optNrOfBins = OptimalNoBins(Data)

minData = min(Data,na.rm = TRUE)

maxData = max(Data,na.rm = TRUE)

i = maxData-minData

optBreaks = seq(minData, maxData, i/optNrOfBins) # bins in fixed intervals 

hist(Data, breaks=optBreaks)

DataVisualizations documentation built on Jan. 16, 2021, 5:45 p.m.