dataTaker Logger Performs Mathematical Calculations
CHESTERLAND, OH – Covariance is a method of measuring how strongly variables are related to each other. Covariance is commonly used calculation used in a wide number of areas from microclimate flux and carbon sequestration, aquiculture, stock market predictions, to measurement of the southern oscillation index. In our latest Tech Article, CAS DataLoggers shows you how to perform covariance calculations using a dataTaker DT80 intelligent data logger.
When Do Variables Covary?
If the result of the covariance calculation is zero, then the two variables are not related to one another.
When the result is positive, then the two variables have moved in the same direction. The larger the result, the more strongly related the two variables are.
If the result is negative, then the two variables have a negative relationship with one another, i.e. they have moved in opposite directions.
Traditionally we need the average value of each variable before we can calculate the variation of each individual sample from the average reading. However, this would be computationally intensive and tedious to implement, so for our purposes we’ll use this simplified version of the covariance formula:
CoVar (A, B ) = Ave ( A • B ) – Ave (A) • Ave ( B )
Since the average of a series of numbers is the sum of the sample divided by the number of samples taken, this is far easier to implement from a computational standpoint.
Instead of storing each sample for later processing, we only need to keep running sums of variables A, B and A*B, and keep a count of the number of samples taken.
Users can implement a simple dataTaker program to do this. Below is an example which is compatible with the DT80 Series data loggers:
‘ Schedule A (Read Variables)
‘ - Runs every 1 second
1V (=1CV, W) ‘Read the A and assign to 1CV
2V (=2CV, W) ‘Read the B and assign to 2CV
3CV (W) =3CV+1CV ‘3CV = Sum of A
4CV (W) = 4CV+2CV ‘4CV = Sum of B
5CV (W) =5CV+ (1CV*2CV) ‘5CV = Sum A*B
6CV (W) =6CV+1 ‘Number of samples
‘ Schedule B (Reporting Schedule)
‘ - Reports the Covariance
RB (“B: ”, ALARMS : OV: 10KB, DATA: OV: 1MB) 10S LOGONB
‘Calculate Covar (A,B) and save
7CV (“Covariance”) = (5CV/6CV) – ( (3CV/6CV) * (4CV/6CV) )
‘Reset the variables and start again
1..7CV (W) = 0
For more information on the dataTaker family of data loggers, or to find the ideal solution for your application-specific needs, contact a CAS Data Logger Applications Specialist at 800- 956-4437 or visit our website at www.DataLoggerInc.com.
CAS DataLoggers, Inc.
8437 Mayfield Rd.
Chesterland, Ohio 44026