protocol
statisticspï
Statistical calculations over a list of numbers protocol.
logtalk_load(statistics(loader))staticPublic predicatesï
product/2ï
Calculates the product of all list numbers. Fails if the list is empty.
staticproduct(List,Product)product(+list(number),-number) - zero_or_onesum/2ï
Calculates the sum of all list numbers. Fails if the list is empty.
staticsum(List,Sum)sum(+list(number),-number) - zero_or_onemin/2ï
Determines the minimum value in a list of numbers. Fails if the list is empty.
staticmin(List,Minimum)min(+list,-number) - zero_or_onemax/2ï
Determines the list maximum value in a list of numbers. Fails if the list is empty.
staticmax(List,Maximum)max(+list,-number) - zero_or_onemin_max/3ï
Determines the minimum and maximum values in a list of numbers. Fails if the list is empty.
staticmin_max(List,Minimum,Maximum)min_max(+list(number),-number,-number) - zero_or_onerange/2ï
Range is the length of the smallest interval which contains all the numbers in List. Fails if the list is empty.
staticrange(List,Range)range(+list,-number) - zero_or_onearithmetic_mean/2ï
Calculates the arithmetic mean of a list of numbers. Fails if the list is empty.
staticarithmetic_mean(List,Mean)arithmetic_mean(+list(number),-float) - zero_or_onegeometric_mean/2ï
Calculates the geometric mean of a list of numbers. Fails if the list is empty.
staticgeometric_mean(List,Mean)geometric_mean(+list(number),-float) - zero_or_oneharmonic_mean/2ï
Calculates the harmonic mean of a list of numbers. Fails if the list is empty.
staticharmonic_mean(List,Mean)harmonic_mean(+list(number),-float) - zero_or_oneweighted_mean/3ï
Calculates the weighted mean of a list of numbers. Fails if the list is empty or if the two lists have different lengths. Weights are assumed to be non-negative.
staticweighted_mean(Weights,List,Mean)weighted_mean(+list(number),+list(number),-float) - zero_or_onemedian/2ï
Calculates the median of a list of numbers. Fails if the list is empty.
staticmedian(List,Median)median(+list(number),-float) - zero_or_onemodes/2ï
Returns the list of modes of a list of numbers in ascending order. Fails if the list is empty.
staticmodes(List,Modes)modes(+list(number),-list(number)) - zero_or_oneaverage_deviation/3ï
Calculates the average absolute deviation of a list of numbers given a central tendency (e.g., mean, median, or mode). Fails if the list is empty.
staticaverage_deviation(List,CentralTendency,Deviation)average_deviation(+list(number),+float,-float) - zero_or_onemean_deviation/2ï
Calculates the mean absolute deviation of a list of numbers. Fails if the list is empty.
staticmean_deviation(List,Deviation)mean_deviation(+list(number),-float) - zero_or_onemedian_deviation/2ï
Calculates the median absolute deviation of a list of numbers. Fails if the list is empty.
staticmedian_deviation(List,Deviation)median_deviation(+list(number),-float) - zero_or_onestandard_deviation/2ï
Calculates the standard deviation of a list of numbers. Fails if the list is empty.
staticstandard_deviation(List,Deviation)standard_deviation(+list(number),-float) - zero_or_onecoefficient_of_variation/2ï
Calculates the coefficient of variation of a list of numbers. Fails if the list is empty.
staticcoefficient_of_variation(List,Coefficient)coefficient_of_variation(+list(number),-float) - zero_or_onerelative_standard_deviation/2ï
Calculates the relative standard deviation of a list of numbers. Fails if the list is empty.
staticrelative_standard_deviation(List,Percentage)relative_standard_deviation(+list(number),-float) - zero_or_oneskewness/2ï
Calculates the (moment) skewness of a list of numbers. Fails if the list is empty.
staticskewness(List,Skewness)skewness(+list(number),-float) - zero_or_onekurtosis/2ï
Calculates the (excess) kurtosis of a list of numbers. Fails if the list is empty.
statickurtosis(List,Kurtosis)kurtosis(+list(number),-float) - zero_or_onevariance/2ï
Calculates the unbiased variance of a list of numbers. Fails if the list is empty.
staticvariance(List,Variance)variance(+list(number),-float) - zero_or_onez_normalization/2ï
Normalizes a list of number such that for the resulting list the mean of is close to zero and the standard deviation is close to 1. Fails if the list is empty.
staticz_normalization(List,NormalizedList)z_normalization(+list(number),-list(float)) - zero_or_onefractile/3ï
Calculates the smallest value in a list of numbers such that the list elements in its fraction P are less or equal to that value (with P in the open interval (0.0, 1.0)). Fails if the list is empty.
staticfractile(P,List,Fractile)fractile(+float,+list(integer),-integer) - zero_or_onefractile(+float,+list(float),-float) - zero_or_onepercentile/3ï
Calculates the P-th percentile of a list of numbers (with P in the open interval (0, 100)). Fails if the list is empty.
staticpercentile(P,List,Percentile)percentile(+number,+list(number),-number) - zero_or_onequartiles/4ï
Calculates the quartiles (Q1, Q2, Q3) of a list of numbers. Q2 is the median. Q1 and Q3 are the medians of the lower and upper halves, respectively. Fails if the list has fewer than two elements.
staticquartiles(List,Q1,Q2,Q3)quartiles(+list(number),-number,-number,-number) - zero_or_oneinterquartile_range/2ï
Calculates the interquartile range (Q3 - Q1) of a list of numbers. Fails if the list has fewer than two elements.
staticinterquartile_range(List,IQR)interquartile_range(+list(number),-number) - zero_or_onecovariance/3ï
Calculates the covariance of two lists of numbers. Fails if the lists are empty or have different lengths.
staticcovariance(List1,List2,Covariance)covariance(+list(number),+list(number),-float) - zero_or_onecorrelation/3ï
Calculates the Pearson correlation coefficient of two lists of numbers. Fails if the lists are empty or have different lengths.
staticcorrelation(List1,List2,Correlation)correlation(+list(number),+list(number),-float) - zero_or_onerank_correlation/3ï
Calculates the Spearman rank correlation coefficient of two lists of numbers. Handles ties using average ranks. Fails if the lists are empty or have different lengths.
staticrank_correlation(List1,List2,Correlation)rank_correlation(+list(number),+list(number),-float) - zero_or_onetrimmed_mean/3ï
Calculates the trimmed mean of a list of numbers by removing a fraction of extreme values from both ends (with the fraction in the half-open interval [0.0, 0.5)). Fails if the list is empty or if too many elements would be trimmed.
statictrimmed_mean(Fraction,List,Mean)trimmed_mean(+float,+list(number),-float) - zero_or_onesum_of_squares/2ï
Calculates the sum of squared deviations from the arithmetic mean of a list of numbers. Fails if the list is empty.
staticsum_of_squares(List,Sum)sum_of_squares(+list(number),-float) - zero_or_onecentral_moment/3ï
Calculates the K-th central moment of a list of numbers. The K-th central moment is the mean of the deviations from the mean raised to the power K (with K > 0). Fails if the list is empty.
staticcentral_moment(K,List,Moment)central_moment(+positive_integer,+list(number),-float) - zero_or_onemin_max_normalization/2ï
Normalizes a list of numbers to the interval [0.0, 1.0] using min-max normalization. Fails if the list is empty or if all values are equal.
staticmin_max_normalization(List,NormalizedList)min_max_normalization(+list(number),-list(float)) - zero_or_onefrequency_distribution/2ï
Computes the frequency distribution of a list of numbers, returning a list of Value-Count pairs in ascending order of value. Fails if the list is empty.
staticfrequency_distribution(List,Distribution)frequency_distribution(+list(number),-list(pair(number,integer))) - zero_or_onestandard_error/2ï
Calculates the standard error of the mean of a list of numbers. Fails if the list is empty.
staticstandard_error(List,Error)standard_error(+list(number),-float) - zero_or_onemean_squared_error/3ï
Calculates the mean squared error between two lists of numbers. Fails if the lists are empty or have different lengths.
staticmean_squared_error(List1,List2,Error)mean_squared_error(+list(number),+list(number),-float) - zero_or_oneroot_mean_squared_error/3ï
Calculates the root mean squared error between two lists of numbers. Fails if the lists are empty or have different lengths.
staticroot_mean_squared_error(List1,List2,Error)root_mean_squared_error(+list(number),+list(number),-float) - zero_or_onevalid/1ï
Term is a closed list of numbers.
staticvalid(Term)valid(@nonvar) - zero_or_oneProtected predicatesï
(none)
Private predicatesï
(none)
Operatorsï
(none)
See also