Compute the number of classes for a histogram, the number of nodes of a binning grid, etc.

rule(x, d = 1, rule = c("Rice", "Sturges", "scott", "FD"), ...)

rule.binning(x, ...)

# S3 method for default
rule.binning(x, d = ncol(x), a = 2, b = d + 1, ...)

rule.svar(x, ...)

# S3 method for default
rule.svar(x, d = ncol(x), a = 2, b = d + 1, ...)

# S3 method for bin.den
rule.svar(x, ...)

Arguments

x

data vector or object used to select a method.

d

(spatial) dimension.

rule

character; rule to be used.

...

further arguments passed to or from other methods.

a

scale values.

b

exponent values.

Value

The rule values (vector or scalar).

rule.binning returns a vector with the suggested number of bins on each dimension.

rule.binning.default returns rep(ceiling(a * nrow(x) ^ (1 / b)), d).

rule.svar returns the suggested number of bins for variogram estimation.

rule.svar.default returns ceiling(a * (nrow(x)^2 / 4) ^ (1 / b)).

Details

The Rice Rule, \(m = \lceil 2 n^{1/3} \rceil,\) is a simple alternative to Sturges's rule (nclass.Sturges).

See also