cov() function

The cov() function computes the covariance between two streams by first joining the streams, then performing the covariance operation.

*Function type: Transformation
**
Output data type:* Float

  1. cov(x: table1, y: table2, on: ["_time", "_field"], pearsonr: false)

Parameters

x

One input stream used to calculate the covariance.

*Data type: Record*

y

The other input table used to calculate the covariance.

*Data type: Record*

on

The list of columns on which to join.

*Data type: Array of strings*

pearsonr

Indicates whether the result should be normalized to be the Pearson R coefficient.

*Data type: Boolean*

Examples

  1. table1 = from(bucket: "example-bucket")
  2. |> range(start: -15m)
  3. |> filter(fn: (r) =>
  4. r._measurement == "measurement_1"
  5. )
  6. table2 = from(bucket: "example-bucket")
  7. |> range(start: -15m)
  8. |> filter(fn: (r) =>
  9. r._measurement == "measurement_2"
  10. )
  11. cov(x: table1, y: table2, on: ["_time", "_field"])

Function definition

  1. cov = (x,y,on,pearsonr=false) =>
  2. join( tables:{x:x, y:y}, on:on )
  3. |> covariance(pearsonr:pearsonr, columns:["_value_x","_value_y"])