Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - English


correl

correlation of two variables

Syntax

rho=correl(x, y [, fre])

Arguments

x

real or complex vector.

y

real or complex vector.

fre

matrix of type length(x) x length(y). (Optional)

Description

correl(x,y) or correl(x,y, fre) computes the correlation of two variables x and y.

If you use correl(x,y), x and y must be the same size (size(x, "*") must be equal to size(y, "*")).

fre is a matrix of dimensions length(x) x length(y). In fre, the element of indices (i,j) corresponds to the value or number or frequencies of x_i&y_j.

References

Wonacott, T.H. & Wonacott, R.J.; Introductory Statistics, J.Wiley & Sons, 1990.

Examples

// correl(x, y)
x = [2.5 7.5 12.5 17.5];
y = [6.3 7.1 8.2 9.4];
r = correl(x, y)

// correl(x, y, fre)
h=[0 1 2]
fre=[.03 .12 .07;.02 .13 .11;.01 .13 .14;.01 .09 .14]
rho=correl(x,h,fre)

See also

  • covar — covariance of two variables

History

VersionDescription
5.5.0 Third input argument is now optional.
Report an issue
<< Multivariate Correl Regress PCA Multivariate Correl Regress PCA cov >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:13:09 CEST 2024