F分布是1924年英国统计学家Ronald.A.Fisher爵士提出,并以其姓氏的第一个字母命名的。它是两个服从卡方分布的独立随机变量各除以其自由度后的比值的抽样分布,是一种非对称分布,且位置不可互换。F分布有着广泛的应用,如在方差分析、回归方程的显著性检验中都有着重要的地位。
The F Distribution
Description
Density, distribution function, quantile function and random generation for the F distribution with df1
and df2
degrees of freedom (and optional non-centrality parameter ncp
).
Usage
df(x, df1, df2, ncp, log = FALSE) pf(q, df1, df2, ncp, lower.tail = TRUE, log.p = FALSE) qf(p, df1, df2, ncp, lower.tail = TRUE, log.p = FALSE) rf(n, df1, df2, ncp)
Arguments
x, q | vector of quantiles. |
p | vector of probabilities. |
n | number of observations. If |
df1, df2 | degrees of freedom. |
ncp | non-centrality parameter. If omitted the central F is assumed. |
log, log.p | logical; if TRUE, probabilities p are given as log(p). |
lower.tail | logical; if TRUE (default), probabilities are P[X ≤ x], otherwise, P[X > x]. |
####F分布
# 1.F分布中抽样函数rf
# location:x0; scale:gamma
n = 100
df1 <- 10
df2 <-20
rf(n, df1, df2)
# 2.F分布概率密度函数
x <- seq(0,10,0.1)
y <- df(x,df1, df2)
plot(x,y)
# 3.F分布累积概率
# x <- seq(1,20,0.1)
# plot(x,df(x,df1, df2))
# P[X ≤ x]
pf(1,df1=df1, df2=df2)
# P[X > x]
pf(1,df1=df1, df2=df2,lower.tail = FALSE)
# probabilities p are given as log(p).
pf(1,df1=df1, df2=df2,log.p = TRUE)
# 4.qf函数(pf的反函数)
# 累积概率为0.95时的x值
# x <- seq(-10,10,0.1)
# plot(x,pf(x,df1=df1, df2=df2))
qf(0.95, df1=df1, df2=df2)
qf(0.995, df1=df1, df2=df2)