Learn R Programming

contingencytables (version 3.1.0)

Statistical Analysis of Contingency Tables

Description

Provides functions to perform statistical inference of data organized in contingency tables. This package is a companion to the "Statistical Analysis of Contingency Tables" book by Fagerland et al. .

Copy Link

Version

Install

install.packages('contingencytables')

Monthly Downloads

349

Version

3.1.0

License

GPL-3

Maintainer

Waldir Leoncio

Last Published

November 11th, 2025

Functions in contingencytables (3.1.0)

Chacko_test_1xc

The Chacko test for order-restriction
Bonferroni_type_CIs_rxc

The Bonferroni-type simultaneous confidence intervals for the differences pi_1|i - pi_1|j
BonettPrice_hybrid_Wilson_score_CI_paired_2x2

The Bonett-Price hybrid Wilson score confidence interval for the ratio of paired probabilities
Bonferroni_type_CIs_paired_cxc

Bonferroni-type confidence intervals for differences of marginal probabilities
BreslowDay_homogeneity_test_stratified_2x2

The Breslow-Day test of homogeneity of odds ratios over strata
Blaker_exact_test_1x2

The Blaker exact test
Blaker_midP_CI_1x2

The Blaker mid-P confidence interval for the binomial probability
Blaker_midP_test_1x2

The Blaker mid-P test
BonettPrice_hybrid_Wilson_score_CI_CC_paired_2x2

The Bonett-Price hybrid Wilson score confidence interval for the ratio of paired probabilities
Brant_test_2xc

The Brant test for the proportional odds assumption
ClopperPearson_exact_CI_1x2

The Clopper-Pearson exact confidence interval
CochranMantelHaenszel_test_stratified_2x2

The Cochran-Mantel-Haenszel test of a common odds ratio
ClopperPearson_midP_CI_1x2

The Clopper-Pearson mid-P confidence interval
CochranArmitage_MH_tests_rx2

The Cochran-Armitage, modified Cochran-Armitage, and Mantel-Haenszel tests for trend
Cornfield_midP_CI_2x2

The Cornfield mid-P confidence interval for the odds ratio
Cornfield_exact_conditional_CI_2x2

The Cornfield exact conditional confidence interval for the odds ratio
CochranArmitage_CI_rx2

The Cochran-Armitage confidence interval for trend in the linear model
CochranArmitage_exact_cond_midP_tests_rx2

The Cochran-Armitage exact conditional and mid-P tests
Cochran_Q_test_stratified_2x2

The Cochran Q test of homogeneity of effects over strata
FisherFreemanHalton_asymptotic_test_rxc

The Fisher-Freeman-Halton asymptotic test for unordered rxc tables
Exact_binomial_test_1x2

The exact binomial test for the binomial probability (pi)
Exact_multinomial_test_1xc

The exact multinomial test for multinomial probabilities
ClopperPearson_exact_CI_1x2_beta_version

The Clopper-Pearson exact confidence interval for the binomial probability (beta version)
Cumulative_models_for_rxc

Cumulative logit and probit models
Cumulative_models_for_2xc

Cumulative logit and probit models
Exact_unconditional_test_2x2

Exact unconditional test for association in 2x2 tables
Exact_cond_midP_tests_rxc

Exact conditional and mid-P tests for the rxc table
Exact_cond_midP_unspecific_ordering_rx2

The exact conditional and mid-P tests for unspecific ordering
Fisher_midP_test_2x2

The Fisher mid-P test for association in 2x2 tables
Fisher_exact_test_2x2

The Fisher exact test for association in 2x2 tables
Gart_adjusted_logit_CI_2x2

The Gart adjusted logit confidence interval for the odds ratio
FleissLevinPaik_test_paired_cxc

The Fleiss-Levin-Paik test for three-level ordinal outcomes
Gold_Wald_CIs_1xc

The Gold Wald simultaneous intervals for the multinomial probabilities
Goodman_Wald_CIs_1xc

The Goodman Wald simultaneous intervals for the multinomial probabilities
Jeffreys_CI_1x2

Jeffreys confidence interval for the binomial probability
JonckheereTerpstra_test_rxc

The Jonckheere-Terpstra test for association
Goodman_Wald_CIs_for_diffs_1xc

The Goodman Wald simultaneous intervals for the differences between the
Goodman_Wilson_score_CIs_1xc

The Goodman Wilson score simultaneous intervals for the multinomial probabilities
Exact_cond_midP_linear_rank_tests_2xc

Exact conditional and mid-P linear rank tests
Kendalls_tau_b_rxc

Kendall's tau-b with confidence interval based on the Fieller standard deviation
Katz_log_CI_2x2

The Katz log confidence interval for the ratio of probabilities
FleissEveritt_test_paired_cxc

