statisticsï
The entities in this library define some useful predicates for
descriptive statistics. Data is represented as a list of numbers
(integers or floats). Use the object sample if your data represents
a sample. Use the object population if your data represents a
population.
The variance/2, standard_deviation/2, skewness/2,
kurtosis/2, covariance/3, standard_error/2,
correlation/3, and rank_correlation/3 predicates use different
formulas depending on whether the data represents a sample (dividing by
N-1) or a population (dividing by N). All other predicates share the
same implementation.
API documentationï
Open the ../../apis/library_index.html#statistics link in a web browser.
Loadingï
To load all entities in this library, load the loader.lgt file:
| ?- logtalk_load(statistics(loader)).
Testingï
To test this library predicates, load the tester.lgt file:
| ?- logtalk_load(statistics(tester)).
API overviewï
Aggregationï
Predicate |
Description |
|---|---|
|
Product of all list numbers |
|
Sum of all list numbers |
Extremes and Rangeï
Predicate |
Description |
|---|---|
|
Minimum value |
|
Maximum value |
|
Minimum and maximum values |
|
Range (max - min) |
Central Tendencyï
Predicate |
Description |
|---|---|
|
Arithmetic mean |
|
Geometric mean |
|
Harmonic mean |
|
Weighted mean |
|
Trimmed mean (removing a fraction of extreme values) |
|
Median |
|
Modes (in ascending order) |
Measures of Position / Quantilesï
Predicate |
Description |
|---|---|
|
Fractile (quantile given a fraction in (0.0, 1.0)) |
|
Percentile (quantile given a value in (0, 100)) |
|
Quartiles (Q1, Q2, Q3) |
|
Interquartile range (Q3 - Q1) |
Measures of Dispersionï
Predicate |
Description |
|---|---|
|
Variance (sample or population) |
|
Standard deviation (sample or population) |
|
Mean absolute deviation |
|
Median absolute deviation |
|
Average absolute deviation from a given central tendency |
|
Coefficient of variation |
|
Relative standard deviation (percentage) |
|
Sum of squared deviations from the mean |
|
Standard error of the mean |
Measures of Shapeï
Predicate |
Description |
|---|---|
|
Moment skewness (sample or population) |
|
Excess kurtosis (sample or population) |
|
K-th central moment |
Measures of Associationï
Predicate |
Description |
|---|---|
|
Covariance (sample or population) |
|
Pearson correlation coefficient |
|
Spearman rank correlation coefficient |
Error Metricsï
Predicate |
Description |
|---|---|
|
Mean squared error between two lists |
|
Root mean squared error between two lists |
Normalizationï
Predicate |
Description |
|---|---|
|
Z-score normalization (mean ~= 0, std ~= 1) |
|
Min-max normalization (rescale to [0, 1]) |
Frequency / Countingï
Predicate |
Description |
|---|---|
|
Frequency distribution (Value-Count pairs) |
Validationï
Predicate |
Description |
|---|---|
|
Term is a closed list of numbers |