papaya
Class Correlation.Significance

java.lang.Object
  extended by papaya.Correlation.Significance
Enclosing class:
Correlation

public static class Correlation.Significance
extends Object

Contains methods used to compute the significance, or pvalue of the input correlations. The significance is computed using the normal of student-t approximations and hence are not to be used for small datasets(i.e. size<20).


Method Summary
static float durbinWatson(float[] data)
          The Durbin-Watson statistic is a test statistic used to detect the presence of autocorrelation (Correlation.auto(float[], int, float, float)) in the residuals (prediction errors) from a regression analysis.
static float linear(float r, int size)
          Returns the p-value, or significance level of the linear correlation r between two datasets under the null hypothesis of no correlation.
static float spearman(float rho, int size)
          Returns the p-value, or significance level of the Spearman rank-correlation rho between two datasets under the null hypothesis of no correlation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

durbinWatson

public static float durbinWatson(float[] data)
The Durbin-Watson statistic is a test statistic used to detect the presence of autocorrelation (Correlation.auto(float[], int, float, float)) in the residuals (prediction errors) from a regression analysis.

If e_t is the residual associated with the observation at time t, and there are T observations, then the test statistic, d is

 d =   Sum_{from t=2 to T} ( e_t - e_{t-1} )^2    /   Sum_{from t=1 to T} ( e_t )^2
 

Returns:
d the Durbin Watson test statistic

linear

public static float linear(float r,
                           int size)
Returns the p-value, or significance level of the linear correlation r between two datasets under the null hypothesis of no correlation. That is, H_0: ρ=0 (No linear correlation; Two-tailed test). The p-value is computed by transforming the correlation to create a t-statistic having n-2 degrees of freedom:
 t = r * sqrt( (n-2)/(1-r^2) ),
where n is the size of the corresponding datasets.

Parameters:
r - the linear correlation coefficient
size - the size of the corresponding datasets (i.e. number of rows/observations).
Throws:
IllegalArgumentException - if the size is less than 20. Below this, the student-T approximation is inaccurate.

spearman

public static float spearman(float rho,
                             int size)
Returns the p-value, or significance level of the Spearman rank-correlation rho between two datasets under the null hypothesis of no correlation. That is, H_0: ρ_0=0 (No linear correlation; Two-tailed test). The p-value is computed by transforming the correlation to create a t-statistic having n-2 degrees of freedom:
 t = rho * sqrt( (n-2)/(1-rho^2) ),
where n is the size of the corresponding datasets.

Parameters:
rho - the Spearman-correlation coefficient
size - the size of the corresponding datasets (i.e. number of rows/observations).
Throws:
IllegalArgumentException - if the size is less than 20. Below this, the student-T approximation is inaccurate.


Processing library papaya by Adila Faruk. (C) 2014