Package {correctedWS}


Type: Package
Title: Corrected Welch-Satterthwaite Degrees of Freedom
Version: 0.1.0
Description: Calculates corrected Welch-Satterthwaite effective degrees of freedom for weighted sums of independent variance components. Provides corrected-default one-sample, paired, and two-sample t-tests, together with the classical Welch-Satterthwaite calculation for explicit comparison.
License: CC0
URL: https://github.com/cycologist/Corrected-Welch-Satterthwaite
BugReports: https://github.com/cycologist/Corrected-Welch-Satterthwaite/issues
Encoding: UTF-8
RoxygenNote: 7.3.3
NeedsCompilation: no
Imports: stats
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
Packaged: 2026-11-03 12:11:15 UTC; matthias
Author: Matthias von Davier [aut, cre]
Maintainer: Matthias von Davier <mvondavier@gmail.com>
Repository: CRAN
Date/Publication: 2026-11-23 15:00:21 UTC

Corrected Welch-Satterthwaite Degrees of Freedom

Description

Corrected Welch-Satterthwaite effective degrees of freedom for weighted sums of independent variance components, with corrected-default t-test utilities.

Details

The package implements the corrected estimator described in von Davier (2026): the denominator uses nu + 2 and the result subtracts 2. The classical calculation remains available through ws_classical() and method = "classical".

See Also

cws, corrected_t_test


One- and Two-Sample t-Tests with Corrected Default Degrees of Freedom

Description

Performs one-sample, paired, pooled two-sample, or unequal-variance two-sample t-tests. The corrected Welch-Satterthwaite calculation is the default for the unequal-variance two-sample case.

Usage

corrected_t_test(x, y = NULL, alternative = c("two.sided", "less", "greater"),
  mu = 0, paired = FALSE, var.equal = FALSE, conf.level = 0.95,
  method = c("corrected", "classical"))

Arguments

x

Numeric vector of observations.

y

Optional numeric vector for a two-sample or paired test.

alternative

Alternative hypothesis: "two.sided", "less", or "greater".

mu

Null mean or null difference in means.

paired

Logical; perform a paired test when TRUE.

var.equal

Logical; use the pooled-variance test for an independent two-sample test.

conf.level

Confidence level for the interval.

method

"corrected" by default, or "classical" for the usual Welch-Satterthwaite calculation.

Value

An object of class "htest".

Examples

corrected_t_test(1:10, y = 2:11)
corrected_t_test(1:10, y = 2:11, method = "classical")

Corrected Welch-Satterthwaite Effective Degrees of Freedom

Description

Calculates corrected effective degrees of freedom for a weighted sum of independent variance components.

Usage

cws(s2, nu, w = rep(1, length(s2)))

Arguments

s2

Numeric vector of estimated variance components.

nu

Numeric vector of component degrees of freedom.

w

Numeric vector of positive weights.

Value

A single numeric corrected effective degrees of freedom, or NA_real_ when the denominator is zero.

Examples

cws(c(2, 3), c(10, 20))
cws(c(2, 3), c(10, 20), c(1, 2))

Corrected Welch-Satterthwaite Calculation for Two Components

Description

Convenience wrapper for the corrected Welch-Satterthwaite calculation with two variance components.

Usage

cws2(s2_1, s2_2, nu_1, nu_2, w1 = 1, w2 = 1)

Arguments

s2_1

First estimated variance component.

s2_2

Second estimated variance component.

nu_1

Degrees of freedom for the first component.

nu_2

Degrees of freedom for the second component.

w1

Positive first-component weight.

w2

Positive second-component weight.

Value

A single numeric corrected effective degrees of freedom.

Examples

cws2(2, 3, 10, 20)
cws2(4, 9, 5, 8, w1 = 2, w2 = 3)

Classical Welch-Satterthwaite Effective Degrees of Freedom

Description

Calculates the classical Welch-Satterthwaite effective degrees of freedom for explicit comparison with the corrected estimator.

Usage

ws_classical(s2, nu, w = rep(1, length(s2)))

Arguments

s2

Numeric vector of estimated variance components.

nu

Numeric vector of component degrees of freedom.

w

Numeric vector of positive weights.

Value

A single numeric classical Welch-Satterthwaite effective degrees of freedom.

Examples

ws_classical(c(1, 1), c(1, 2))