Keywords: distribution
### ** Examples ## Equivalence of pt(.,nu) with pf(.^2, 1,nu): x <- seq(0.001, 5, length.out = 100) nu <- 4 stopifnot(all.equal(2*pt(x,nu) - 1, pf(x^2, 1,nu)), ## upper tails: all.equal(2*pt(x, nu, lower.tail=FALSE), pf(x^2, 1,nu, lower.tail=FALSE))) ## the density of the square of a t_m is 2*dt(x, m)/(2*x) # check this is the same as the density of F_{1,m} all.equal(df(x^2, 1, 5), dt(x, 5)/x)
[1] TRUE
## Identity (F <-> t): qf(2*p - 1, 1, df) == qt(p, df)^2 for p >= 1/2 p <- seq(1/2, .99, length.out = 50); df <- 10 rel.err <- function(x, y) ifelse(x == y, 0, abs(x-y)/mean(abs(c(x,y)))) stopifnot(all.equal(qf(2*p - 1, df1 = 1, df2 = df), qt(p, df)^2)) ## Identity (F <-> Beta <-> incompl.beta): n1 <- 7 ; n2 <- 12; qF <- c((0:4)/4, 1.5, 2:16) x <- n2/(n2 + n1*qF) stopifnot(all.equal(pf(qF, n1, n2, lower.tail=FALSE), pbeta(x, n2/2, n1/2)))