Scripting > Math Functions


Correlation Coefficients

correlationCoefficients(TimeSeriesMath tsData)

Computes the linear regression and other correlation coefficients between data in the current time series and tsData.  Values in the current time series and tsData are matched by time to form data pairs for the correlation analysis.   The data sets may be either regular or irregular time interval data.

The correlations statistics computed by the function are:
 

Number of Valid Values

Regression Constant

Regression Coefficient

Determination Coefficient

Standard Error of Regression

Adjusted Determination Coefficient

Adjusted Standard Error of Regression

 

These values are contained in a LinearRegressionStatistics object.

The current TimeSeriesMath object forms the values of the independent variable (x-values), while values of the second time series comprise the dependent variable (y-values).  The linear regression coefficients thus express how values in the second data set can be derived from values in the primary data set:

 

TS2(t) = a + b * TS1(t)

where  “a” is the regression constant and “b” the regression coefficient.

 

See also:  LinearRegressionStatistics

Parameters: tsData  - A TimeSeriesMath object that forms the dependent variable for the regression analysis

Example:

linearRegressionData =

tsData.correlationCoefficients(otherTsData)

Returns:A LinearRegressionStatistics object holding the correlation data.

Generated Exceptions:  Throws an hec.hecmath.HecMathException if the times in the current time series do not exactly match times in tsData.