The Fleiss-Everitt version of the Stuart test for marginal homogeneity
Inv_sinh_CI_ratio_2x2

The inverse hyperbolic sine confidence interval for the ratio of probabilities
MOVER_Wilson_score_CI_paired_2x2

The MOVER Wilson score confidence interval for the ratio of paired probabilities
MOVER_R_Wilson_CI_ratio_2x2

The MOVER-R Wilson confidence interval for the ratio of probabilities
Kendalls_tau_b_rxc_bca

Kendall's tau-b with the bias-corrected and accelerated boostrap confidence interval
Koopman_asymptotic_score_CI_2x2

The Koopman asymptotic score confidence interval for the ratio of probabilities
LR_test_2x2

The likelihood ratio test for association in 2x2 tables
MidP_multinomial_test_1xc

The mid-P multinomial test for multinomial probabilities
McNemar_exact_unconditional_test_paired_2x2

The McNemar exact unconditional test
MiettinenNurminen_asymptotic_score_CI_OR_2x2

The Miettinen-Nurminen asymptotic score CI for the odds ratio
McNemar_midP_test_paired_2x2

The McNemar mid-P test
McNemar_asymptotic_test_paired_2x2

The McNemar asymptotic test
ML_estimates_and_CIs_stratified_2x2

Maximum likelihood estimates with CIs of the grouping and strata effects
MOVER_R_Wilson_CI_OR_2x2

The MOVER-R Wilson confidence interval for the odds ratio
MantelHaenszel_estimate_stratified_2x2

The Mantel-Haenszel estimate of the overall effect across strata
InverseVariance_estimate_stratified_2x2

The inverse variance estimate of the overall effect across strata
Newcombe_square_and_add_CI_paired_2x2

The Newcombe square-and-add confidence interval for the difference
Newcombe_hybrid_score_CI_2x2

The Newcombe hybrid score confidence interval for the difference between probabilities
McNemar_exact_cond_test_paired_2x2

The McNemar exact conditional test
McNemarBowker_test_paired_cxc

The McNemar-Bowker test for marginal symmetry
MantelHaenszel_test_2xc

The Mantel-Haenszel test of association with column scores
McNemar_asymptotic_test_CC_paired_2x2

The McNemar asymptotic test with continuity correction
Pearson_LR_tests_rxc

The Pearson chi-squared and likelihood ratio tests for association in rxc tables
Pearson_LR_tests_cum_OR_2xc

The Pearson chi-squared and likelihood ratio tests for cumulative ORs in 2xc tables
Pearson_chi_squared_test_2x2

The Pearson chi-squared test for association in 2x2 tables
ML_estimates

Calculate ML estimates
MiettinenNurminen_asymptotic_score_CI_difference_2x2

The Miettinen-Nurminen asymptotic score confidence interval for the
MiettinenNurminen_asymptotic_score_CI_ratio_2x2

The Miettinen-Nurminen asymptotic score confidence interval for the ratio of probabilities
Mee_asymptotic_score_CI_2x2

The Mee asymptotic score confidence interval for the difference between probabilities
MidP_binomial_test_1x2

The mid-P binomial test for the binomial probability (pi)
Independence_smoothed_logit_CI_2x2

The Independence-smoothed logit confidence interval for the odds ratio
Inv_sinh_CI_OR_2x2

The inverse hyperbolic sine confidence interval for the odds ratio
KruskalWallis_asymptotic_test_rxc

The Kruskal-Wallis asymptotic test for singly ordered rxc tables
LR_CI_1x2

The likelihood ratio confidence interval for the binomial probability
Pearson_LR_test_common_effect_stratified_2x2

The Pearson chi-squared and likelihood ratio tests of a common difference
Pearson_residuals_rxc

The Pearson residuals and the standardized Pearson residuals
Pearson_LR_homogeneity_test_stratified_2x2

The Pearson chi-squared and likelihood ratio tests for homogeneity over strata
LR_test_1xc

The likelihood ratio test for multinomial probabilities
Transformed_Clopper_Pearson_exact_CI_paired_2x2

The Transformed Clopper-Pearson exact confidence interval for the conditional odds ratio
LR_test_1x2

The likelihood ratio test for the binomial probability (pi)
QuesenberryHurst_Wilson_score_CIs_1xc

The Quesenberry-Hurst Wilson score simultaneous intervals for the multinomial probabilities
RBG_test_and_CI_stratified_2x2

The RBG test and CI for a common odds ratio
Peto_homogeneity_test_stratified_2x2

The Peto test for homogeneity of odds ratios over strata
Uncorrected_asymptotic_score_CI_2x2

The uncorrected asymptotic score confidence interval for the odds ratio
Wald_CI_1x2

The Wald confidence interval for the binomial probability
Tang_asymptotic_score_CI_paired_2x2

