在R中创建一个Chi-Distribution图

时间:2021-08-27 01:16:52

i try to plot the probability density function of a chi-Distribution with say 20 degrees of freedom. (NOT a CHI-Square distribution!!) As i found out so far there is the package Runuran in R providing this distribution. But i cannot get this work. Anybody familiar with the syntax of this?

我试图绘制一个chi-Distribution的概率密度函数,比如20个*度。 (不是CHI-Square分布!!)正如我发现到目前为止,R中的Runuran包提供了这种分布。但我无法得到这项工作。有谁熟悉这个的语法?

My first try looked like this

我的第一次尝试看起来像这样

library("Runuran")
zwanzig<-udchi(df=20)
f_zwanzig<-ud(zwanzig,0:10)
curve(from=0, to=10, f_zwanzig)
plot((0:10),f_zwanzig(0:10))

Thanks a lot!

非常感谢!

1 个解决方案

#1


1  

Your f_zwanzig is not defined as a function, whereas it should be.

您的f_zwanzig未定义为函数,而应该是。

f_zwanzig <- function(x) ud(zwanzig, x)
curve(from=0, to=10, f_zwanzig)

在R中创建一个Chi-Distribution图

#1


1  

Your f_zwanzig is not defined as a function, whereas it should be.

您的f_zwanzig未定义为函数,而应该是。

f_zwanzig <- function(x) ud(zwanzig, x)
curve(from=0, to=10, f_zwanzig)

在R中创建一个Chi-Distribution图