Library: | xclust |
See also: | vec2mat distance lpdist agglom |
Quantlet: | cor2dist | |
Description: | transforms the values of the upper triangle of a correlation matrix into distances, and it stores these distances into a vector regarding the sequence described in agglom |
Usage: | d = cor2dist(s, t) | |
Input: | ||
s | l x l matrix of correlations (or association values with elements -1 <= s[i,j] <= 1) | |
t | kind of transformation: t=0: d=2-2s; t=1: d=abs(s) | |
Output: | ||
d | d l(l-1)/2 x 1 matrix containing the transformed values of the upper triangle of s. Afterwards the vector d can be used as the input parameter of the function AGGLOM. |
; load the library xclust library("xclust") ; generate s data s = #(1, .8, .5, 0)~#(.8, 1, 0.9,(-1))~#(, .5, .9, 1, .1)~#(0,(-1), .1, 1) cor2dist(s,0)
Content of object d [1,] 0.4 [2,] 1 [3,] 2 [4,] 0.2 [5,] 4 [6,] 1.8