The collapse Java SequenceIterator methods operate on the object's and the input sequences, left and right, to produce the computed scalar result of type
double
.The method signatures are of the following form (where
op
is the indicated operation):public SequenceIterator op(SequenceIterator weights)The following table lists the available collapse methods:
public SequenceIterator wsum(SequenceIterator weights)
Calculate the weighted sum of the two sequences public SequenceIterator wavg(SequenceIterator weights)
Calculate the weighted average of the two sequences public SequenceIterator cov(SequenceIterator other)
Calculate the covariance of the two sequences public SequenceIterator corr(SequenceIterator other)
Calculate the correlation of the two sequences Example
Following is an example code snippet demonstrating a collapse function:
{ ... SequenceIterator high = quote.high.iterator(); SequenceIterator low = quote.low.iterator(); // Calculate the correlation between low and high SequenceIterator corr = low.corr(high); ... } }