Statwise.TTest (Statwise v0.1.0)

Copy Markdown View Source

Public t-test API.

Supports one-dimensional finite numeric lists and one-dimensional Nx tensors. NaN handling is controlled with nan_policy: :raise | :propagate | :omit. Degenerate zero-standard-error tests return explicit :nan, :infinity, or :neg_infinity statistics.

T-test results include a confidence_interval map. The interval parameter is the sample mean for one-sample tests and the mean difference for paired and independent tests. Pass effect_size: true to include Cohen's d and Hedges' g in effect_size.

Summary

Types

sample()

@type sample() :: [number() | :nan] | Nx.Tensor.t()

Functions

independent(x, y_or_opts)

@spec independent(sample(), sample()) :: Statwise.TestResult.t()

Runs an independent two-sample t-test.

Options include :variance, :alternative, :null_difference, :confidence_level, :effect_size, and :nan_policy. Use independent(data, columns: [:x, :y]) or independent(data, pairs: [x: :y]) for dataframe columns.

independent(x, y, opts)

@spec independent(sample(), sample(), keyword()) :: Statwise.TestResult.t()

one_sample(sample_or_data, opts \\ [])

@spec one_sample(
  sample() | term(),
  keyword()
) :: Statwise.TestResult.t() | map()

Runs a one-sample t-test.

Options include :mean, :alternative, :confidence_level, :effect_size, and :nan_policy. Pass columns: column_or_columns to run against columns from a dataframe-like value.

paired(before, after_or_opts)

@spec paired(sample(), sample()) :: Statwise.TestResult.t()

Runs a paired t-test.

Options include :alternative, :confidence_level, :effect_size, and :nan_policy. Use paired(data, columns: [:before, :after]) or paired(data, pairs: [before: :after]) for dataframe columns.

paired(before, after_sample, opts)

@spec paired(sample(), sample(), keyword()) :: Statwise.TestResult.t()