Frage

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?

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!

War es hilfreich?

Lösung

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

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

enter image description here

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top