Package-level declarations

Types

Link copied to clipboard

Specifies the direction of the alternative hypothesis in a statistical test.

Link copied to clipboard
data class AnovaResult(val fStatistic: Double, val pValue: Double, val dfBetween: Int, val dfWithin: Int, val ssBetween: Double, val ssWithin: Double, val msBetween: Double, val msWithin: Double)

The result of a one-way ANOVA test.

Link copied to clipboard

Selects the method used to compute the confidence interval for a proportion.

Link copied to clipboard
data class GrubbsIterativeResult(val outlierIndices: List<Int>, val cleanedData: DoubleArray, val iterations: List<TestResult>)

The result of an iterative Grubbs' test for multiple outlier detection.

Link copied to clipboard

Specifies which center statistic to use when computing deviations in leveneTest.

Link copied to clipboard
data class RiskEstimate(val estimate: Double, val ci: ConfidenceInterval, val confidenceLevel: Double)

The result of a risk or association measure computed from a 2×2 contingency table.

Link copied to clipboard
data class TestResult(val testName: String, val statistic: Double, val pValue: Double, val degreesOfFreedom: Double = Double.NaN, val alternative: Alternative = Alternative.TWO_SIDED, val confidenceInterval: ConfidenceInterval? = null, val additionalInfo: Map<String, Double> = emptyMap())

The result of a statistical hypothesis test.

Link copied to clipboard

Specifies the design of the t-test for power analysis calculations.

Functions

Link copied to clipboard

Performs the Anderson-Darling test for normality.

Link copied to clipboard
fun bartlettTest(vararg groups: DoubleArray): TestResult

Performs Bartlett's test for equality of variances across two or more groups.

Link copied to clipboard

Adjusts p-values using the Benjamini-Hochberg procedure for false discovery rate control.

Link copied to clipboard
fun binomialTest(successes: Int, trials: Int, probability: Double = 0.5, alternative: Alternative = Alternative.TWO_SIDED, confidenceLevel: Double = 0.95, ciMethod: CIMethod = CIMethod.CLOPPER_PEARSON): TestResult

Performs an exact binomial test for whether the proportion of successes equals probability.

Link copied to clipboard

Adjusts p-values using the Bonferroni correction for multiple comparisons.

Link copied to clipboard

Performs a chi-squared test of independence for a contingency table.

Link copied to clipboard
fun chiSquaredTest(observed: IntArray, expected: DoubleArray? = null): TestResult

Performs a chi-squared goodness-of-fit test.

Link copied to clipboard
fun cohensD(x: DoubleArray, y: DoubleArray, pooled: Boolean = true): Double

Computes Cohen's d effect size for the standardized mean difference between two groups.

Link copied to clipboard
fun cohensH(p1: Double, p2: Double): Double

Computes Cohen's h effect size for the difference between two proportions.

Link copied to clipboard

Performs the D'Agostino-Pearson omnibus normality test.

Link copied to clipboard
fun fisherExactTest(table: Array<IntArray>, alternative: Alternative = Alternative.TWO_SIDED): TestResult

Performs Fisher's exact test for a 2x2 contingency table.

Link copied to clipboard

Performs the Fligner-Killeen test for equality of variances across two or more groups.

Link copied to clipboard
fun friedmanTest(vararg groups: DoubleArray): TestResult

Performs the Friedman test for differences among repeated measures.

Link copied to clipboard
fun gIndependenceTest(contingencyTable: Array<IntArray>): TestResult

Performs a G-test (log-likelihood ratio test) of independence for a contingency table.

Link copied to clipboard
fun grubbsTest(sample: DoubleArray, alternative: Alternative = Alternative.TWO_SIDED): TestResult

Performs Grubbs' test for detecting a single outlier in a univariate dataset.

Link copied to clipboard
fun grubbsTestIterative(sample: DoubleArray, alpha: Double = 0.05, alternative: Alternative = Alternative.TWO_SIDED): GrubbsIterativeResult

Performs iterative Grubbs' test to detect multiple outliers.

Link copied to clipboard
fun gTest(observed: IntArray, expected: DoubleArray? = null): TestResult

Performs a G-test (log-likelihood ratio test) for goodness-of-fit.

Link copied to clipboard
fun hedgesG(x: DoubleArray, y: DoubleArray, pooled: Boolean = true): Double

Computes Hedges' g effect size, a bias-corrected version of Cohen's d for small samples.

Link copied to clipboard

Adjusts p-values using the Holm-Bonferroni step-down correction for multiple comparisons.

Link copied to clipboard

Performs the Jarque-Bera goodness-of-fit test for normality.

Link copied to clipboard

Performs a two-sample Kolmogorov-Smirnov test.

