|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpapaya.Correlation.Weighted
public static class Correlation.Weighted
Contains methods related to computing the correlation and covariance of weighted datasets.
Method Summary | |
---|---|
static float[][] |
corr(float[][] data,
float[] weights,
boolean unbiased)
Returns the weighted linear correlation matrix C. |
static float |
corr(float[] data1,
float[] data2,
float[] weights,
boolean unbiased)
Returns the weighted linear correlation of two data sequences. |
static float[][] |
cov(float[][] data,
float[] weights,
boolean unbiased)
Returns the weighted covariance matrix with element S_JK specifying the weighted covariance between column J and column K of the input matrix. |
static float |
cov(float[] data1,
float[] data2,
float[] weights,
boolean unbiased)
Returns the weighted covariance between two data sequences. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static float[][] corr(float[][] data, float[] weights, boolean unbiased)
C_JK = S_JK / sqrt(S_JJ,unbiasedValue)*sqrt(S_KK,unbiasedValue).See
Correlation.cov(float[][],boolean)
.
data
- input matrix each column corresponding to a sample, each row an observation.weights
- the weights to use.unbiased
- set to true to return the unbiased weighted correlation matrix, false to return the biased version.public static float corr(float[] data1, float[] data2, float[] weights, boolean unbiased)
unbiased
- set to true to return the unbiased weighted correlation, false to return the biased version.public static float cov(float[] data1, float[] data2, float[] weights, boolean unbiased)
unbiased
- set to true to return the unbiased weighted covariance, false to return the biased version.public static float[][] cov(float[][] data, float[] weights, boolean unbiased)
The formula used to compute element S_JK
of the unbiased covariance matrix is:
S_JK = biasCorrection * Sum ( w[i] * ( dataJ[i] - mu_w(dataJ) )*( dataK[i] - mu_w(dataK) ) ) / Sum (w[i])where
mu_w
corresponds to the weighted mean of the dataset
and the biasCorrection term above is
biasCorrection = ( Sum(w[i]) )^2 / ( ( Sum(w[i]) )^2 - Sum( w[i]^2 ) ).The elements of the biased covariance matrix are computed sans the bias Correction factor.
Reference: Covariance of weighted samples, wikipedia.org.
data
- input matrix each column corresponding to a sample, each row an observation.weights
- the weights to use.unbiased
- set to true to return the unbiased weighted covariance matrix, false to return the biased version.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |