Fast pattern

fast.pattern(x, y, categories = 2, ...)

Arguments

x

Matrix (binary) of patterns. Optionally if y is also passed as argument, then the pattern matrix is defined as the elements agreeing in the two matrices.

y

Optional matrix argument with same dimensions as x (see above)

categories

Default 2 (binary)

...

Optional additional arguments

Author

Klaus K. Holst

Examples

X <- matrix(rbinom(100,1,0.5),ncol=4)
fast.pattern(X)
#> $pattern
#>       [,1] [,2] [,3] [,4]
#>  [1,]    0    1    0    0
#>  [2,]    1    0    0    1
#>  [3,]    1    1    0    1
#>  [4,]    0    1    0    1
#>  [5,]    0    0    1    1
#>  [6,]    1    1    0    0
#>  [7,]    1    0    1    1
#>  [8,]    0    0    0    0
#>  [9,]    1    0    1    0
#> [10,]    0    0    0    1
#> [11,]    0    0    1    0
#> [12,]    1    1    1    0
#> [13,]    1    0    0    0
#> 
#> $group
#>       [,1]
#>  [1,]    0
#>  [2,]    1
#>  [3,]    2
#>  [4,]    3
#>  [5,]    4
#>  [6,]    1
#>  [7,]    5
#>  [8,]    6
#>  [9,]    7
#> [10,]    4
#> [11,]    8
#> [12,]    9
#> [13,]    4
#> [14,]    1
#> [15,]    5
#> [16,]    9
#> [17,]   10
#> [18,]    5
#> [19,]    1
#> [20,]   11
#> [21,]   12
#> [22,]    7
#> [23,]   10
#> [24,]   12
#> [25,]    1
#> 

X <- matrix(rbinom(100,3,0.5),ncol=4)
fast.pattern(X,categories=4)
#> $pattern
#>       [,1] [,2] [,3] [,4]
#>  [1,]    2    0    1    2
#>  [2,]    1    2    2    2
#>  [3,]    3    2    2    2
#>  [4,]    2    2    2    1
#>  [5,]    3    1    1    2
#>  [6,]    1    2    2    0
#>  [7,]    2    1    1    0
#>  [8,]    2    3    2    1
#>  [9,]    1    2    0    0
#> [10,]    1    2    3    2
#> [11,]    2    3    3    2
#> [12,]    2    1    2    2
#> [13,]    1    2    2    1
#> [14,]    0    2    1    2
#> [15,]    0    1    0    2
#> [16,]    0    3    1    1
#> [17,]    1    2    1    0
#> [18,]    2    1    3    0
#> [19,]    1    1    2    2
#> [20,]    3    1    2    2
#> [21,]    1    1    1    2
#> [22,]    1    1    3    2
#> [23,]    2    2    1    1
#> 
#> $group
#>       [,1]
#>  [1,]    0
#>  [2,]    1
#>  [3,]    2
#>  [4,]    3
#>  [5,]    4
#>  [6,]    5
#>  [7,]    6
#>  [8,]    7
#>  [9,]    8
#> [10,]    9
#> [11,]   10
#> [12,]   11
#> [13,]   12
#> [14,]   13
#> [15,]    1
#> [16,]   14
#> [17,]   15
#> [18,]   16
#> [19,]   17
#> [20,]   18
#> [21,]   19
#> [22,]   20
#> [23,]   20
#> [24,]   21
#> [25,]   22
#>