(octave.info)Correlation and Regression Analysis
26.3 Correlation and Regression Analysis
========================================
-- : cov (X)
-- : cov (X, OPT)
-- : cov (X, Y)
-- : cov (X, Y, OPT)
Compute the covariance matrix.
If each row of X and Y is an observation, and each column is a
variable, then the (I, J)-th entry of ‘cov (X, Y)’ is the
covariance between the I-th variable in X and the J-th variable in
Y.
cov (X) = 1/(N-1) * SUM_i (X(i) - mean(X)) * (Y(i) - mean(Y))
where N is the length of the X and Y vectors.
If called with one argument, compute ‘cov (X, X)’, the covariance
between the columns of X.
The argument OPT determines the type of normalization to use.
Valid values are
0:
normalize with N-1, provides the best unbiased estimator of
the covariance [default]
1:
normalize with N, this provides the second moment around the
mean
Compatibility Note:: Octave always treats rows of X and Y as
multivariate random variables. For two inputs, however, MATLAB
treats X and Y as two univariate distributions regardless of their
shapes, and will calculate ‘cov ([X(:), Y(:)])’ whenever the number
of elements in X and Y are equal. This will result in a 2x2
matrix. Code relying on MATLAB’s definition will need to be
changed when running in Octave.
See also: Note: corr.
-- : corr (X)
-- : corr (X, Y)
Compute matrix of correlation coefficients.
If each row of X and Y is an observation and each column is a
variable, then the (I, J)-th entry of ‘corr (X, Y)’ is the
correlation between the I-th variable in X and the J-th variable in
Y.
corr (X,Y) = cov (X,Y) / (std (X) * std (Y))
If called with one argument, compute ‘corr (X, X)’, the correlation
between the columns of X.
See also: Note: cov.
-- : R = corrcoef (X)
-- : R = corrcoef (X, Y)
-- : [R, P] = corrcoef (...)
-- : [R, P, LCI, HCI] = corrcoef (...)
-- : [...] = corrcoef (..., PARAM, VALUE, ...)
Compute a matrix of correlation coefficients.
X is an array where each column contains a variable and each row is
an observation.
If a second input Y (of the same size as X) is given then calculate
the correlation coefficients between X and Y.
R is a matrix of Pearson’s product moment correlation coefficients
for each pair of variables.
P is a matrix of pair-wise p-values testing for the null hypothesis
of a correlation coefficient of zero.
LCI and HCI are matrices containing, respectively, the lower and
higher bounds of the 95% confidence interval of each correlation
coefficient.
PARAM, VALUE are pairs of optional parameters and values. Valid
options are:
"alpha"
Confidence level used for the definition of the bounds of the
confidence interval, LCI and HCI. Default is 0.05, i.e., 95%
confidence interval.
"rows"
Determine processing of NaN values. Acceptable values are
"all", "complete", and "pairwise". Default is "all". With
"complete", only the rows without NaN values are considered.
With "pairwise", the selection of NaN-free rows is made for
each pair of variables.
See also: Note: corr, Note: cov.
-- : spearman (X)
-- : spearman (X, Y)
Compute Spearman’s rank correlation coefficient RHO.
For two data vectors X and Y, Spearman’s RHO is the correlation
coefficient of the ranks of X and Y.
If X and Y are drawn from independent distributions, RHO has zero
mean and variance ‘1 / (N - 1)’, where N is the length of the X and
Y vectors, and is asymptotically normally distributed.
‘spearman (X)’ is equivalent to ‘spearman (X, X)’.
See also: Note: ranks, Note: kendall.
-- : kendall (X)
-- : kendall (X, Y)
Compute Kendall’s TAU.
For two data vectors X, Y of common length N, Kendall’s TAU is the
correlation of the signs of all rank differences of X and Y; i.e.,
if both X and Y have distinct entries, then
1
TAU = ------- SUM sign (Q(i) - Q(j)) * sign (R(i) - R(j))
N (N-1) i,j
in which the Q(i) and R(i) are the ranks of X and Y, respectively.
If X and Y are drawn from independent distributions, Kendall’s TAU
is asymptotically normal with mean 0 and variance ‘(2 * (2N+5)) /
(9 * N * (N-1))’.
‘kendall (X)’ is equivalent to ‘kendall (X, X)’.
See also: Note: ranks, Note: spearman.
automatically generated by info2www version 1.2.2.9