[R] Density plots for Chi-square and F-distribution on my data

varin sacha varinsacha at yahoo.fr
Thu Feb 19 17:36:54 CET 2015


Dear R-helpers,

I want to compute the density plot (probability plot) of the Chi-square distribution.
My 2 categorical variables are gender (male, female) and colors of the eyes (blue, green and brown).

The sample size n = 100. The proportions are the following :

male and blue eyes : 10%
male and green eyes : 20%
male and brown eyes : 22%
female and blue eyes : 20%
female and green eyes : 13%
female and brown eyes : 15%

There are k-1 df = 6-1= 5

I don't know how to take into consideration the percents here above in my R code here below ?

x <- rchisq(100, 5)
hist(x, prob=TRUE)
curve( dchisq(x, df=5), col='red', add=TRUE)


Second point, I want to do the same, to compute the density plot, but this time for the Fisher distribution. 
My categorical variable is gender again (male, female)
My numerical variable is the mark in Mathematics test (3; 4; 5; 5.5)
The proportions are the following :
male and 3 : 10%
male and 4 : 15%
male and 5 : 10%
male and 5.5 : 15%
female and 3 : 12%
female and 4: 0%
female and 5 : 25%
female and 5.5 : 13%

There are df1=2-1= 1 and df2=8-2= 6

Again, I don't know how to take into consideration the percents here above in my R code here below ?


df(100, 1, 6, log = FALSE)
x <- rf(100, 1, 6)
hist(x, prob=TRUE)
curve( df(x,1,6), col='red', add=TRUE)

Best, 
Thanks for your help.



More information about the R-help mailing list