 #### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

# Question concerning BayesFactor test for independence in contingency tables

Hello all,

I would like to test whether two independent proportions are equal using a bayes
factor. So far, I found some papers on this issue, but not many technical
implementations. I think that I can use the `contingencyTableBF()` function in the
BayesFactor package to test for differences (or equality) in proportions when I use
the option `sampleType="indepMulti"` (if that is not the case, please correct me).

Imagine I want to compare two procedures that classify objects; classifications are
either correct or incorrect. I want to test whether the proportions of correct
classifications are different (or equal) between both classifiers. Hence, I have a
very simple contingency table like this:

Classifier 1 Classifier 2
Correct 200 183
False 50 43

I obtain a bayes factor for the comparison via:

``````library("BayesFactor")
contingencyTableBF(contingency_table, sampleType = "indepMulti", fixedMargin = "cols")
``````

My question is how I determine whether to set columns or rows to fixed. I think that
in this case, each column is fixed and multinomially distributed. The BayesFactor
reference manuals states the following on this issue:

For sampleType="indepMulti" (independent multinomial), the sampling plan is assumed
to be one in which row or column totals are fixed, and the each row or column is
assumed to be multinomially distributed. Under the null hypothesis, each row or
column is assumed to have the same multinomial probabilities. The fixed margin must
be given by the fixedMargin argument.

I understand that if I set `fixedMargin = "cols"`, the analysis assumes that the
columns are multinomially distributed -- is that correct? In fact, varying this
parameter does not change the bayes factor much, so I am not 100% sure which is
correct.

Best regards and many thanks in advance,

Martin

• Hi Papi,

In the case of your design, the columns are the procedures you compare (so these are fixed) and the rows contain the performance (so that is not fixed). So basically, you are right, and in your 2x2 case the test reduces to a test for two proportions. See also this paper for explanation and examples: http://www.ejwagenmakers.com/inpress/JamilEtAlGunelDickeyinpress.pdf

Cheers,
E.J.

• edited September 2016

Hello E.J.,

thanks a lot for your response and the paper -- that is a very useful source :-)

Cheers,
Martin