This is an R function that implements a hypothesis test for differences in means. It is analogous to the ?t.test function, except where that assumes the data are normally distributed (in the population), this assumes the data are counts from a Poisson. The basic idea is that you have two counts from two different conditions, where you know the distributions are Poisson. From there, you can test if the two counts differ by more than you would expect by chance alone. You only need one count per condition (perhaps surprisingly) because the Poisson distribution specifies the variance quite rigidly. If the population distributions aren't perfectly Poisson, the test will not be valid, so you are making a very large assumption that you can't assess. Nonetheless, the test may be useful on occasion.
With this basic framework in mind, we can interpret the arguments. x
is a vector of two counts. If the counts arise from situations in which one condition has a greater opportunity for the event to occur, you can account for that via the T
argument, which serves as an offset (cf., Should I use an offset for my Poisson GLM?). Imagine you compared the counts of bacteria from two Petri dishes, where one was twice the size of the other. The former might yield larger counts without anything going on (I don't know if it actually works this way). In that case, you would want to tell the test that the dishes differed; that's what T
does. In addition, you could test against some value of the rate ratio other than unity, which is what r
does. You can also do a one-sample test against a specified value of the rate; r
allows for that, too. Lastly, you could test that your intervention differs from the control, which would be a 'two-sided test', or that the intervention yields larger counts ('greater than'), or smaller counts ('less than').
In your specific example, you say you want to "test the hypothesis that these data are Poisson". That would be a goodness of fit test, which isn't what poisson.test()
does. It also doesn't match what the question is asking for.
The question, as stated, is asking if it's reasonable to get a value of 2
from a Poisson distribution with mean 6.1
. That would be a one-sample version of the test implemented.
[self-study]
tag & read its wiki. $\endgroup$