Learn R Programming

wstdiff (version 1.0.0)

ws_tdiff_univariate: Welch-Satterthwaite Approximation for Univariate t-Differences

Description

Approximates the distribution of the difference between two independent non-standardized t-distributed random variables using the Welch-Satterthwaite method.

Usage

ws_tdiff_univariate(mu1, sigma1, nu1, mu2, sigma2, nu2)

Value

An S3 object of class "ws_tdiff_univariate" containing:

mu_diff

Location parameter of difference (mu1 - mu2)

sigma_star

Effective scale parameter (Equation 1 from paper)

nu_star

Effective degrees of freedom (Equation 2 from paper)

input_params

List of input parameters for reference

method

Character string "univariate"

Arguments

mu1

Location parameter of first distribution

sigma1

Scale parameter of first distribution (must be > 0)

nu1

Degrees of freedom of first distribution (must be > 4)

mu2

Location parameter of second distribution

sigma2

Scale parameter of second distribution (must be > 0)

nu2

Degrees of freedom of second distribution (must be > 4)

Details

For two independent non-standardized t-distributed random variables:

  • X1 ~ t(mu1, sigma1^2, nu1)

  • X2 ~ t(mu2, sigma2^2, nu2)

The difference Z = X1 - X2 is approximated as: Z ~ t(mu1 - mu2, sigma_star^2, nu_star)

where the effective parameters are computed through moment matching:

  • sigma_star matches the variance of Z

  • nu_star is derived from fourth moment matching

The method requires nu1 > 4 and nu2 > 4 for the existence of fourth moments. The approximation quality improves as degrees of freedom increase and approaches exactness as nu -> infinity (normal limit).

References

Yamaguchi, Y., Homma, G., Maruo, K., & Takeda, K. Welch-Satterthwaite Approximation for Difference of Non-Standardized t-Distributed Variables. (unpublished).

See Also

ws_tdiff_equal_params for the special case of equal parameters dtdiff, ptdiff, qtdiff, rtdiff for distribution functions

Examples

Run this code
# Example 1: Different scale parameters
result <- ws_tdiff_univariate(
  mu1 = 0, sigma1 = 1, nu1 = 10,
  mu2 = 0, sigma2 = 1.5, nu2 = 15
)
print(result)

# Example 2: Equal parameters (special case)
result_equal <- ws_tdiff_univariate(
  mu1 = 5, sigma1 = 2, nu1 = 20,
  mu2 = 3, sigma2 = 2, nu2 = 20
)
# Should match ws_tdiff_equal_params(5-3, 2, 20)

Run the code above in your browser using DataLab