Performs a one-sample Kolmogorov-Smirnov test against a reference distribution.

Link copied to clipboard
fun leveneTest(vararg groups: DoubleArray, center: LeveneCenter = LeveneCenter.MEDIAN): TestResult

Performs Levene's test for equality of variances across two or more groups.

Link copied to clipboard
fun mannWhitneyUTest(sample1: DoubleArray, sample2: DoubleArray, alternative: Alternative = Alternative.TWO_SIDED): TestResult

Performs the Mann-Whitney U test (also known as the Wilcoxon rank-sum test).

Link copied to clipboard
fun oddsRatio(table: Array<IntArray>, confidenceLevel: Double = 0.95): RiskEstimate

Computes the odds ratio with a Woolf logit confidence interval for a 2×2 contingency table.

Link copied to clipboard
fun oneWayAnova(vararg groups: DoubleArray): AnovaResult

Performs a one-way analysis of variance (ANOVA) test.

Link copied to clipboard
fun pairedTTest(sample1: DoubleArray, sample2: DoubleArray, alternative: Alternative = Alternative.TWO_SIDED, confidenceLevel: Double = 0.95): TestResult

Performs a paired t-test for whether the mean difference between matched observations is zero.

Link copied to clipboard
fun proportionZTest(successes: Int, trials: Int, p0: Double = 0.5, alternative: Alternative = Alternative.TWO_SIDED, confidenceLevel: Double = 0.95): TestResult

Performs a one-sample proportion z-test for whether the true proportion equals p0.

fun proportionZTest(successes1: Int, trials1: Int, successes2: Int, trials2: Int, alternative: Alternative = Alternative.TWO_SIDED, confidenceLevel: Double = 0.95): TestResult

Performs a two-sample proportion z-test for whether two populations have the same proportion.

Link copied to clipboard
fun proportionZTestMinimumEffect(n: Int, power: Double = 0.8, alpha: Double = 0.05, alternative: Alternative = Alternative.TWO_SIDED, twoSample: Boolean = true): Double

Computes the minimum detectable effect size (MDE) for a proportion z-test at the given sample size.

Link copied to clipboard
fun proportionZTestPower(effectSize: Double, n: Int, alpha: Double = 0.05, alternative: Alternative = Alternative.TWO_SIDED, twoSample: Boolean = true): Double

Computes the statistical power of a proportion z-test using the normal approximation.

Link copied to clipboard
fun proportionZTestRequiredN(effectSize: Double, power: Double = 0.8, alpha: Double = 0.05, alternative: Alternative = Alternative.TWO_SIDED, twoSample: Boolean = true): Int

Computes the minimum sample size needed for a proportion z-test to achieve the desired power.

Link copied to clipboard
fun relativeRisk(table: Array<IntArray>, confidenceLevel: Double = 0.95): RiskEstimate

Computes the relative risk with a log-based confidence interval for a 2×2 contingency table.

Link copied to clipboard

Performs the Shapiro-Wilk test for normality.

Link copied to clipboard
fun tTest(sample: DoubleArray, mu: Double = 0.0, alternative: Alternative = Alternative.TWO_SIDED, confidenceLevel: Double = 0.95): TestResult

Performs a one-sample t-test for whether the population mean equals mu.

fun tTest(sample1: DoubleArray, sample2: DoubleArray, alternative: Alternative = Alternative.TWO_SIDED, equalVariances: Boolean = false, confidenceLevel: Double = 0.95): TestResult

Performs a two-sample t-test for whether two populations have the same mean.

Link copied to clipboard
fun tTestMinimumEffect(n: Int, power: Double = 0.8, alpha: Double = 0.05, alternative: Alternative = Alternative.TWO_SIDED, type: TTestType = TTestType.TWO_SAMPLE): Double

Computes the minimum detectable effect size (MDE) for a t-test at the given sample size.

Link copied to clipboard
fun tTestPower(effectSize: Double, n: Int, alpha: Double = 0.05, alternative: Alternative = Alternative.TWO_SIDED, type: TTestType = TTestType.TWO_SAMPLE): Double

Computes the statistical power of a t-test using the normal approximation.

Link copied to clipboard
fun tTestRequiredN(effectSize: Double, power: Double = 0.8, alpha: Double = 0.05, alternative: Alternative = Alternative.TWO_SIDED, type: TTestType = TTestType.TWO_SAMPLE): Int

Computes the minimum sample size needed for a t-test to achieve the desired power.

Link copied to clipboard
fun wilcoxonSignedRankTest(sample1: DoubleArray, sample2: DoubleArray? = null, alternative: Alternative = Alternative.TWO_SIDED): TestResult

Performs the Wilcoxon signed-rank test.