maiya <maja.zaloznik <at> gmail.com> writes:

> Thanks, but that wasn't what I was going for. Like I said, I know how to do a
> simple chi-square density plot with dchisq(). 
> 
> What I'm trying to do is chi-square / degrees of freedom. Hence
> rchisq(100000,i)/i).
> 
> How do I do that with dchisq?


  By explicitly using the formula to change variables:

plot(density(rchisq(10000,5)/5))

dscchisq <- function(x,df) {
  dchisq(x*df,df)*df
}
curve(dscchisq(x,5),add=TRUE,col=2)

  note that density() generates a smoothing artifact near zero ...

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to