czek_matrix: Preprocess data to produce a Czekanowski’s Diagram.

Description Usage Arguments Value Examples

Description

This is a function that divided the values inside a distance matrix into classes. The output can be used in the plot function to produce a Czekanowski’s Diagram.

Usage

1
2
czek_matrix(x, order = "OLO", n_classes = 5, interval_breaks = NULL,
  monitor = FALSE, distfun = dist, scale_data = TRUE, ...)

Arguments

x

a numeric matrix, data frame or a 'dist' object.

order

specifies which seriation method should be applied. The standard setting is the seriation method OLO.

n_classes

specifies how many classes the distances should be divided into. The standard setting is 5 classes.

interval_breaks

specifies the partition boundaries for the distances. As a standard setting, each class represents an equal amount of distances.

monitor

specifies if the distribution of the distances should be visualized. The standard setting is that the distribution will not be visualized. TRUE and "cumulativ_plot" is available.

distfun

specifies which distance function should be used. Standard setting is the dist function which uses the Euclidean distance.

scale_data

specifies if the data set should be scaled. The standard setting is that the data will be scaled.

...

specifies further parameters that can be passed on to the seriate function in the seriation package.

Value

The function returns a matrix with class czek_matrix. The return from the function is expected to be passed to the plot function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Set data ####
x<-mtcars


# Different type of input that give same result ############
czek_matrix(x)
czek_matrix(dist(scale(x)))


# Change seriation method ############
#seriation::show_seriation_methods("dist")
czek_matrix(x,order = "GW")
czek_matrix(x,order = "ga")
czek_matrix(x,order = sample(1:nrow(x)))


# Change number of classes ############
czek_matrix(x,n_classes = 3)


# Change the partition boundaries ############
czek_matrix(x,interval_breaks = c(0.1,0.4,0.5)) #10%, 40% and 50%
czek_matrix(x,interval_breaks = c(0,1,4,6,8.48)) #[0,1] (1,4] (4,6] (6,8.48]
czek_matrix(x,interval_breaks = "equal_width_between_classes") #[0,1.7] (1.7,3.39]  (3.39,5.09] (5.09,6.78] (6.78,8.48]


# Change number of classes ############
czek_matrix(x,monitor = TRUE)
czek_matrix(x,monitor = "cumulativ_plot")


# Change distance function ############
czek_matrix(x,distfun = function(x) dist(x,method = "manhattan"))


# Change dont scale the data ############
czek_matrix(x,scale_data = FALSE)
czek_matrix(dist(x))


# Change additinal settings to the seriation method ############
czek_matrix(x,order="ga",control=list(popSize=200,
                                     suggestions=c("SPIN_STS","QAP_2SUM")))

vasterlund/RMaCzek documentation built on June 12, 2019, 12:36 a.m.