Apama 10.3 | Apama Documentation | Developing Apama Applications | Developing Apama Applications in Event Modeler | Using Standard Blocks | General analytic blocks | Correlation Calculator v2.0

Correlation Calculator v2.0
The Correlation Calculator block calculates the correlation coefficient between two streams of data. The calculation may be performed over an unlimited set of data from each stream, or a set limited by number of samples or age of samples. The calculator only generates an output if there is at least one suitable sample from each stream.
Correlation coefficient
A correlation coefficient approaching +1.0 shows a strong correlation between the streams, a coefficient close to 0.0 shows little or no correlation between the streams and a coefficient approaching –1.0 shows an inverse correlation between the streams; for example, if one is increasing, the other is decreasing.
Parameters
 Parameter Description period The maximum age of any sample that is used in the calculations, in seconds. Any samples older than this will be discarded before performing the calculation. size The maximum number of sample pairs that are used in the calculation. A pair consists of a sample from one stream, and the most recent sample from the other stream. The oldest sample is replaced by the newest sample when the total number of samples has reached this limit.
One or both of the above parameters must be 0, in which case that limit is not imposed. It is not possible to restrict the number of samples by both age and number of samples, but it is possible to not impose any limit on the number of samples (thus an infinite set of samples is kept). Note that imposing a limit after input events have been received will clear all existing samples.
Operations
 Operation Description start Starts the calculation of coefficients. Must be called before the calculator will generate any statistics. stop Stops the calculation of further coefficients. Any subsequent input feeds are ignored. clear Discards all current data.
Input feeds
 Feed Fields Description data1 value The first input set. data2 value The second input set.
Note that at least one feed from both sets needs to have been received (and if set, within period seconds) before an output will be generated.
Output feeds
 Feed Fields Description statistics correlation The correlation coefficient (between -1.0 and +1.0). samples The number of sample pairs used for this calculation.