rule {npsp}R Documentation

npsp Rules

Description

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

Usage

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

rule.binning(x, ...)

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

rule.svar(x, ...)

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

## S3 method for class '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.

Details

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

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

See Also

hist, nclass.Sturges, nclass.scott, nclass.FD, binning, np.den, bin.den.


[Package npsp version 0.7-13 Index]