import type { TransformLineage, TransformValue, TransformValueOutput } from './transform.js'; import type { Channel, ChannelOutput, CartesianScaleBindings, ChartKey, ChartMark, ChartMarkMotionOptions, ChartMotionDefinition } from './types.js'; type RegressionIndependentValue = number | Date; interface LinearRegressionOptions extends ChartMarkMotionOptions, CartesianScaleBindings { id?: string; /** Fits one independent regression for each series value. */ z?: Channel; /** Confidence level for the fitted mean. Defaults to 0.95; use 0 to hide. */ ci?: number; /** Number of semantic independent-domain samples. Defaults to 64. */ samples?: number; stroke?: string; strokeOpacity?: number; strokeWidth?: number; strokeDasharray?: string; /** Defaults to the line stroke. */ fill?: string; fillOpacity?: number; } export interface LinearRegressionYDatum extends TransformLineage { readonly x: TXValue; readonly y: number; readonly y1?: number; readonly y2?: number; readonly group: TGroup; } export interface LinearRegressionXDatum extends TransformLineage { readonly x: number; readonly x1?: number; readonly x2?: number; readonly y: TYValue; readonly group: TGroup; } export interface LinearRegressionRowsYOptions = TransformValue, TY extends TransformValue = TransformValue, TZ extends TransformValue | undefined = TransformValue | undefined> { readonly x: TX; readonly y: TY; /** Fits one independent regression for each valid series value. */ readonly z?: TZ; /** Confidence level for the fitted mean. Defaults to 0.95; use 0 to omit. */ readonly ci?: number; /** Number of semantic x-domain samples. Defaults to 64. */ readonly samples?: number; } export interface LinearRegressionRowsXOptions = TransformValue, TY extends TransformValue = TransformValue, TZ extends TransformValue | undefined = TransformValue | undefined> { readonly x: TX; readonly y: TY; /** Fits one independent regression for each valid series value. */ readonly z?: TZ; /** Confidence level for the fitted mean. Defaults to 0.95; use 0 to omit. */ readonly ci?: number; /** Number of semantic y-domain samples. Defaults to 64. */ readonly samples?: number; } export interface LinearRegressionYOptions extends LinearRegressionOptions> { x: Channel; y: Channel; } export interface LinearRegressionXOptions extends LinearRegressionOptions> { x: Channel; y: Channel; } type IndependentOutput = Extract, RegressionIndependentValue>; type NormalizedRegressionGroup = Extract | ([Extract] extends [never] ? never : null); type RegressionGroupOutput = TZ extends TransformValue ? NormalizedRegressionGroup> : null; type LinearRegressionYCallOptions, RegressionIndependentValue | null | undefined>> = Omit>, 'motion' | 'x'> & { x: TXChannel; motion?: ChartMotionDefinition>>; }; type LinearRegressionXCallOptions, RegressionIndependentValue | null | undefined>> = Omit>, 'motion' | 'y'> & { y: TYChannel; motion?: ChartMotionDefinition>>; }; /** Fits and samples least-squares y rows with direct source lineage. */ export declare function linearRegressionRowsY, const TY extends TransformValue, const TZ extends TransformValue | undefined = undefined>(source: Iterable, options: LinearRegressionRowsYOptions): LinearRegressionYDatum, RegressionIndependentValue>, RegressionGroupOutput>[]; /** Fits and samples least-squares x rows with direct source lineage. */ export declare function linearRegressionRowsX, const TY extends TransformValue, const TZ extends TransformValue | undefined = undefined>(source: Iterable, options: LinearRegressionRowsXOptions): LinearRegressionXDatum, RegressionIndependentValue>, RegressionGroupOutput>[]; /** Fits least-squares y-values from raw observations. */ export declare function linearRegressionY, RegressionIndependentValue | null | undefined>, const TXScaleId extends string = 'x', const TYScaleId extends string = 'y'>(source: Iterable, options: LinearRegressionYCallOptions & { xScale?: TXScaleId; yScale?: TYScaleId; }): ChartMark>, IndependentOutput, number, IndependentOutput, number, TXScaleId, TYScaleId>; /** Fits least-squares x-values from raw observations. */ export declare function linearRegressionX, RegressionIndependentValue | null | undefined>, const TXScaleId extends string = 'x', const TYScaleId extends string = 'y'>(source: Iterable, options: LinearRegressionXCallOptions & { xScale?: TXScaleId; yScale?: TYScaleId; }): ChartMark>, number, IndependentOutput, number, IndependentOutput, TXScaleId, TYScaleId>; export {};