在 R 编程中计算累积卡方密度 – pchisq()函数
R 语言中的pchisq()
函数用于计算元素向量的累积卡方密度。它还为卡方累积分布创建密度图。
Syntax: pchisq(vec, df)
Parameters:
vec: Vector of x-values
df: Degree of Freedom
示例 1:
# R program to compute
# Cumulative Chi Square Density
# Create a vector of x-values
x <- seq(0, 10, by = 1)
# Calling pchisq() Function
y <- pchisq(x, df = 5)
y
输出:
[1] 0.00000000 0.03743423 0.15085496 0.30001416 0.45058405 0.58411981
[7] 0.69378108 0.77935969 0.84376437 0.89093584 0.92476475
示例 2:
# R program to compute
# Cumulative Chi Square Density
# Create a vector of x-values
x <- seq(0, 10, by = 0.1)
# Calling pchisq() Function
y <- pchisq(x, df = 5)
# Plot a graph
plot(y)
输出: