Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

corrcoef (MathScript Function) (Windows, Not in Base Package)

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

Member of the spectral analysis and the statistics classes.

Syntax

r = corrcoef(x)

r = corrcoef(x, y)

[r, p, rlo, rup] = corrcoef(x, 'alpha', a, 'rows', s)

[r, p, rlo, rup] = corrcoef(x, y, 'alpha', a, 'rows', s)

Description

Computes the correlation coefficients.

Details

Examples

Inputs

Name Description
x Specifies observations for each variable. If you specify r = corrcoef(x), x can be real or complex. If you specify [r, p, rlo, rup] = corrcoef(x, 'alpha', a, 'rows', s), x must be real. x is a vector or matrix. If x is a vector, each element in x is an observation. If x is a matrix, each row in x is an observation, and each element in the row is data for that observation.
y When x is a vector, y specifies the data values for each observation in x. When x is a matrix, you cannot specify y. y is an array of the same length as x.
'alpha' Tells LabVIEW that the next listed input is a.
a Specifies the confidence level 1-a. a is a real number in the interval [0, 1]. The default is 0.05.
'rows' Tells LabVIEW that the next listed input is s.
s Specifies how to handle values of NaN in x. s is a string that accepts the following values.

'all' (default) Uses all data to compute the correlation coefficients.
'complete' Uses only rows without values of NaN to compute the correlation coefficients.
'pairwise' Uses only rows without values of NaN in the i-th and j-th columns of x to compute the (i, j)-th element of r.

Outputs

Name Description
r Returns the correlation coefficients.
p Returns the p-values for the null hypothesis. p is a matrix.
rlo Returns the lower bound for the confidence interval of each coefficient. rlo is a matrix.
rup Returns the upper bound for the confidence interval of each coefficient. rup is a matrix.

Details

If you specify both inputs x and y, LabVIEW computes the correlation coefficients according to the following equation: r = corrcoef([x(:), y(:)]).

Examples

R = corrcoef(rand(5, 6))

R = corrcoef(rand(5, 1), rand(5, 1))

[R, P, RLO, RUP] = corrcoef(rand(5, 6))

Related Topics

cov
std
xcorr
xcorr2


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit