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,]    1    1    0    1
#>  [2,]    0    0    1    0
#>  [3,]    1    0    0    0
#>  [4,]    0    1    0    1
#>  [5,]    0    0    1    1
#>  [6,]    0    1    1    0
#>  [7,]    0    0    0    0
#>  [8,]    1    0    1    1
#>  [9,]    1    0    1    0
#> [10,]    0    1    0    0
#> [11,]    1    0    0    1
#> [12,]    1    1    1    0
#> [13,]    1    1    1    1
#> 
#> $group
#>       [,1]
#>  [1,]    0
#>  [2,]    1
#>  [3,]    2
#>  [4,]    3
#>  [5,]    3
#>  [6,]    4
#>  [7,]    5
#>  [8,]    6
#>  [9,]    7
#> [10,]    4
#> [11,]    6
#> [12,]    8
#> [13,]    9
#> [14,]    3
#> [15,]    7
#> [16,]    0
#> [17,]    7
#> [18,]    6
#> [19,]    2
#> [20,]    9
#> [21,]    2
#> [22,]   10
#> [23,]   11
#> [24,]    8
#> [25,]   12
#> 

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