在 R 编程中计算 F 密度的值 – df()函数
R 语言中的df()
函数用于计算 F 分布在数值序列上的密度。它还绘制了 F 分布的密度图。
Syntax: df(x, df1, df2)
Parameters:
x: Numeric Vector
df: Degree of Freedom
示例 1:
# R Program to compute
# F Density
# Creating a sequence of x-values
x <- seq(1, 30, by = 2)
# Calling df() Function
y <- df(x, df1 = 2, df2 = 3)
y
输出:
[1] 0.2788548009 0.0641500299 0.0255826045 0.0130822015 0.0077135607
[6] 0.0049883063 0.0034419784 0.0024918293 0.0018719698 0.0014482499
[11] 0.0011475506 0.0009274979 0.0007622781 0.0006355006 0.0005363874
示例 2:
# R Program to compute
# F Density
# Creating a sequence of x-values
x <- seq(1, 30, by = 0.2)
# Calling df() Function
y <- df(x, df1 = 3, df2 = 7)
# Plot a graph
plot(y)
输出: