/** * Pure statistical utility functions for analytical tools. * * All functions operate on number arrays. Empty arrays throw. * No NaN propagation — edge cases return defined values. * No runtime dependencies. */ export declare function percentile(values: number[], percent: number): number; export declare function circularStats(minutes: number[]): { mean: number | null; sd: number | null; }; /** * Arithmetic mean. * @throws Error if values is empty */ export declare function mean(values: number[]): number; /** * Median — middle value (average of two middle for even-length). * Does not mutate the input array. * @throws Error if values is empty */ export declare function median(values: number[]): number; /** * Population standard deviation. * Returns 0 for a single value or constant array. * @throws Error if values is empty */ export declare function standardDeviation(values: number[]): number; /** Result of linear regression */ export interface LinearRegressionResult { /** Slope per unit index */ slope: number; /** R² goodness of fit (0–1) */ r2: number; } /** * Simple linear regression on values indexed 0, 1, 2, ... * * Returns slope (change per index) and R² (coefficient of determination). * Single value or constant values return { slope: 0, r2: 0 }. * * @throws Error if values is empty */ export declare function linearRegression(values: number[]): LinearRegressionResult; /** A detected anomaly */ export interface Anomaly { /** Index in the input array */ index: number; /** The anomalous value */ value: number; /** Number of standard deviations from the mean */ deviation: number; } /** * Detect values more than `threshold` standard deviations from the mean. * * Returns empty array for constant values or single value (stddev=0). * * @param values - Data points * @param threshold - Number of σ for anomaly detection (default: 2) * @throws Error if values is empty */ export declare function detectAnomalies(values: number[], threshold?: number): Anomaly[]; /** Trend direction classification */ export type TrendDirectionResult = "improving" | "declining" | "stable"; /** * Classify a trend based on slope and R². * * R² thresholds: * - ≤ 0.4: low confidence → always "stable" * - > 0.4: sufficient confidence → use slope sign * * Near-zero slopes (|slope| < 0.001) are always "stable". */ export declare function trendDirection(slope: number, r2: number): TrendDirectionResult; //# sourceMappingURL=stats-utils.d.ts.map