I seem to be able to use expected values that are decimal (e.g., 1.33) when using chisq.test but not when using fisher.test. This happens when using an array/matrix as input. Fisher.test returns: Error in sprintf(gettext(fmt, domain = domain), ...) : invalid format '%d'; use format %s for character objects. Thus, it appears fisher.test is looking for integers only. I tried putting the data in x and y factor objects, but that does not work either. Is there another way to use non-integer expected values with fisher.test or is that a limitation of fisher.test? If I must use integer expected values, I suppose one option would be round the expected value down or up to an integer. But, which? I tried that, but they produce different p values. Thanks for any help! -- View this message in context: http://r.789695.n4.nabble.com/fisher-test-can-I-use-non-integer-expected-values-tp4681976.html Sent from the R help mailing list archive at Nabble.com.
David Winsemius
2013-Dec-11 01:23 UTC
[R] fisher.test - can I use non-integer expected values?
On Dec 10, 2013, at 2:04 PM, bakerwl wrote:> I seem to be able to use expected values that are decimal (e.g., 1.33) when > using chisq.test but not when using fisher.test.There are no expected values in the input to fisher.test.> This happens when using an > array/matrix as input. Fisher.test returns: Error in sprintf(gettext(fmt, > domain = domain), ...) : invalid format '%d'; use format %s for character > objects. > > Thus, it appears fisher.test is looking for integers only.That would seem to be a very reasonable assumption.> > I tried putting the data in x and y factor objects, but that does not work > either. > > Is there another way to use non-integer expected values with fisher.test or > is that a limitation of fisher.test?> If I must use integer expected values, I suppose one option would be round > the expected value down or up to an integer. But, which? I tried that, but > they produce different p values.Well, of course. First, you tell us why you need `fisher.test` at all. It says very clearly it is for count data and you clearly want to do something with input that is not counts. `prop.test` will test a distribution of counts against expected proportions and `binom.test` will do an exact test of a Bernoulli experiment against (one) proportion.> > Thanks for any help! > > View this message in context: http://r.789695.n4.nabble.com/fisher-test-can-I-use-non-integer-expected-values-tp4681976.html > Sent from the R help mailing list archive at Nabble.com. >______________________________________________ R-help at 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. -- David Winsemius Alameda, CA, USA