/** * Calculates the arithmetic mean of an array of numbers. * * @param data - The data to calculate the mean for. * @returns The mean of the data. * @throws Will throw an error if the data array is empty. * @example * const data = [1, 2, 3, 4, 5]; * const meanValue = mean(data); * console.log(meanValue); // Output: 3 */ export declare function arithmeticMean(data: number[]): number; /** * Calculates the median of an array of numbers. * * @param data - The data to calculate the median for. * @returns The median of the data. * @throws Will throw an error if the data array is empty. * @example * const data = [1, 2, 3, 4, 5]; * const medianValue = median(data); * console.log(medianValue); // Output: 3 */ export declare function median(data: number[]): number; /** * Calculates the t-statistic for an independent two-sample t-test. * @param mean1 - The mean of the first sample. * @param mean2 - The mean of the second sample. * @param s1 - The standard deviation of the first sample. * @param s2 - The standard deviation of the second sample. * @param n1 - The number of samples in the first sample. * @param n2 - The number of samples in the second sample. * @returns The t-statistic. */ export declare function calculateTStatistic(mean1: number, mean2: number, s1: number, s2: number, n1: number, n2: number): number; /** * Calculates the degrees of freedom for an independent two-sample t-test using the Welch-Satterthwaite equation. * @param s1 - The standard deviation of the first sample. * @param s2 - The standard deviation of the second sample. * @param n1 - The number of samples in the first sample. * @param n2 - The number of samples in the second sample. * @returns The degrees of freedom. * @see {@link https://statkat.com/degrees-of-freedom-t-test.php} */ export declare function calculateDegreesOfFreedom(s1: number, s2: number, n1: number, n2: number): number; /** * Formats a number to ensure consistent p-value calculation. * * This function is used internally by `calculatePValue` to format the result of the * `studT` function. It adds or subtracts a small value (0.0005) to the input number * to ensure that the p-value calculation is consistent across different JavaScript engines * and environments. This helps to avoid subtle differences in the p-value due to floating-point * precision issues. * * @param value - The number to format. * @returns The formatted number. * @internal */ export declare function formatPValue(value: number): number; /** * Calculates the p-value for a given t-statistic and degrees of freedom. * * This function computes the two-tailed p-value for a t-test based on the * provided t-statistic and degrees of freedom. It uses the Student's t-distribution * to calculate the cumulative probability. * * @param tStat - The t-statistic (absolute value). * @param df - The degrees of freedom. * @returns The two-tailed p-value. * @throws Will throw an error if `tStat` or `df` is not a number or if `df` is less than or equal to 0. */ export declare function calculatePValue(tStat: number, df: number): number; /** * Calculates the sample standard deviation. * @param data - The sample data. * @returns The sample standard deviation. */ export declare function sampleStandardDeviation(data: number[]): number; /** * Calculates the sample variance. * @param data - The sample data. * @returns The sample variance. */ export declare function sampleVariance(data: number[]): number; /** * Calculates the percentile of a sorted array. * @param sortedData - The sorted array. * @param percentile - The percentile to calculate (0-100). * @returns The percentile value. */ export declare function getPercentile(sortedData: number[], percentile: number): number; /** * Calculates the relative margin of error for a given mean and standard deviation with a 95% confidence interval. * @param mean - The sample mean. * @param stdDev - The sample standard deviation. * @param n - The number of samples. * @returns The relative margin of error. */ export declare function relativeMarginOfError(mean: number, stdDev: number, n: number): number; /** * Calculates the margin of error for a given standard deviation with a 95% confidence interval. * This is a simplified calculation assuming a normal distribution. * * @param stdDev - The sample standard deviation. * @param n - The number of samples. * @returns The margin of error. */ export declare function marginOfError(stdDev: number, n: number): number; /** * Calculates Cohen's d effect size. * * Cohen's d is a measure of the standardized difference between two means. * It is calculated as the difference between the means divided by the pooled standard deviation. * * @param mean1 - The mean of the first sample. * @param mean2 - The mean of the second sample. * @param s1 - The standard deviation of the first sample. * @param s2 - The standard deviation of the second sample. * @param n1 - The number of samples in the first sample. * @param n2 - The number of samples in the second sample. * @returns Cohen's d. */ export declare function calculateCohensD(mean1: number, mean2: number, s1: number, s2: number, n1: number, n2: number): number; //# sourceMappingURL=statistics.d.ts.map