corDiss {resemble} | R Documentation |
Computes correlation and moving correlation dissimilarity matrices.
corDiss(Xr, X2 = NULL, ws = NULL, center = TRUE, scaled = TRUE)
Xr |
a |
X2 |
an optional |
ws |
for moving correlation dissimilarity, an odd integer value which specifies the window size. If |
center |
a logical indicating if the spectral data |
scaled |
a logical indicating if |
The correlation dissimilarity cd between two obsvervations x_i and x_j is computed as follows:
cd(x_i, x_j) = \frac{1}{2}(1 - cor(x_i, x_j))
The avobe formlula is used when ws = NULL
.
On the other hand (when ws != NULL
) the moving correlation dissimilarity mcd between two obsvervations x_i and x_j is computed as follows:
mcd(x_i, x_j) = \frac{1}{2 ws}∑_{k=1}^{p-ws}(1 - cor(x_{i,(k:k+ws)}, x_{j,(k:k+ws)}))
where ws represents a given window size which rolls sequantially fom 1 up to p - ws and p is the number of variables of the observations. The function does not accept input data containing missing values.
a matrix
of the computed dissimilarities.
Antoine Stevens and Leonardo Ramirez-Lopez
## Not run: require(prospectr) data(NIRsoil) Xu <- NIRsoil$spc[!as.logical(NIRsoil$train),] Xr <- NIRsoil$spc[as.logical(NIRsoil$train),] corDiss(Xr = Xr) corDiss(Xr = Xr, X2 = Xu) corDiss(Xr = Xr, ws = 41) corDiss(Xr = Xr, X2 = Xu, ws = 41) ## End(Not run)