Greeting All,
Peace. New to this forum and am confused about how to approach data analysis of variables with C++. My question I is am simply going to do simple descriptive statistics (mean, mode, variance), and a little more complicated chi square / correlation (Pearson). The approach that I am going to take is that I am going to write my own formulas and re-create a distribution table to get the level of significance and the analysis that is needed.
Is this approach re-inventing the wheel or is it better to try to figure out other statistical code already made? I have had problems with the latter. For example this snippet below on chi-square with C++ baffles me as to what is passed in.
-- ALGLIB --
Copyright 19.09.2006 by Bochkanov Sergey
*************************************************************************/
void onesamplevariancetest(const ap::real_1d_array& x,
int n,
double variance,
double& bothtails,
double& lefttail,
double& righttail)
{
int i;
double xmean;
double ymean;
double xvar;
double yvar;
double p;
double s;
double stat;
if( n<=1 )
{
bothtails = 1.0;
lefttail = 1.0;
righttail = 1.0;
return;
}
The code is nice the implementation is confusing. The question is should I try to understand or implement my own. If I do my own this would mean I would need to re-type the distribution table so that a chi-square algorithm could be analyzed.
Thank you for any points in the right direction.
Peace.