rStats.js v1.3.0
    Preparing search index...

    Function tTOST

    • Two one-sided t tests (TOST) of equivalence, or minimal-effect tests, for one sample, two samples or paired samples, with the standardised mean difference and its interval. Equivalent to TOSTER::t_TOST() in R.

      With hypothesis: "EQU" (the default) equivalence, low < difference < high, is shown at level alpha when both the test of the lower bound (alternative "greater") and that of the upper bound (alternative "less") reject; the p-value is the larger of the two. With "MET" the alternatives are reversed and the p-value is the smaller. The effect is the difference minus mu: mean(x) - mean(y) - mu (two samples, Welch's or pooled), the mean of x - y minus mu (paired) or the mean of x minus mu (one sample). The bounds, the raw estimate and interval and the standardised difference all refer to that effect. The intervals are 1 - 2 alpha intervals (90% for the default alpha 0.05).

      The standardised difference is Hedges' g (Cohen's d without biasCorrection) with the average SD sqrt((s1² + s2²)/2) for Welch's test, the pooled SD with varEqual, the SD of the differences for paired samples (d_z, or d_rm with rmCorrection), the SD of one sample with glass, or the SD for one sample. Its interval is from the noncentral t ("nct", as exact roots; TOSTER's optimiser is about 1e-9 accurate), Goulet-Pelletier and Cousineau's ("goulet"), or g -+ q se with a t or normal quantile ("t", "z").

      Differences from TOSTER (decisions 20-23 of oracle/methodcomparison-behaviour.md): mu is subtracted everywhere (TOSTER tests the bounds on the difference itself, gives the raw interval of the difference, the two-sample SMD of the difference plus mu and the paired SMD without mu); the one-sample "t" and "z" intervals of the standardised difference are 1 - 2 alpha intervals (TOSTER's 1 - alpha); TOSTER's notes are warnings; alpha must be in (0, 0.5). With mu 0 only the last three apply.

      With 2 observations (df 1) Hedges' correction J(1) is 0: the bias-corrected standardised difference is 0 (and its "nct" interval), and some of its standard errors and intervals are NaN or infinite, as TOSTER's formulas give.

      Parameters

      • x: Sample

        Sample (NaN values are dropped; for paired samples, the pairs with a NaN).

      • Optionaly: Sample

        Second sample (omit for one sample).

      • options: TTOSTOptions = {}

        See TTOSTOptions; the bounds are required.

      Returns TTOSTResult

      See TTOSTResult.

      TypeError without bounds, for options of the wrong type, or for samples that are not arrays of numbers (null or strings in them); RangeError for infinite values, alpha outside (0, 0.5), bounds that are not finite or in the wrong order, an unknown choice, or fewer than 2 observations in a sample; Error where the t test has too few observations or the data are essentially constant.

      const r = tTOST([5.1, 4.9, 5.6, 5.8, 6.0, 5.4, 5.2, 6.1], [5.3, 5.0, 5.5, 5.7, 5.9, 5.2, 4.8, 5.6, 5.0], { eqb: 0.5 });
      r.pValue; // 0.06280707532313813
      r.raw.confInt; // [-0.16777332363212605, 0.5261066569654603] (90%)
      r.smd.label; // "Hedges's g(av)"