[R] Problem in performing goodness of fit test in R.

Bernardo Rangel Tura tura at centroin.com.br
Sun Feb 14 09:48:41 CET 2010


On Sun, 2010-02-14 at 12:42 +0500, Faiz Rasool wrote:
> I am trying to perform goodness of fit test using R. I am using this website http://wiener.math.csi.cuny.edu/Statistics/R/simpleR/stat013.html for help. However, I am unable to carry out the test successfully. My code follows. It is taken from the website just mentioned. 
> freq=c(22,21,22,27,22,36) # frequencies obtained after rolling the dice 150 times.
> prob=c(1,1,1,1,1,1)/6 # specify expected frequency for each category.
> chisq.test(freq,p=prob) # I do not know what this line means. I just followed instructions on the website.
> The erorr I receive is "erorr in chisq.test(freq,p=prob)/6 probabilities must sum to 1" 
> 
> I am very new to R, so any help would be appreciated. 
> Faiz.

Faiz,


Well ... 
In my computer( Phenom X4 9650, runing Ubuntu 9.10 and R 2.10.1) the
script work


> freq=c(22,21,22,27,22,36) # frequencies obtained after rolling the
dice 150 times.
> prob=c(1,1,1,1,1,1)/6 # specify expected frequency for each category.
> chisq.test(freq,p=prob) # I do not know what this line means

	Chi-squared test for given probabilities

data:  freq 
X-squared = 6.72, df = 5, p-value = 0.2423


About the third line You must read ?chisq.test for better know the
command, but you execute one chi-square test with uniform probability
distribution 



-- 
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil



More information about the R-help mailing list