Learn R Programming

SimIndep (version 0.1.2)

wise_sim: Calculate an n by n similarity matrix

Description

Returns an n by n similarity matrix.

Usage

wise_sim(data, measure = "distance", metric = "manhattan", k = NULL)

Value

an n by n similarity matrix.

Arguments

data

an n by p data matrix, with n being the sample size and p being the dimension.

measure

the similarity measure: "distance" for distance-based measure; "graph" for k-nearest neighbor graph-based measure. The default is "distance".

metric

character string specifying the distance metric or graph weight. "manhattan" for Manhattan distance (default), "euclidean" for Euclidean distance.

k

the Number of nearest neighbors used in k-nearest neighbor graph. k = floor(sqrt(n)) if not specified.

Examples

Run this code
X <- matrix(rnorm(100), nrow = 10)
wise_sim(X, measure = "distance", metric = "manhattan")

Run the code above in your browser using DataLab