Statistics › Moments ›
Pearson
Calculates the Pearson product for a given set of data.
Controller: CodeCogs
Contents
Dependents
Interface
C++
Pearson
template<class T> doublepearson( | int | N | |
T* | data | ||
T* | data1 | ) |
- and are the sample mean.
Example 1
#include <codecogs/statistics/moments/pearson.h> #include <iostream> int main() { double x[5] = {4 , 5 , 8 , 6 , 3}; double y[5] = {6 , 7 , 8 , 3 , 2}; double rez = Stats::Moments::pearson<double>(5,x,y); std::cout << "The Pearson product is: " << rez << std::endl; return 0; }
Output:The Pearson product is: 0.592494
Parameters
N the size of the array data is a set of independent values given as an array data1 is a set of dependent values given as an array
Returns
- returns the Pearson product moment correlation coefficient
Authors
- Anca Filibiu (August 2005)
Source Code
Source code is available when you agree to a GP Licence or buy a Commercial Licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.