[R] how to plot chi-square distribution in the graph

David Winsemius dwinsemius at comcast.net
Sat Oct 25 18:57:41 CEST 2008


On Oct 24, 2008, at 11:22 PM, leo_wa wrote:

>
> if i want to plot the chi-square distribution with a different  
> degree of
> freedom how can i plot it in the graph?Sometimes i plot the  
> histogram and
> cut it in a lot of piece.It's distribution like a chi-square.So i  
> want to
> plot the chi-square with a different degree of freedom to compare it .



  layout(matrix(c(1,2,3,4,5,6), 3, 2, byrow = TRUE))
  for (i in 1:6) plot(
         dchisq(1:20, i*2),
         main = paste("chi-square density, df =", i*2))

I do have some reservations about the validity of this approach,  
however.

Also your keyboard needs some attention as well. Spacebar and shift  
key function seem very erratic.

-- 
David Winsemius
Heritage Labs



More information about the R-help mailing list