在 R 编程中计算 F 累积分布函数的值 - pf()函数
R 语言中的pf()
函数用于计算 F 累积分布函数在一系列数值上的密度。它还绘制了 F 累积分布的密度图。
Syntax: pf(x, df1, df2)
Parameters:
x: Numeric Vector
df: Degree of Freedom
示例 1:
# R Program to compute
# Cumulative F Density
# Creating a sequence of x-values
x <- seq(1, 30, by = 2)
# Calling pf() Function
y <- pf(x, df1 = 2, df2 = 3)
y
输出:
[1] 0.5352420 0.8075499 0.8891420 0.9258675 0.9460051 0.9584308 0.9667275
[8] 0.9725899 0.9769124 0.9802073 0.9827867 0.9848509 0.9865331 0.9879255
[15] 0.9890935
示例 2:
# R Program to compute
# Cumulative F Density
# Creating a sequence of x-values
x <- seq(1, 30, by = 0.2)
# Calling pf() Function
y <- pf(x, df1 = 3, df2 = 7)
# Plot a graph
plot(y)
输出: