SxMatrixCalc {knnwtsim}R Documentation

Calculate Similarity Matrix for Exogenous Predictors

Description

Largely a wrapper function for the stats::dist() function. First calculates n x n distance matrix using specified method for an input matrix or vector using stats::dist(). Then converts the distance matrix to similarity matrix using 1 / (D_x + 1).

Usage

SxMatrixCalc(A, XdistMetric = "euclidean")

Arguments

A

numeric matrix or numeric vector where the columns represents exogenous predictor variables and the rows correspond to the points in the response series.

XdistMetric

character describing the method stats::dist() should use. This must be one of "euclidean", "maximum", "manhattan", "canberra", "binary", or "minkowski".

Value

numeric matrix of distances for A.

Examples

X <- matrix(c(1, 1, 1, 2, 2, 2, 3, 3, 3), nrow = 3, ncol = 3, byrow = TRUE)
SxMatrixCalc(X)

[Package knnwtsim version 1.0.0 Index]