[R] Chi-Square Distribution Plots

kjetil halvorsen kjetilh at umsanet.edu.bo
Mon Sep 30 16:16:18 CEST 2002


Suppose your chi-squared values witrh, let us say, 5 degrees of freedom
are in x. You need to make the histogram with the argument
probability=TRUE first. Then:

> x <- rchisq(1000, 5)
> hist(x, prob=TRUE)
> plot( function(x) dchisq(x, df=5), from=0, to=35, add=TRUE)


Kjetil Halvorsen

Bayesianbay at aol.com wrote:
> 
> Dear list
> 
> I have a vector of values that allegedly have a chi-squared distribution. I
> want to create a plot that shows the values I have obtained,  and the
> chi-squared distribution curve for the specified number of degrees of freedom
> to show what should have been obtained.
> 
> At the moment I am plotting the values I have obtained as a histogram and
> somehow want to put on to this plot the expected frequency curve. Is there a
> way of doing this in R?
> 
> Many thanks in davance
> Laura
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list