MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / evaluateCorrelation

Function evaluateCorrelation

src/compute-engine/library/statistics.ts:901–932  ·  view source on GitHub ↗
(
  ce: ComputeEngine,
  ops: ReadonlyArray<Expression>,
  numericApproximation: boolean
)

Source from the content-addressed store, hash-verified

899 // Symbolic data: stay inert rather than fold a valueless symbol to
900 // `NaN` — see `collectData`. One walk feeds both paths below.
901 const xs = collectData(ops);
902 if (xs === null) return undefined;
903 const nonReal = nonRealUnivariateError(
904 engine,
905 'InterquartileRange',
906 xs
907 );
908 if (nonReal) return nonReal;
909 // A datum with no real value leaves the sort with nothing to order by
910 // — see `hasValuelessDatum`.
911 if (hasValuelessDatum(xs)) return engine.NaN;
912 if (!numericApproximation) {
913 const vals = exactData(xs);
914 if (vals) {
915 const [q1, , q3] = exactQuartiles(engine, vals);
916 return subtract(engine, q3, q1);
917 }
918 }
919 return engine.number(
920 bignumPreferred(engine)
921 ? bigInterquartileRange(bigScalarsOf(xs))
922 : interquartileRange(scalarsOf(xs))
923 );
924 },
925 },
926
927 Histogram: {
928 description:
929 'Compute a histogram of the values in a collection. Returns a list of (bin start, count) tuples.',
930 complexity: 8200,
931 // The bin spec accepts any number so Desmos-style `histogram(L, .05)`
932 // (bin *width*) parses; a non-integer count is inert at evaluate
933 // (`computeBinning` returns undefined) — width semantics are the
934 // importer's to translate (e.g. to explicit bin edges).
935 signature:

Callers 1

statistics.tsFile · 0.85

Calls 11

bignumPreferredFunction · 0.90
bigCorrelationFunction · 0.90
correlationFunction · 0.90
extractPairsFunction · 0.85
shapeErrorFunction · 0.85
allExactFunction · 0.85
exactCorrelationFunction · 0.85
bigValsFunction · 0.85
machineValsFunction · 0.85
errorMethod · 0.65
numberMethod · 0.65

Tested by

no test coverage detected