Learn R Programming

wstdiff (version 1.0.0)

ws_tdiff_equal_params: Equal Parameters Special Case

Description

Computes the Welch-Satterthwaite approximation for the special case where both distributions have identical parameters.

Usage

ws_tdiff_equal_params(mu, sigma, nu)

Value

An S3 object of class "ws_tdiff_univariate" with the simplified parameters

Arguments

mu

Common location parameter

sigma

Common scale parameter (must be > 0)

nu

Common degrees of freedom (must be > 4)

Details

When X1 ~ t(mu, sigma^2, nu) and X2 ~ t(mu, sigma^2, nu) are independent, the difference Z = X1 - X2 simplifies to:

  • Location: mu_diff = 0

  • Scale: sigma_star = sigma * sqrt(2*nu/(nu-2))

  • Degrees of freedom: nu_star = 2*(nu - 4)

This special case provides validation for the general formulas and computational efficiency when parameters are known to be equal.

Examples

Run this code
# Equal parameters case
result <- ws_tdiff_equal_params(mu = 0, sigma = 1, nu = 10)
print(result)
# nu_star should be 2*(10-4) = 12

# Verify against general formula
general <- ws_tdiff_univariate(0, 1, 10, 0, 1, 10)
all.equal(result$nu_star, general$nu_star)

Run the code above in your browser using DataLab