C++  Zero Correlation Sample Data Set
Mean, Variance and Standard Deviation are widely used in statistical application for single series. If we have two sets of series, then we may need covariance and correlation to find the relationship between the two. It is a good idea to start writing program in C++ on this.
To calculate covariance between two sets of series, we need to multiply the difference between its mean for each term for the two series and add each term resultant value. Finally divide by N  number of terms in the series.
Correlation coefficient is the ratio between the covariance and the multiplication of the standard deviation for the two series. The range for correlation is always between 1 to +1.
Click here to see the C++ program for Correlation and Covariance calculation
Zero Correlation Data Set
If the correlation coefficient always lies between 1 to +1, then there would be question what if correlation is ZERO? It means the data set the between the two series has absolutely no relationship. In this case, covariance would also be zero.
There are many sample data set with some of them has relationship. The following is the one simple data set which I like to use for ZERO correlation.
double xarr[] = { 8, 6, 4, 6, 8 };
double yarr[] = { 10, 12, 14, 16, 18 };
If you see the series, there are 5 terms.
In the first 3 terms, for X axis data 8, 6, 4 and Y axis data is 10, 12, 14 and it represents perfect negative corelation of 1.
In the last 3 terms, for X axis data 4, 6, 8 and Y axis data is 14, 16, 18 and it represents perfect positive corelation of 1.
At the end, X series data has no relationship with Y series and provides 0 Correlatrion.
