SDDSlib
|
Functions for computing linear correlation coefficients and their significance. More...
#include "mdb.h"
Go to the source code of this file.
Functions | |
double | linearCorrelationCoefficient (double *data1, double *data2, short *accept1, short *accept2, long rows, long *count) |
Compute the linear correlation coefficient for two data sets. | |
double | linearCorrelationSignificance (double r, long rows) |
Compute the statistical significance of a linear correlation coefficient. | |
double | shiftedLinearCorrelationCoefficient (double *data1, double *data2, short *accept1, short *accept2, long rows, long *count, long shift) |
Compute the linear correlation coefficient between two data sets with a given shift. | |
Functions for computing linear correlation coefficients and their significance.
Definition in file lincorr.c.
double linearCorrelationCoefficient | ( | double * | data1, |
double * | data2, | ||
short * | accept1, | ||
short * | accept2, | ||
long | rows, | ||
long * | count ) |
Compute the linear correlation coefficient for two data sets.
Given two arrays of data and optional acceptance arrays, this function calculates the linear correlation coefficient (r) between the two data sets. Invalid values (NaN or Inf) and unaccepted entries are skipped.
data1 | First data array. |
data2 | Second data array. |
accept1 | Optional acceptance array for data1, may be NULL. |
accept2 | Optional acceptance array for data2, may be NULL. |
rows | Number of elements in each data array. |
count | Pointer to a long to store the number of valid paired samples used. |
Definition at line 32 of file lincorr.c.
double linearCorrelationSignificance | ( | double | r, |
long | rows ) |
Compute the statistical significance of a linear correlation coefficient.
Given a correlation coefficient and the sample size, this function returns the significance level, i.e., the probability of observing such a correlation by chance.
r | The linear correlation coefficient. |
rows | The number of samples used to compute r. |
Definition at line 79 of file lincorr.c.
double shiftedLinearCorrelationCoefficient | ( | double * | data1, |
double * | data2, | ||
short * | accept1, | ||
short * | accept2, | ||
long | rows, | ||
long * | count, | ||
long | shift ) |
Compute the linear correlation coefficient between two data sets with a given shift.
Similar to linearCorrelationCoefficient(), but applies a time shift (lag) between the data sets. One array is shifted relative to the other, and only overlapping values are considered.
data1 | First data array. |
data2 | Second data array. |
accept1 | Optional acceptance array for data1, may be NULL. |
accept2 | Optional acceptance array for data2, may be NULL. |
rows | Number of elements in each data array. |
count | Pointer to a long to store the number of valid paired samples used after shifting. |
shift | The integer shift to apply (positive or negative). |
Definition at line 102 of file lincorr.c.