[R] plotting functions of chi square

maiya maja.zaloznik at gmail.com
Tue Aug 17 22:57:52 CEST 2010


Hi! This is going to be a real newbie question, but I can't figure it out. 

I'm trying to plot densities of various functions of chi-square. A simple
chi-square plot I can do with dchisq(). But e.g. chi.sq/degrees of freedom I
only know how to do using density(rchisq()/df). For example:

plot(1, type="n",  xlab="", ylab="", xlim=c(0,2), ylim=c(0,7))

for (i in c(10,50,100,200,500)){
lines(density(rchisq(100000,i)/i))
}

But even with 100,000 samples the curves still aren't smooth. Surely there
must be a more elegant way to do this?

Thanks!

Maja
-- 
View this message in context: http://r.789695.n4.nabble.com/plotting-functions-of-chi-square-tp2329020p2329020.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list