The Tang asymptotic score confidence interval for the ratio of paired probabilities
Stuart_test_paired_cxc

The Stuart test for marginal homogeneity
Wald_CI_BonettPrice_paired_2x2

The Wald confidence interval for the difference between paired probabilities
Peto_OR_estimate_stratified_2x2

The Peto estimate of the common odds ratio across strata
Pearson_chi_squared_test_CC_2x2

The Pearson chi-squared test for association in 2x2 tables
Tango_asymptotic_score_CI_paired_2x2

The Tango asymptotic score confidence interval for the difference between paired probabilities
Transformed_Blaker_exact_CI_paired_2x2

The Transformed Blaker exact confidence interval for the conditional odds ratio
Spearman_correlation_coefficient_rxc

The Spearman correlation coefficient
Wald_test_1x2

The Wald test for the binomial probability (pi)
Spearman_correlation_coefficient_rxc_bca

The Spearman correlation coefficient with the bias-corrected and accelerated
Wald_test_CC_1x2

The Wald test with continuity correction for the binomial probability
Woolf_logit_CI_2x2

The Woolf logit confidence interval for the odds ratio
Scheffe_type_CIs_paired_cxc

Scheffe-type confidence intervals for differences of marginal probabilities
Scheffe_type_CIs_rxc

The Scheffe-type simultaneous confidence intervals for the differences pi_1|i - pi_1|j
Transformed_Clopper_Pearson_midP_CI_paired_2x2

The Transformed Clopper-Pearson mid-P confidence interval for the conditional odds ratio
Pearson_chi_squared_test_1xc

The Pearson chi-squared test for multinomial probabilities
Pearson_LR_tests_unspecific_ordering_rx2

The Pearson chi-squared and likelihood ratio tests for unspecific ordering in rx2 tables
Pearson_correlation_coefficient_rxc

The Pearson correlation coefficient
Trend_estimate_CI_tests_rx2

Trend estimate for linear and logit models
Score_test_CC_1x2

The score test with continuity correction for the
Score_test_1x2

The score test for the binomial probability (pi)
Pearson_correlation_coefficient_rxc_bca

The Pearson correlation coefficient with the bias-corrected and accelerated
Transformed_Wilson_score_CI_paired_2x2

The Transformed Wilson score confidence interval for the conditional odds ratio
Score_test_for_effect_in_the_probit_model_2xc

Score test for effect in the cumulative probit model
Wald_test_and_CI_common_diff_stratified_2x2

The Wald test and CI for a common difference between probabilities
Score_test_and_CI_marginal_mean_scores_paired_cxc

Score test and CI marginal mean scores paired CxC
Wald_test_and_CI_marginal_mean_scores_paired_cxc

The Wald test and confidence interval for the difference between marginal mean scores
Wald_CI_ratio_paired_2x2

The Wald confidence interval for the ratio of paired probabilities
Wald_CI_diff_paired_2x2

The Wald confidence interval for the difference between paired probabilities
Wald_test_and_CI_marginal_mean_ranks_paired_cxc

The Wald test and confidence interval for the difference between marginal mean ranks / ridits
PriceBonett_approximate_Bayes_CI_2x2

The Price-Bonett approximate Bayes confidence interval for the ratio of probabilities
Wald_test_and_CI_common_ratio_stratified_2x2

The Wald test and CI for a common ratio of probabilities
doll_hill_1950

Smoking and lung cancer
calculate_limit_upper

Calculate the upper limit of a confidence interval
cavo_2012

Complete response before and after consolidation therapy
Wald_CI_CC_1x2

The Wald CI with CC for the binomial probability
chap7

Chapter 7: The rxc Table
chap6

Chapter 6: The Ordered 2xc Table
fleiss_2003

Table 13.6, page 382, of Fleiss et al. (2003)
calc_prob

Calculate probability
Woolf_test_and_CI_stratified_2x2

The Woolf test and CI for a common odds ratio
.onAttach

Prints welcome message on package load
ezra_2010

Floppy eyelid syndrome vs obstructive sleep apnea
calculate_limit_lower

Calculate the lower limit of a confidence interval
Wald_CI_2x2

The Wald confidence interval for the difference between probabilities
Wald_CI_OR_paired_2x2

The Wald confidence interval for the conditional odds ratio
Wald_CI_diff_CC_paired_2x2

The Wald confidence interval for the difference between paired probabilities
Wald_CI_AgrestiMin_paired_2x2

The Wald confidence interval for the difference between paired probabilities
Wald_CI_OR_Laplace_paired_2x2

The Wald confidence interval for the conditional odds ratio with Laplace adjustment
Z_unpooled_test_2x2

The Z-unpooled test for association in 2x2 tables
Wald_CI_CC_2x2

The Wald confidence interval for the difference between probabilities
Wilson_score_CI_1x2

