pbf: Behrens-Fisher distribution

View source: R/bfTest.R

pbfR Documentation

Behrens-Fisher distribution

Description

Used in bfTest. Distribution of the t-statistic used in Welch's t-test. The distribution depends on the sample sizes of the two groups, and the ratio of the two standard errors of the means.

Usage

pbf(q, n1, n2, R = NULL, s1 = NULL, s2 = NULL, epsilon = 10^(-8))
qbf(p,n1,n2,R=NULL,s1=NULL,s2=NULL,epsilon=10^(-8))

Arguments

q

vector of quantiles

p

vector of probabilities

n1

sample size in group 1

n2

sample size in group 2

R

a function of the ratio of the two standard errors of the mean. Specifically, atan((s1/sqrt(n1))/(s2/sqrt(n2)))

s1

sample standard deviation in group 1

s2

sample standard deviation in group 2

epsilon

a small positive number used to avoid computer errors

Details

The user must supply either s1 and s2 or supply R. Suppose m1 and m2 are the means of the two groups and D is the true difference in means. Then the Behrens-Fisher test statistic is T=(m1-m2-D)/sqrt(s1/sqrt(n1)+ s2/sqrt(n2)). The value T can be equivalently written as T=T1*sin(R)+T2*cos(R), where T1 and T2 are t random variables with n1-1 and n2-1 degrees of freedom. The cumulative distribution of T is found by numeric integration.

We rewrite Pr[T<=q] as \int_{-Inf}^{Inf} Pr[T2<= (q-u*sin(R))/cos(R) | T1=u] Pr[T1=u] du.

Value

pbf gives the distribution function, qbf givds the quantile function.

References

Kim, S-H, and Cohen, AS (1996). Table of percentage points of the Behrens-Fisher distribution. Journal of Statistical Computation and Simulation. 55(3) 181-187.

Examples

# See Table 1 from Kim and Cohen, 1996
# at v1=n1-1=8 and v2=n2-1=12 with 45 degrees = 45*pi/180 radians
# for 0.95th percentile
# Table gives: 1.83496
qbf(0.95,9,13,45*pi/180)
# check Inf degrees of freedom, should give qnorm value
qbf(.95,Inf,Inf,45*pi/180)
qnorm(.95)

asht documentation built on Aug. 24, 2023, 5:08 p.m.