tsdist_cor: Absolute, positive, or negative correlation distance.

View source: R/ts_dist.R

tsdist_corR Documentation

Absolute, positive, or negative correlation distance.

Description

Considering r the person correlation coefficient, this function returns either 1 - abs(r) if cor_type=="abs", 1 - pmax(0, r) if cor_type == "+", or 1 - pmax(0, r * -1) if cor_type == "-". Another possibility is to run a significance test to verify if the r is significant.

Usage

tsdist_cor(ts1, ts2, cor_type = "abs", sig_test = FALSE, sig_level = 0.01, ...)

Arguments

ts1

Array. Time series 1

ts2

Array. Time series 2

cor_type

String. "abs" (default), "+", or "-". "abs" considers the correlation absolute value. "+" only positive correlations and "-" only negative correlations.

sig_test

Run a statistical test. Return 0 if significant or 1 otherwise.

sig_level

The significance level to test if correlation is significant.

...

Additional parameters to cor.test() function.

Value

Real value [0,1] where 0 means perfect positive (or negative if positive_cor==FALSE) correlation and 1 no positive (or negative if positive_cor==FALSE) correlation.


ts2net documentation built on June 9, 2022, 9:06 a.m.