Library to calculate basic statistics in arduino.
Statistics st = Statistics();
Statistics is used for a single variable
Statistics2 st = Statistics2();
Statistics2 is used for two variables
Error st = Error();
Error useful to measure estiamtion error
void add(double value);
Add sample to statistics
double samples();
Number of samples added
double mean();
Mean
double var();
Variance
double std();
Standard deviation
double minimum();
Minimun value added
double maximum();
Maximun value added
double center();
Calculate center = (maximun-minimun)/2
double sum();
Aproximation to sum of all values added
double minMaxNormalization(double value);
Normalizate value using minmax normalization
double meanNormalization(double value);
Normalizate value using mean normalization
double standardization(double value);
Standardization of value (Z-score)
double rootMeanSquare();
Root mean square
double geometricMean();
Geometric mean
double harmonicMean();
Harmonic mean
double coefficientOfVariation();
Coefficient of variation
double indexOfDispersion();
Index Of Dispersion
double zeroCrossing();
Zero crossing
double zeroCrossingRate();
Zero crossing Rate = zeroCrossing()/samples()
void reset();
Reset values.
void add(double x, double y);
Add samples to statistics
double correlation();
Calculate correlation coefficient between X and Y (use Pearson's correlation)
double pearsonCorrelation();
Calculate Pearson's correlation coefficient between X and Y
double spearmanCorrelation();
Calculate Spearman's correlation coefficient between X and Y (aproximation using Pearson, valid with more of 20 samples)
double covar();
Calculate covariance
double calculateLinearRegression(double x);
Calculate linear regression. Estimates y value from parameter x
void parametersLinearRegression(double values[]);
Return parameters m and b. y = m*x +b values[0] = m; values[1] = b;
void centroid(double values[]);
Calculate centroid.
values[0] = stX.center();
values[1] = stY.center();
void centerOfGravity(double values[]);
Calculate center of gravity
values[0] = stX.mean();
values[1] = stY.mean();
void centerOfMassXY();
Calculate center of mass. Use Y as mass and X as distance
sumXY()/stY.sum();
void centerOfMassXY();
Calculate center of mass. Use X as mass and Y as distance
sumXY()/stX.sum();
void sumXY();
Aproximation of summation X*Y
double samples();
Number of samples added
void reset();
Reset values
Statistics stX;
Statistics object for X values
Statistics sty;
Statistics object for Y values
void add(int ey, int y);
Learns one example.
- ey: value of estimated Y
- y: value of Y
Return abs(ey-y)
double RMSE();
Return Root mean squared error
double MSE();
Return Mean squared error
double MAE();
Return Mean absolute error
double total();
Return aprox. to sum of all error
void reset();
Reset values. Delete all values
void samples();
Return number of samples used