Gosset_Welch {DanielBiostatistics10th} | R Documentation |
t
-statistic and Welch–Satterthwaite EquationTo determine the degree of freedom, as well as the standard error,
of two-sample t
-statistic, with or without the equal-variance assumption.
Gosset_Welch(s1, s0, v1 = s1^2, v0 = s0^2, n1, n0, var.equal = FALSE)
s1 , s0 |
(optional) double scalars or vectors,
sample standard deviations |
v1 , v0 |
double scalars or vectors,
sample variances of the treatment and control sample, respectively.
Default |
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 |
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.
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.
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)