Load and examine data

library(vcdExtra)
data(SexualFun)
SexualFun                # show the table
##               Wife
## Husband        Never Fun Fairly Often Very Often Always fun
##   Never Fun            7            7          2          3
##   Fairly Often         2            8          3          7
##   Very Often           1            5          4          9
##   Always fun           2            8          9         14

Test association

assocstats(SexualFun)    # association statistics
##                     X^2 df P(> X^2)
## Likelihood Ratio 15.486  9 0.078421
## Pearson          16.955  9 0.049422
## 
## Phi-Coefficient   : NA 
## Contingency Coeff.: 0.396 
## Cramer's V        : 0.249
fisher.test(SexualFun)   # exact test
## 
##  Fisher's Exact Test for Count Data
## 
## data:  SexualFun
## p-value = 0.09578
## alternative hypothesis: two.sided

Tests for ordered factors

CMHtest(SexualFun)       # CMH tests
## Cochran-Mantel-Haenszel Statistics for Husband by Wife 
## 
##                  AltHypothesis  Chisq Df      Prob
## cor        Nonzero correlation 10.014  1 0.0015534
## rmeans  Row mean scores differ 12.568  3 0.0056702
## cmeans  Col mean scores differ 12.319  3 0.0063653
## general    General association 16.769  9 0.0524600
IycgLS0tDQojJyB0aXRsZTogIlRlc3RzIGZvciBhc3NvY2lhdGlvbiBpbiB0d28td2F5IHRhYmxlcyINCiMnIGF1dGhvcjogIk1pY2hhZWwgRnJpZW5kbHkiDQojJyBkYXRlOiAiYHIgZm9ybWF0KFN5cy5EYXRlKCkpYCINCiMnIG91dHB1dDoNCiMnICAgaHRtbF9kb2N1bWVudDoNCiMnICAgICB0aGVtZTogcmVhZGFibGUNCiMnICAgICBjb2RlX2Rvd25sb2FkOiB0cnVlDQojJyAtLS0NCg0KIysgZWNobz1GQUxTRQ0Ka25pdHI6Om9wdHNfY2h1bmskc2V0KA0KICB3YXJuaW5nID0gRkFMU0UsICAgIyBhdm9pZCB3YXJuaW5ncyBhbmQgbWVzc2FnZXMgaW4gdGhlIG91dHB1dA0KICBtZXNzYWdlID0gRkFMU0UNCikNCg0KIycgIyMgTG9hZCBhbmQgZXhhbWluZSBkYXRhDQpsaWJyYXJ5KHZjZEV4dHJhKQ0KZGF0YShTZXh1YWxGdW4pDQpTZXh1YWxGdW4gICAgICAgICAgICAgICAgIyBzaG93IHRoZSB0YWJsZQ0KDQojJyAjIyBUZXN0IGFzc29jaWF0aW9uDQphc3NvY3N0YXRzKFNleHVhbEZ1bikgICAgIyBhc3NvY2lhdGlvbiBzdGF0aXN0aWNzDQpmaXNoZXIudGVzdChTZXh1YWxGdW4pICAgIyBleGFjdCB0ZXN0DQoNCiMnICMjIFRlc3RzIGZvciBvcmRlcmVkIGZhY3RvcnMNCkNNSHRlc3QoU2V4dWFsRnVuKSAgICAgICAjIENNSCB0ZXN0cw0K