derive: Function to derive a strength t+1 CA into a smaller strength...

View source: R/derive.R

deriveR Documentation

Function to derive a strength t+1 CA into a smaller strength t array

Description

A CA D of strength t+1 is reduced to a single level of a particular column, which is subsequently omitted from the array. The resulting CA has strength t.

Usage

derive(D, dcol=1, dval=NULL, ...)

deriveto(N, k, v, ...)

derivefrom(N, k, v, ...)

Arguments

D

a CA with levels as integers 0, ..., v-1 or 1,...,v

dcol

the id of the column to be deleted (default: 1)

dval

the value to be used for filtering (default: the first value that has minimum frequency in column dcol)

...

currently unused

N

integer: run size;
for deriveto: the size that should result from derivation;
for derivefrom: the size of the array that is to be derived

k

integer: number of columns;
for deriveto: the number of columns that should result from derivation;
for derivefrom: the number of columns of the array that is to be derived

v

integer: the number of levels (same for ingoing and resulting array)

Details

The name derive was taken from Zhang et al. (2014). derive returns a strength t CA from a strength t+1 array by
picking one column and selecting only the runs for a single level of that column (if not balanced, use the least frequent level for obtaining the smallest run size)
and subsequently omitting that column.
deriveto predicts the dimensions of a derived array, when deriving a CA(N,t+1,k,v), assuming maximum possible balance in the column to derive on (which is worst case).
derivefrom provides the dimensions of a CA from which the specified parameters can be obtained by derivation; note that the run size is not unique, because, e.g., deriving a 20 run Ca or a 21 run CA with v=2 will both yield 10 runs. The result for N is therefore a vector of possibilities.

Value

derive returns a matrix with class ca, which has strength one less than D; its levels are coded in the same way as those of D.
deriveto returns a named vector with integer-valued elements N and k.
derievefrom returns a list with elements N (an integer-valued vector) and k (an integer number).

Examples

# create a CA(6,2,10,2) from a CA(12,3,11,2)

A <- paleyHad(11)  ## a CA(12,3,11,2)

sixdefault <- derive(A)  ## first column of A was 0,
                         ## first column omitted
dim(sixdefault)
coverage(sixdefault, 2)
eCAN(2,10,2)  ## the array is optimal

## default construction can be modified:
## select all the runs with 11th column at level 1
## keep first 10 columns for these
six <- derive(A, dcol=11, dval=1)
dim(six)
## strength 3 was reduced to strength 2
coverage(six, 2)

deriveto(24, 12, 2)
derivefrom(24, 12, 2)

# t=3 v=2 k=5
eCAN(3,5,2) ## N=10, Derive from strength 4
derivefrom(10, 5, 2)
# t=4, v=2, k=6, N in 20 or 21
eCAN(4,6,2) ## N=21, Derive from strength 5
derivefrom(21, 6, 2)
# t=5, v=2, k=7, N in 42 or 23
eCAN(5,7,2)
## has 42 runs, Source "Special (Yan Jun)"
# this or equivalent CA is available in TJ library
N_TJcat(5, 7, 2)


CAs documentation built on Nov. 29, 2026, 1:06 a.m.