gcsm: Composite similarity between vectors

Description Usage Arguments Details Value Examples

View source: R/RcppExports.R

Description

Compute composite measures, GCSM or CMSC, between two vectors.

Usage

 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
cmsc(
  x,
  y,
  rescale = FALSE,
  xmin = NA_real_,
  xmax = NA_real_,
  ymin = NA_real_,
  ymax = NA_real_,
  comp = "si"
)

cmsc_e1(
  x,
  y,
  rescale = FALSE,
  xmin = NA_real_,
  xmax = NA_real_,
  ymin = NA_real_,
  ymax = NA_real_,
  comp = "si"
)

cmsc_e2(
  x,
  y,
  rescale = FALSE,
  xmin = NA_real_,
  xmax = NA_real_,
  ymin = NA_real_,
  ymax = NA_real_,
  comp = "si"
)

gcsm(
  x,
  y,
  rescale = FALSE,
  xmin = NA_real_,
  xmax = NA_real_,
  ymin = NA_real_,
  ymax = NA_real_,
  comp = "si"
)

Arguments

x

A vector.

y

The other vector.

rescale

Rescale or not before computation.

xmin, xmax, ymin, ymax

Normalization parameters. If NA, are calculated from the ranges of x and y, respectively. See Details.

comp

Variable to return. If "si", the composite measure, if "s1","s2" or "s3", the corresponding component.

Details

These functions compute composite measures between vectors. Missing values are omitted. Normalization parameters are used to rescale x and y, and determine the global minimum (min) and maximum (max). If rescale is TRUE, x and y are rescaled to (x-xmin)/(xmax-xmin) and (y-ymin)/(ymax-ymin); and set min=0, max=1. If FALSE, min=min(xmin,ymin), max=max(xmax,ymax).

Value

A number.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
x = runif(9)
gcsm(x, x)
cmsc(x, x)
# mean shift
gcsm(x, x - 0.2, xmin = 0, xmax = 1, ymin = 0, ymax = 1)
cmsc(x, x - 0.2, xmin = 0, xmax = 1, ymin = 0, ymax = 1)
gcsm(x, x + 0.2, xmin = 0, xmax = 1, ymin = 0, ymax = 1)
cmsc(x, x + 0.2, xmin = 0, xmax = 1, ymin = 0, ymax = 1)
## dissimilarity
y = 1 - x # y is the perfect antianalog of x
gcsm(y, x)
gcsm(y, x - 0.2, xmin = 0, xmax = 1, ymin = 0, ymax = 1)
gcsm(y, x + 0.2, xmin = 0, xmax = 1, ymin = 0, ymax = 1)

# random noise
noise = rnorm(9, mean = 0, sd = 0.2)
gcsm(x, x + noise, xmin = 0, xmax = 1, ymin = 0, ymax = 1)
cmsc(x, x + noise, xmin = 0, xmax = 1, ymin = 0, ymax = 1)
## dissimilarity
gcsm(y, x + noise, xmin = 0, xmax = 1, ymin = 0, ymax = 1)

GCSM documentation built on March 27, 2021, 5:06 p.m.

Related to gcsm in GCSM...