## Math Reference

This section contains reference of all the functions in the CL-DS.MATH package.

Symbols in the package CL-DATA-STRUCTURES.MATH:
AVERAGE
Lambda List: (RANGE &KEY KEY SUM COUNT AFTER)
Arguments:
• RANGE, Object to aggregate.
• KEY, Function used to extract value from RANGE element.

Description: Calculate average of elements in the range.
BOOTSTRAP
Lambda List: (RANGE SAMPLE-SIZE SAMPLES-COUNT &KEY CONFIDENCE KEY COMPARE PARALLEL CONTEXT-FUNCTION)
Arguments:
• RANGE, Data for aggregation.
• SAMPLE-SIZE, Size of the single sample.
• SAMPLES-COUNT, Total number of samples drawn.
• CONFIDENCE, Confidence value. High confidence results in wide estimate bounds.
• KEY, Key passed to SORT function.
• COMPARE, Function passed to SORT function.
• PARALLEL, Will use lparallel to evaluate samples if T. Defaults to T.

Description: Changes aggregation into bootstrapping schema using percentail method. Reduces the ammount of resources needed to obtain the value.
Thread Safety: Will process each sample in the lparallel task if PARALLEL is T.
Notes: Don't attempt to mix lparallel used in bootstrap with lparallel used in the aggregation function
HODGES-LEHMANN-ESTIMATOR
Lambda List: (RANGE &KEY KEY PARALLEL AFTER)
Arguments:
• RANGE, Object to aggregate
• KEY, Function used to extract value from element.
• PARALLEL, Will use lparallel for calculations if T.

Description: Calculates Hodges-Lehman estimator for range.
Thread Safety: Will ues lparallel if PARALLEL is T.
• BOOTSTRAP

Notes:
• This estimator has high breakdown point.
• Roboost expected value estimator.
• Time complexity greater then cubic. Memory complexity quadratic.
• Use bootstrapping for more scalable solution.

MOMENTS
Lambda List: (RANGE FROM COUNT ABOUT &KEY KEY AFTER)
Arguments:
• RANGE, Object to aggregate.
• FROM, Positive number. Lowest moment to calculate.
• COUNT, Positive number. How many moments to calculate.
• ABOUT, Number. Value around which moments are calculated.
• KEY, Function used to extract values from elements.

Description: Calculate statistical moments in the range.
Returns: Range. Query it with CL-DS:AT function passing rank of moment that you want to obtain.
MOVING-AVERAGE
Lambda List: (RANGE &KEY KEY)
Arguments:
• RANGE, Object to process.
• KEY, Function used to extract values from the RANGE.

Description: Calculates moving-average for elements in the RANGE.
Returns: Range of all moving-averages.
MUTUAL-INFORMATION
Lambda List: (RANGE FIELDS &KEY KEY)
Description: Calculates mutual-information between FIELD and COMPARATIVE-FIELDS. Elements in each FIELD should be EQUAL comparable.
Returns: Range. Provides access to values for each field by quering cl-ds:at with label of field.
SIMPLE-LINEAR-REGRESSION
Lambda List: (RANGE X-KEY AVERAGE-X Y-KEY AVERAGE-Y &KEY KEY)
Arguments:
• X-KEY, Function used to extract argument from range.
• Y-KEY, Function used to extract result from range.

Description: Matches linear function to RANGE using least squares method.
Returns: Function object. Call with argument to obtain expected result. Pass to beta0 function to obtain beta0 value. Pass to beta1 to obtain beta1 value.
VARIANCE
Lambda List: (RANGE AROUND &KEY KEY BIASED)
Arguments:
• RANGE, Data to aggregate.
• KEY, Function used to extract values from elements.
• BIASED, Boolean. Should result be biased?

Description: Calculates variance.
Returns: Number representing variance.
Notes: Name conflict with alexandria:variance.