hilbert.order: Estimate the Hilbert order for a given matrix

Description Usage Arguments Details Value Author(s) Examples

View source: R/hilbert.order.R

Description

Estimate the Hilbert order, or the number of bins in each dimension, so that if the matrix was random every row in the matrix would correspond to a single bin.

Usage

1

Arguments

mat

the matrix for which to estimate the Hilbert order

Details

Assuming the matrix is fully random, there is no need to generate more voxels (the combination of bins over all dimensions) than there are rows in the matrix. The number can be derived from the following formula:

c^d < N

where c is the number of bins, d is the number of dimensions and N is the total number of cells in the dataset. c can be computed easily using the following formula:

c = floor(N^1/d)

The number of cuts for do.cut is the number of bins plus 1.

Value

the suggested number of bins to use for the specified mat.

Author(s)

Yann Abraham

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# generate a random 3D matrix with 2 peaks
mat <- rbind(matrix(rnorm(300),ncol=3),
             matrix(rnorm(300,5,1),ncol=3))
dimnames(mat)[[2]] <- LETTERS[1:3]
# estimate the Hilbert order
hilbert.order(mat)
# generate 2 bins with a minimum bin size of 5
cuts <- make.cut(mat,n=3,count.lim=5)
show.cut(cuts)
# Generate the cuts
cut.mat <- do.cut(mat,cuts,type='fixed')
head(cut.mat)

hilbertSimilarity documentation built on Nov. 12, 2019, 1:06 a.m.