Gosset_Welch {DanielBiostatistics10th}R Documentation

Two-Sample Student's t-statistic and Welch–Satterthwaite Equation

Description

To determine the degree of freedom, as well as the standard error, of two-sample t-statistic, with or without the equal-variance assumption.

Usage

Gosset_Welch(s1, s0, v1 = s1^2, v0 = s0^2, n1, n0, var.equal = FALSE)

Arguments

s1, s0

(optional) double scalars or vectors, sample standard deviations s_1 and s_0 of the treatment and control sample, respectively

v1, v0

double scalars or vectors, sample variances of the treatment and control sample, respectively. Default v_1=s_1^2, v_0=s_0^2.

n1, n0

integer scalars or vectors, sample sizes of the treatment and control sample, respectively

var.equal

logical scalar, whether to treat the two variances v_1 and v_0 as being equal when calculating the degree of freedom and the standard error of the mean-difference. If FALSE (default), Welch–Satterthwaite equation is used. If TRUE, the original two-sample t-test from William Sealy Gosset is used. See t.test.default.

Value

Function Gosset_Welch returns a numeric scalar of the degree of freedom, with a numeric scalar attribute 'stderr' of the standard error of the mean-difference.

References

Student's t-test by William Sealy Gosset, doi:10.1093/biomet/6.1.1.

Welch–Satterthwaite equation by Bernard Lewis Welch and F. E. Satterthwaite, doi:10.2307/3002019 and doi:10.1093/biomet/34.1-2.28.

See Also

t.test

Examples

x = rnorm(32L, sd = 1.6); y = rnorm(57L, sd = 2.1)
vx = var(x); vy = var(y); nx = length(x); ny = length(y)
t.test(x, y, var.equal = FALSE)[c('parameter', 'stderr')]
Gosset_Welch(v1 = vx, v0 = vy, n1 = nx, n0 = ny, var.equal = FALSE)
t.test(x, y, var.equal = TRUE)[c('parameter', 'stderr')]
Gosset_Welch(v1 = vx, v0 = vy, n1 = nx, n0 = ny, var.equal = TRUE)


[Package DanielBiostatistics10th version 0.2.0 Index]