Mercurial > hg > octave-nkf
comparison scripts/statistics/base/cor.m @ 6754:451b346d8c2f
[project @ 2007-06-25 17:31:46 by jwe]
author | jwe |
---|---|
date | Mon, 25 Jun 2007 17:31:47 +0000 |
parents | 34f96dd5441b |
children | 93c65f2a5668 |
comparison
equal
deleted
inserted
replaced
6753:a5c64dad5b93 | 6754:451b346d8c2f |
---|---|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 ## 02110-1301, USA. | 18 ## 02110-1301, USA. |
19 | 19 |
20 ## -*- texinfo -*- | 20 ## -*- texinfo -*- |
21 ## @deftypefn {Function File} {} cor (@var{x}, @var{y}) | 21 ## @deftypefn {Function File} {} cor (@var{x}, @var{y}) |
22 ## Compute correlation. | |
23 ## | |
22 ## The (@var{i}, @var{j})-th entry of @code{cor (@var{x}, @var{y})} is | 24 ## The (@var{i}, @var{j})-th entry of @code{cor (@var{x}, @var{y})} is |
23 ## the correlation between the @var{i}-th variable in @var{x} and the | 25 ## the correlation between the @var{i}-th variable in @var{x} and the |
24 ## @var{j}-th variable in @var{y}. | 26 ## @var{j}-th variable in @var{y}. |
27 ## | |
28 ## @iftex | |
29 ## @tex | |
30 ## $$ | |
31 ## {\rm corrcoef}(x,y) = {{\rm cov}(x,y) \over {\rm std}(x) {\rm std}(y)} | |
32 ## $$ | |
33 ## @end tex | |
34 ## @end iftex | |
35 ## @ifnottex | |
36 ## @example | |
37 ## corrcoef(x,y) = cov(x,y)/(std(x)*std(y)) | |
38 ## @end example | |
39 ## @end ifnottex | |
25 ## | 40 ## |
26 ## For matrices, each row is an observation and each column a variable; | 41 ## For matrices, each row is an observation and each column a variable; |
27 ## vectors are always observations and may be row or column vectors. | 42 ## vectors are always observations and may be row or column vectors. |
28 ## | 43 ## |
29 ## @code{cor (@var{x})} is equivalent to @code{cor (@var{x}, @var{x})}. | 44 ## @code{cor (@var{x})} is equivalent to @code{cor (@var{x}, @var{x})}. |
45 ## | |
46 ## Note that the @code{corrcoef} function does the same as @code{cor}. | |
30 ## @end deftypefn | 47 ## @end deftypefn |
31 | 48 |
32 ## Author: KH <Kurt.Hornik@wu-wien.ac.at> | 49 ## Author: KH <Kurt.Hornik@wu-wien.ac.at> |
33 ## Description: Compute correlations | 50 ## Description: Compute correlations |
34 | 51 |