The Wilson score confidence interval
calc_Pvalue_4x2

Calculate probability
calc_Pvalue_5x2

Calculate probability
Wilson_score_CI_CC_1x2

The Wilson score confidence interval with continuity correction for the binomial probability
score_test_statistic

Calculate ML estimates
ritland_2007

The association between CHRNA4 genotype and XFS
fontanella_2008

The Adolescent Placement Study
fischer_1999

A comparison between serial and retrospective measurements
gamma_coefficient_rxc

The gamma coefficient
gamma_coefficient_rxc_bca

The gamma coefficient with the bias-corrected and accelerated boostrap confidence interval
chap10

Chapter 10: Stratified 2x2 Tables and Meta-Analysis
chap8

Chapter 8: The Paired 2x2 Table
chap1

Chapter 1: Introduction
the_2x2_table_CIs_ratio

The 2x2 table CIs ratio
the_2x2_table_CIs_difference

The 2x2 table CIs difference
linear_by_linear_test_rxc

The linear-by-linear test for association
ligarden_2010

Ligarden et al., 2010
chap9

Chapter 9: The Paired cxc Table
indredavik_2008

Elevated troponin T levels in stroke patients
bentur_2009

Airway hyper-responsiveness before and after stem cell transplantation
the_1xc_table_tests

The 1xc table tests
table_7.8

Breast Tumor
table_7.9

Self-rated health (Table 7.9)
chap4

Chapter 4: The 2x2 Table
singh_2010_1

The number of n-th order male births
chap5

Chapter 5: The Ordered rx2 Table
lydersen_2012a

Postoperative nausea
list_functions

List functions from a chapter
the_paired_2x2_table_CIs_OR

The Paired 2x2 table CIs OR
the_1x2_table_tests

The 1x2 Table tests
the_1xc_table_CIs

The 1xc table CIs
the_paired_2x2_table_CIs_difference

The Paired 2x2 table CIs difference
snp6498169

Genotype counts for SNP rs 6498169 in RA patients
the_1x2_table_CIs

The 1x2 Table CIs
table_7.4

Psychiatric Diagnoses and Physical Activity
tea

A lady tasting a cup of tea
chap2

Chapter 2: The 1x2 Table and the Binomial Distribution
chap3

Chapter 3: The 1xc Table and the Multinomial Distribution
contingencytables

Statistical Analysis of Contingency tables
contingencytables_result

contingencytables_result class
hine_1989

Prophylactice use of Lidocaine in myocardial infarction
table_7.5

Psychiatric diag. vs BMI with hyperkinetic disorders as reference category
the_2x2_table_CIs_OR

The 2x2 table CIs odds ratio
the_rx2_table

The rx2 table
the_rxc_table

The rxc table
stratified_2x2_tables

Stratified 2x2 tables
mills_graubard_1987

Alcohol consumption and malformations
hypothetical

Hypothetical experiment
perondi_2004

An RCT of high vs standard dose of epinephrine
validateArguments

Validate arguments of a function
lampasona_2013

A case-control study of GADA exposure on IPEX syndrome
the_paired_cxc_table_nominal

The Paired CxC table - nominal
print.contingencytables_result

Output from a contingency tables method
the_paired_cxc_table_ordinal

The Paired CxC table - ordinal
table_7.6

Low Birth Weight vs psychiatric morbitidy with control as reference category
table_7.7

Colorectal cancer (Table 7.7)
peterson_2007

Pretherapy susceptability of pathogens
the_2xc_table

The 2xc table
the_paired_2x2_table_CIs_ratio

The Paired 2x2 table CIs ratio
the_2x2_table_tests

The 2x2 table tests
table_7.3

Treatment for ear infection
the_paired_2x2_table_tests

The Paired 2x2 table tests
Adjusted_inv_sinh_CI_OR_2x2

The adjusted inverse hyperbolic sine confidence interval for the odds ratio
AgrestiCaffo_CI_2x2

The Agresti-Caffo confidence interval for the difference between probabilities
Bhapkar_test_paired_cxc

The Bhapkar test for marginal homogeneity
Adjusted_inv_sinh_CI_ratio_2x2

The adjusted inverse hyperbolic sine confidence interval for the ratio of probabilities
Adjusted_log_CI_2x2

The adjusted log confidence interval for the ratio of probabilities
BaptistaPike_exact_conditional_CI_2x2

The Baptista-Pike exact conditional confidence interval for the odds ratio
Blaker_exact_CI_1x2

The Blaker exact confidence interval
Arcsine_CI_1x2

Arcsine confidence interval
BaptistaPike_midP_CI_2x2

The Baptista-Pike mid-P confidence interval for the odds ratio
AgrestiCoull_CI_1x2

The Agresti-Coull confidence interval for the binomial probability