On 14-Feb-10 07:42:12, 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.

I suspect that you must have made an error in entering the commands
into R. Prime suspect: You did not have 6 1's in p -- for example
you may have put

  prob=c(1,1,1,1,1)/6

(with only five). I copied your code (as trivially reformatted above)
straight into R using copy&paste with the mouse, with results:

  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
                          # I just followed instructions on the website.

So it worked as it should work. Therefore something went wrong
when you entered the code. Check your input!

Hoping this helps,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <ted.hard...@manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 14-Feb-10                                       Time: 09:02:01
------------------------------ XFMail ------------------------------

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to