[R] Chi-Square Distribution Plots

Stuart Luppescu s-luppescu at uchicago.edu
Mon Sep 30 16:19:29 CEST 2002


On Mon, 2002-09-30 at 03:57, 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?

Of course. I assume a qqplot is what you are looking for. Use something
like this line:

qqplot(qchisq(ppoints(375), df=9), actual.values)

This puts the expected distribution on the x-axis, and the empirical
distribution on the y-axix. Change the number of data points (375) and
the degrees of freedom (9) to values appropriate to your data.
-- 
Stuart Luppescu -=- s-luppescu at uchicago.edu        
University of Chicago -=- CCSR 
才文と智奈美の父 -=-    Kernel 2.4.19-xfs-r1                
Somebody's terminal is dropping bits.  I found a
 pile of them over in the corner. 
 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20020930/1af0527e/attachment.bin


More information about the R-help mailing list