41 Statistic():sum_x(0),sum_y(0),sum_xy(0),sum_x2(0),mean(0),M2(0),N(0){}
82 mean = mean+delta/(double)N;
83 M2 = M2+delta*(x-mean);
99 mean = mean-delta/(double)N;
100 M2 = M2-delta*(x-mean);
131 slope = (N*sum_xy-sum_x*sum_y)/(N*sum_x*sum_x-sum_x2);
132 else slope = sqrt(-1);
144 intercept = (sum_y*sum_x2-sum_x*sum_xy)/(N*sum_x2-sum_x*sum_x);
145 else intercept = sqrt(-1);
157 if(N>=minimum)
return M2/(double)N;
158 else return sqrt(-1);
169 else return sqrt(-1);
181 else return sqrt(-1);
Generic Class to perform statistical analysis Statistic object could be used as accumulator of data a...
T compute_dev_std(unsigned minimum=1)
Compute standard deviation of the distribution of x values.
T compute_mean(unsigned minimum=1)
Compute mean of the distribution of x values.
void clear()
Reset the Statistic object to a null state.
T compute_intercept(unsigned minimum=2)
Compute least square linear fit (no exception if only scalars where provided)
T compute_variance(unsigned minimum=1)
Compute variance of the distribution of x values.
T compute_slope(unsigned minimum=2)
Compute least square linear fit (no exception if only scalars where provided)