On Feb 20, 2015, at 10:05 AM, pari hesabi wrote: > Hello, > If the vector of observed frequencies is: > f<-c(0,0,0,2,3,6,17,15,21,21,14,10,5,1,5) > and the vector of probability :p11<-c(7.577864e-06, 1.999541e-04 > ,1.833510e-03, 9.059845e-03, 2.886977e-02, 6.546229e-02 ,1.124083e-01, > 1.525880e-01, 1.689712e-01, 1.563522e-01, 1.232031e-01, 8.395000e-02, > 5.009534e-02, 2.645857e-02,0.0205403) > The sum of the probabilities is equal to one.
Well, the sum is close to 1.0 but not exact. There's a simple fix: > sum(p11)==1 [1] FALSE > sum( p11/sum(p11) )==1 [1] TRUE > But when I want to do the the Chi-square test, I get this error: > probabilities must sum to one. > Does anybody know the reason? Numerical accuracy. See R-FAQ 7.31 -- David Winsemius Alameda, CA, USA ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.