Package 'contingencytables'

Title: 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. <ISBN 9781466588172>.
Authors: Morten Wang Fagerland [aut], Stian Lydersen [ctb], Petter Laake [ctb], Waldir Leoncio [cre], Ole Christian Lingjærde [trl], Brad J. Biggerstaff [ctb]
Maintainer: Waldir Leoncio <[email protected]>
License: GPL-3
Version: 3.0.1
Built: 2024-09-28 05:42:02 UTC
Source: https://github.com/ocbe-uio/contingencytables

Help Index


Prints welcome message on package load

Description

Prints package version number and welcome message on package load

Usage

.onAttach(libname, pkgname)

Arguments

libname

library location. See ?base::.onAttach for details

pkgname

package name. See ?base::.onAttach for details


The adjusted inverse hyperbolic sine confidence interval for the odds ratio

Description

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

Described in Chapter 4 "The 2x2 Table"

Usage

Adjusted_inv_sinh_CI_OR_2x2(n, psi1 = 0.45, psi2 = 0.25, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

psi1

pseudo-frequency (should be > 0)

psi2

pseudo-frequency (should be > 0)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Adjusted_inv_sinh_CI_OR_2x2(lampasona_2013)
Adjusted_inv_sinh_CI_OR_2x2(ritland_2007)

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

Description

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

Described in Chapter 4 "The 2x2 Table"

Usage

Adjusted_inv_sinh_CI_ratio_2x2(
  n,
  psi1 = 0,
  psi2 = 0,
  psi3 = 0,
  psi4 = 1,
  alpha = 0.05
)

Arguments

n

the observed counts (a 2x2 matrix)

psi1

pseudo-frequency

psi2

pseudo-frequency

psi3

pseudo-frequency

psi4

pseudo-frequency

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Adjusted_inv_sinh_CI_ratio_2x2(perondi_2004)
Adjusted_inv_sinh_CI_ratio_2x2(ritland_2007)

The adjusted log confidence interval for the ratio of probabilities

Description

The adjusted log confidence interval for the ratio of probabilities

Described in Chapter 4 "The 2x2 Table"

Usage

Adjusted_log_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Adjusted_log_CI_2x2(perondi_2004)
Adjusted_log_CI_2x2(ritland_2007)

The Agresti-Caffo confidence interval for the difference between probabilities

Description

The Agresti-Caffo confidence interval for the difference between probabilities

Described in Chapter 4 "The 2x2 Table"

Usage

AgrestiCaffo_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

AgrestiCaffo_CI_2x2(perondi_2004)
AgrestiCaffo_CI_2x2(ritland_2007)

The Agresti-Coull confidence interval for the binomial probability

Description

Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

AgrestiCoull_CI_1x2(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

References

Agresti A, Coull BA (1998) Approximate is better than "exact" for interval estimation of binomial proportions. The American Statistician; 52:119-126

See Also

Wald_CI_1x2

Examples

AgrestiCoull_CI_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"])
AgrestiCoull_CI_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
AgrestiCoull_CI_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
with(singh_2010["4th", ], AgrestiCoull_CI_1x2(X, n)) # alternative syntax
AgrestiCoull_CI_1x2(ligarden_2010["X"], ligarden_2010["n"])

Arcsine confidence interval

Description

The Arcsine confidence interval for the binomial probability (with Anscombe variance stabilizing transformation) Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

Arcsine_CI_1x2(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

References

Anscombe FJ (1948) The transformation of Poisson, binomial and negative binomial data. Biometrika; 35:246-254

Examples

Arcsine_CI_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"])
Arcsine_CI_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
Arcsine_CI_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
with(singh_2010["4th", ], Arcsine_CI_1x2(X, n)) # alternative syntax
Arcsine_CI_1x2(ligarden_2010["X"], ligarden_2010["n"])

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

Description

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

Described in Chapter 4 "The 2x2 Table"

Usage

BaptistaPike_exact_conditional_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed table (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

BaptistaPike_exact_conditional_CI_2x2(tea)
BaptistaPike_exact_conditional_CI_2x2(perondi_2004)
BaptistaPike_exact_conditional_CI_2x2(lampasona_2013)
BaptistaPike_exact_conditional_CI_2x2(ritland_2007)

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

Description

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

Described in Chapter 4 "The 2x2 Table"

Usage

BaptistaPike_midP_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed table (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

BaptistaPike_midP_CI_2x2(tea)
BaptistaPike_midP_CI_2x2(perondi_2004)
BaptistaPike_midP_CI_2x2(lampasona_2013)
BaptistaPike_midP_CI_2x2(ritland_2007)

Airway hyper-responsiveness before and after stem cell transplantation

Description

Airway hyper-responsiveness before and after stem cell transplantation

Usage

bentur_2009

Format

An object of class matrix (inherits from array) with 2 rows and 2 columns.

References

Bentur et al. (2009)


The Bhapkar test for marginal homogeneity

Description

The Bhapkar test for marginal homogeneity

Described in Chapter 9 "The Paired cxc Table"

Usage

Bhapkar_test_paired_cxc(n)

Arguments

n

the observed table (a cxc matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Bhapkar_test_paired_cxc(peterson_2007)

The Blaker exact confidence interval

Description

The Blaker exact confidence interval for the binomial probability Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

Blaker_exact_CI_1x2(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

References

Blaker H (2000) Confidence curves and improved exact confidence intervals for discrete distributions. The Canadian Journal of Statistics; 28:783-798

Examples

Blaker_exact_CI_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"])
Blaker_exact_CI_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
Blaker_exact_CI_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
with(singh_2010["4th", ], Blaker_exact_CI_1x2(X, n)) # alternative syntax
Blaker_exact_CI_1x2(ligarden_2010["X"], ligarden_2010["n"])

The Blaker exact test

Description

The Blaker exact test for the binomial probability (pi) H_0: pi = pi0 vs H_A: pi ~= pi0 (two-sided) Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

Blaker_exact_test_1x2(X, n, pi0)

Arguments

X

the number of successes

n

the total number of observations

pi0

a given probability

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

References

Blaker H (2000) Confidence curves and improved exact confidence intervals for discrete distributions. The Canadian Journal of Statistics; 28:783-798

Examples

Blaker_exact_test_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"], pi0 = 0.513)
Blaker_exact_test_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"], pi0 = 0.513)
Blaker_exact_test_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"], pi0 = 0.513)
Blaker_exact_test_1x2(singh_2010["4th", "X"], singh_2010["4th", "n"], pi0 = 0.513)
Blaker_exact_test_1x2(ligarden_2010["X"], ligarden_2010["n"], pi0 = 0.5)

The Blaker mid-P confidence interval for the binomial probability

Description

The Blaker mid-P confidence interval for the binomial probability Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

Blaker_midP_CI_1x2(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

References

Blaker H (2000) Confidence curves and improved exact confidence intervals for discrete distributions. The Canadian Journal of Statistics; 28:783-798

Examples

Blaker_midP_CI_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"])
Blaker_midP_CI_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
Blaker_midP_CI_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
with(singh_2010["4th", ], Blaker_midP_CI_1x2(X, n)) # alternative syntax
Blaker_midP_CI_1x2(ligarden_2010["X"], ligarden_2010["n"])

The Blaker mid-P test

Description

The Blaker mid-P test for the binomial probability (pi) H_0: pi = pi0 vs H_A: pi ~= pi0 (two-sided) Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

Blaker_midP_test_1x2(X, n, pi0)

Arguments

X

the number of successes

n

the total number of observations

pi0

a given probability

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

References

Blaker H (2000) Confidence curves and improved exact confidence intervals for discrete distributions. The Canadian Journal of Statistics; 28:783-798

Examples

Blaker_midP_test_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"], pi0 = 0.513)
Blaker_midP_test_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"], pi0 = 0.513)
Blaker_midP_test_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"], pi0 = 0.513)
Blaker_midP_test_1x2(singh_2010["4th", "X"], singh_2010["4th", "n"], pi0 = 0.513)
Blaker_midP_test_1x2(ligarden_2010["X"], ligarden_2010["n"], pi0 = 0.5)

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

Description

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

with continuity correction

Described in Chapter 8 "The Paired 2x2 Table"

Usage

BonettPrice_hybrid_Wilson_score_CI_CC_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

BonettPrice_hybrid_Wilson_score_CI_CC_paired_2x2(bentur_2009)
BonettPrice_hybrid_Wilson_score_CI_CC_paired_2x2(cavo_2012)

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

Description

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

Described in Chapter 8 "The Paired 2x2 Table"

Usage

BonettPrice_hybrid_Wilson_score_CI_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

BonettPrice_hybrid_Wilson_score_CI_paired_2x2(bentur_2009)
BonettPrice_hybrid_Wilson_score_CI_paired_2x2(cavo_2012)

Bonferroni-type confidence intervals for differences of marginal probabilities

Description

Bonferroni-type confidence intervals for differences of marginal probabilities

Described in Chapter 9 "The Paired kxk Table"

Usage

Bonferroni_type_CIs_paired_cxc(n, alpha = 0.05)

Arguments

n

the observed table (a cxc matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Bonferroni_type_CIs_paired_cxc(peterson_2007)

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

Description

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

Described in Chapter 7 "The rxc Table"

Usage

Bonferroni_type_CIs_rxc(n, alpha = 0.05)

Arguments

n

the observed counts (an rx2 vector)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Bonferroni_type_CIs_rxc(table_7.3)

The Brant test for the proportional odds assumption

Description

The Brant test for the proportional odds assumption

Described in Chapter 6 "The Ordered 2xc Table"

Usage

Brant_test_2xc(n)

Arguments

n

the observed table (a 2xc matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Brant_test_2xc(fontanella_2008)
Brant_test_2xc(lydersen_2012a)

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

Description

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

Tarone correction

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

BreslowDay_homogeneity_test_stratified_2x2(n)

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

BreslowDay_homogeneity_test_stratified_2x2(doll_hill_1950)
BreslowDay_homogeneity_test_stratified_2x2(hine_1989)

Calculate probability

Description

Calculate probability

Usage

calc_prob(...)

Arguments

...

arguments passed to methods

Note

This function has little use to the user, it is exported for confirmity to R package standards.


Calculate probability

Description

Calculate probability

Usage

calc_Pvalue_4x2(...)

Arguments

...

arguments passed to methods

Note

This function has little use to the user, it is exported for confirmity to R package standards.


Calculate probability

Description

Calculate probability

Usage

calc_Pvalue_5x2(...)

Arguments

...

arguments passed to methods

Note

This function has little use to the user, it is exported for confirmity to R package standards.


Calculate the lower limit of a confidence interval

Description

Calculate the lower limit of a confidence interval

Usage

calculate_limit_lower(...)

Arguments

...

arguments passed to methods

Note

This function has little use to the user, it is exported so that it can be used by stats::uniroot().


Calculate the upper limit of a confidence interval

Description

Calculate the upper limit of a confidence interval

Usage

calculate_limit_upper(...)

Arguments

...

arguments passed to methods

Note

This function has little use to the user, it is exported so that it can be used by stats::uniroot().


Complete response before and after consolidation therapy

Description

Complete response before and after consolidation therapy

Usage

cavo_2012

Format

An object of class matrix (inherits from array) with 2 rows and 2 columns.

References

Cavo et al. (2012)


The Chacko test for order-restriction

Description

Described in Chapter 3, "The 1xc Table and the Multinomial Distribution", Chacko (1966) derived a test based on the Pearson chi-square statistic to test the hypothesis that the categories of a multinomial variable with c possible outcomes have a natural ordering. The test statistic is asymptotically chi-squared distributed.

Usage

Chacko_test_1xc(n)

Arguments

n

the observed counts (a 1xc vector, where c is the number of categories)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

References

Chacko, V. J. (1966). Modified chi-square test for ordered alternatives. Sankhyā: The Indian Journal of Statistics, Series B, 185-190.

Fagerland MW, Lydersen S, Laake P (2017) Statistical Analysis of Contingency Tables. Chapman & Hall/CRC, Boca Raton, FL.

Examples

Chacko_test_1xc(hypothetical)

Chapter 1: Introduction

Description

There are no functions for Chapter 1 (Introduction), only from Chapters 2 to 10.

References

  • Fagerland MW, Lydersen S, Laake P (2017) Statistical Analysis of Contingency Tables. Chapman & Hall/CRC, Boca Raton, FL

  • https://contingencytables.com/

  • https://www.routledge.com/Statistical-Analysis-of-Contingency-Tables/Fagerland-Lydersen-Laake/p/book/9781466588172


Chapter 10: Stratified 2x2 Tables and Meta-Analysis

Description

These are the functions related to chapter 10:

  1. BreslowDay_homogeneity_test_stratified_2x2

  2. CochranMantelHaenszel_test_stratified_2x2

  3. Cochran_Q_test_stratified_2x2

  4. InverseVariance_estimate_stratified_2x2

  5. ML_estimates_and_CIs_stratified_2x2

  6. MantelHaenszel_estimate_stratified_2x2

  7. Pearson_LR_homogeneity_test_stratified_2x2

  8. Pearson_LR_test_common_effect_stratified_2x2

  9. Peto_homogeneity_test_stratified_2x2

  10. Peto_OR_estimate_stratified_2x2

  11. RBG_test_and_CI_stratified_2x2

  12. Wald_test_and_CI_common_diff_stratified_2x2

  13. Wald_test_and_CI_common_ratio_stratified_2x2

  14. Woolf_test_and_CI_stratified_2x2

  15. stratified_2x2_tables

Note

You can also print the list above with list_functions(10).

References

  • Fagerland MW, Lydersen S, Laake P (2017) Statistical Analysis of Contingency Tables. Chapman & Hall/CRC, Boca Raton, FL

  • https://contingencytables.com/

  • https://www.routledge.com/Statistical-Analysis-of-Contingency-Tables/Fagerland-Lydersen-Laake/p/book/9781466588172


Chapter 2: The 1x2 Table and the Binomial Distribution

Description

These are the functions related to chapter 2:

  1. AgrestiCoull_CI_1x2

  2. Arcsine_CI_1x2

  3. Wald_CI_1x2

  4. Blaker_exact_CI_1x2

  5. Blaker_exact_test_1x2

  6. Blaker_midP_CI_1x2

  7. Blaker_midP_test_1x2

  8. ClopperPearson_exact_CI_1x2

  9. ClopperPearson_midP_CI_1x2

  10. Exact_binomial_test_1x2

  11. Jeffreys_CI_1x2

  12. LR_CI_1x2

  13. LR_test_1x2

  14. MidP_binomial_test_1x2

  15. Score_test_1x2

  16. Score_test_CC_1x2

  17. Wald_CI_CC_1x2

  18. Wilson_score_CI_1x2

  19. Wilson_score_CI_CC_1x2

  20. the_1x2_table_CIs

  21. Wald_test_1x2

  22. Wald_test_CC_1x2

  23. the_1x2_table_tests

Note

You can also print the list above with list_functions(2).

References

  • Fagerland MW, Lydersen S, Laake P (2017) Statistical Analysis of Contingency Tables. Chapman & Hall/CRC, Boca Raton, FL

  • https://contingencytables.com/

  • https://www.routledge.com/Statistical-Analysis-of-Contingency-Tables/Fagerland-Lydersen-Laake/p/book/9781466588172


Chapter 3: The 1xc Table and the Multinomial Distribution

Description

These are the functions related to chapter 3:

  1. Chacko_test_1xc

  2. Exact_multinomial_test_1xc

  3. Gold_Wald_CIs_1xc

  4. Goodman_Wald_CIs_1xc

  5. Goodman_Wald_CIs_for_diffs_1xc

  6. Goodman_Wilson_score_CIs_1xc

  7. LR_test_1xc

  8. MidP_multinomial_test_1xc

  9. Pearson_chi_squared_test_1xc

  10. QuesenberryHurst_Wilson_score_CIs_1xc

  11. the_1xc_table_CIs

  12. the_1xc_table_tests

Note

You can also print the list above with list_functions(3).

References

  • Fagerland MW, Lydersen S, Laake P (2017) Statistical Analysis of Contingency Tables. Chapman & Hall/CRC, Boca Raton, FL

  • https://contingencytables.com/

  • https://www.routledge.com/Statistical-Analysis-of-Contingency-Tables/Fagerland-Lydersen-Laake/p/book/9781466588172


Chapter 4: The 2x2 Table

Description

These are the functions related to chapter 4:

  1. Adjusted_inv_sinh_CI_OR_2x2

  2. Adjusted_inv_sinh_CI_ratio_2x2

  3. Adjusted_log_CI_2x2

  4. AgrestiCaffo_CI_2x2

  5. Wald_CI_2x2

  6. BaptistaPike_exact_conditional_CI_2x2

  7. BaptistaPike_midP_CI_2x2

  8. Cornfield_exact_conditional_CI_2x2

  9. Cornfield_midP_CI_2x2

  10. Fisher_exact_test_2x2

  11. Exact_unconditional_test_2x2

  12. Fisher_midP_test_2x2

  13. Gart_adjusted_logit_CI_2x2

  14. Independence_smoothed_logit_CI_2x2

  15. Inv_sinh_CI_OR_2x2

  16. Inv_sinh_CI_ratio_2x2

  17. Katz_log_CI_2x2

  18. Koopman_asymptotic_score_CI_2x2

  19. LR_test_2x2

  20. Mee_asymptotic_score_CI_2x2

  21. MiettinenNurminen_asymptotic_score_CI_difference_2x2

  22. MiettinenNurminen_asymptotic_score_CI_OR_2x2

  23. MiettinenNurminen_asymptotic_score_CI_ratio_2x2

  24. MOVER_R_Wilson_CI_OR_2x2

  25. MOVER_R_Wilson_CI_ratio_2x2

  26. Newcombe_hybrid_score_CI_2x2

  27. Pearson_chi_squared_test_2x2

  28. Pearson_chi_squared_test_CC_2x2

  29. PriceBonett_approximate_Bayes_CI_2x2

  30. Wald_CI_CC_2x2

  31. Woolf_logit_CI_2x2

  32. Uncorrected_asymptotic_score_CI_2x2

  33. Z_unpooled_test_2x2

  34. the_2x2_table_CIs_difference

  35. the_2x2_table_CIs_OR

  36. the_2x2_table_CIs_ratio

  37. the_2x2_table_tests

Note

You can also print the list above with list_functions(4).

References

  • Fagerland MW, Lydersen S, Laake P (2017) Statistical Analysis of Contingency Tables. Chapman & Hall/CRC, Boca Raton, FL

  • https://contingencytables.com/

  • https://www.routledge.com/Statistical-Analysis-of-Contingency-Tables/Fagerland-Lydersen-Laake/p/book/9781466588172


Chapter 5: The Ordered rx2 Table

Description

These are the functions related to chapter 5:

  1. CochranArmitage_CI_rx2

  2. CochranArmitage_exact_cond_midP_tests_rx2

  3. CochranArmitage_MH_tests_rx2

  4. Exact_cond_midP_unspecific_ordering_rx2

  5. Pearson_LR_tests_unspecific_ordering_rx2

  6. the_rx2_table

  7. Trend_estimate_CI_tests_rx2

Note

You can also print the list above with list_functions(5).

References

  • Fagerland MW, Lydersen S, Laake P (2017) Statistical Analysis of Contingency Tables. Chapman & Hall/CRC, Boca Raton, FL

  • https://contingencytables.com/

  • https://www.routledge.com/Statistical-Analysis-of-Contingency-Tables/Fagerland-Lydersen-Laake/p/book/9781466588172


Chapter 6: The Ordered 2xc Table

Description

These are the functions related to chapter 6:

  1. Brant_test_2xc

  2. Cumulative_models_for_2xc

  3. Exact_cond_midP_linear_rank_tests_2xc

  4. ClopperPearson_exact_CI_1x2_beta_version

  5. Exact_cond_midP_unspecific_ordering_rx2

  6. MantelHaenszel_test_2xc

  7. Pearson_LR_tests_cum_OR_2xc

  8. Score_test_for_effect_in_the_probit_model_2xc

  9. the_2xc_table

Note

You can also print the list above with list_functions(6).

References

  • Fagerland MW, Lydersen S, Laake P (2017) Statistical Analysis of Contingency Tables. Chapman & Hall/CRC, Boca Raton, FL

  • https://contingencytables.com/

  • https://www.routledge.com/Statistical-Analysis-of-Contingency-Tables/Fagerland-Lydersen-Laake/p/book/9781466588172


Chapter 7: The rxc Table

Description

These are the functions related to chapter 7:

  1. Bonferroni_type_CIs_rxc

  2. Cumulative_models_for_rxc

  3. Exact_cond_midP_tests_rxc

  4. FisherFreemanHalton_asymptotic_test_rxc

  5. gamma_coefficient_rxc_bca

  6. gamma_coefficient_rxc

  7. JonckheereTerpstra_test_rxc

  8. Kendalls_tau_b_rxc

  9. Kendalls_tau_b_rxc_bca

  10. KruskalWallis_asymptotic_test_rxc

  11. linear_by_linear_test_rxc

  12. Pearson_correlation_coefficient_rxc

  13. Pearson_correlation_coefficient_rxc_bca

  14. Pearson_LR_tests_rxc

  15. Pearson_residuals_rxc

  16. Scheffe_type_CIs_rxc

  17. Spearman_correlation_coefficient_rxc

  18. Spearman_correlation_coefficient_rxc_bca

  19. the_rxc_table

Note

You can also print the list above with list_functions(7).

References

  • Fagerland MW, Lydersen S, Laake P (2017) Statistical Analysis of Contingency Tables. Chapman & Hall/CRC, Boca Raton, FL

  • https://contingencytables.com/

  • https://www.routledge.com/Statistical-Analysis-of-Contingency-Tables/Fagerland-Lydersen-Laake/p/book/9781466588172


Chapter 8: The Paired 2x2 Table

Description

These are the functions related to chapter 8:

  1. BonettPrice_hybrid_Wilson_score_CI_CC_paired_2x2

  2. BonettPrice_hybrid_Wilson_score_CI_paired_2x2

  3. ClopperPearson_exact_CI_1x2_beta_version

  4. McNemar_asymptotic_test_CC_paired_2x2

  5. McNemar_asymptotic_test_paired_2x2

  6. McNemar_exact_cond_test_paired_2x2

  7. McNemar_exact_unconditional_test_paired_2x2

  8. McNemar_midP_test_paired_2x2

  9. Tang_asymptotic_score_CI_paired_2x2

  10. Tango_asymptotic_score_CI_paired_2x2

  11. MOVER_Wilson_score_CI_paired_2x2

  12. Newcombe_square_and_add_CI_paired_2x2

  13. Transformed_Blaker_exact_CI_paired_2x2

  14. Transformed_Clopper_Pearson_exact_CI_paired_2x2

  15. Transformed_Clopper_Pearson_midP_CI_paired_2x2

  16. Transformed_Wilson_score_CI_paired_2x2

  17. Wald_CI_diff_paired_2x2

  18. Wald_CI_diff_CC_paired_2x2

  19. Wald_CI_AgrestiMin_paired_2x2

  20. Wald_CI_BonettPrice_paired_2x2

  21. Wald_CI_OR_Laplace_paired_2x2

  22. Wald_CI_OR_paired_2x2

  23. Wald_CI_ratio_paired_2x2

  24. the_paired_2x2_table_CIs_difference

  25. the_paired_2x2_table_CIs_OR

  26. the_paired_2x2_table_CIs_ratio

  27. the_paired_2x2_table_tests

Note

You can also print the list above with list_functions(8).

References

  • Fagerland MW, Lydersen S, Laake P (2017) Statistical Analysis of Contingency Tables. Chapman & Hall/CRC, Boca Raton, FL

  • https://contingencytables.com/

  • https://www.routledge.com/Statistical-Analysis-of-Contingency-Tables/Fagerland-Lydersen-Laake/p/book/9781466588172


Chapter 9: The Paired cxc Table

Description

These are the functions related to chapter 9:

  1. Bhapkar_test_paired_cxc

  2. Bonferroni_type_CIs_paired_cxc

  3. FleissEveritt_test_paired_cxc

  4. FleissLevinPaik_test_paired_cxc

  5. McNemarBowker_test_paired_cxc

  6. Scheffe_type_CIs_paired_cxc

  7. Score_test_and_CI_marginal_mean_scores_paired_cxc

  8. Stuart_test_paired_cxc

  9. Wald_test_and_CI_marginal_mean_ranks_paired_cxc

  10. Wald_test_and_CI_marginal_mean_scores_paired_cxc

  11. the_paired_cxc_table_nominal

  12. the_paired_cxc_table_ordinal

Note

You can also print the list above with list_functions(9).

References

  • Fagerland MW, Lydersen S, Laake P (2017) Statistical Analysis of Contingency Tables. Chapman & Hall/CRC, Boca Raton, FL

  • https://contingencytables.com/

  • https://www.routledge.com/Statistical-Analysis-of-Contingency-Tables/Fagerland-Lydersen-Laake/p/book/9781466588172


The Clopper-Pearson exact confidence interval

Description

The Clopper-Pearson exact confidence interval for the binomial probability Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

ClopperPearson_exact_CI_1x2(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95#' CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

ClopperPearson_exact_CI_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"])
ClopperPearson_exact_CI_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
ClopperPearson_exact_CI_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
with(singh_2010["4th", ], ClopperPearson_exact_CI_1x2(X, n)) # alternative syntax
ClopperPearson_exact_CI_1x2(ligarden_2010["X"], ligarden_2010["n"])

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

Description

The Clopper-Pearson exact confidence interval for the binomial probability

(defined via the beta distribution)

Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

ClopperPearson_exact_CI_1x2_beta_version(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

References

Brown LD, Cai T, DasGupta A (2001) Interval estimation for a binomial proportion. Statistical Science; 16:101-133

See Also

ClopperPearson_exact_CI_1x2

Examples

ClopperPearson_exact_CI_1x2_beta_version(singh_2010["1st", "X"], singh_2010["1st", "n"])
ClopperPearson_exact_CI_1x2_beta_version(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
ClopperPearson_exact_CI_1x2_beta_version(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
with(singh_2010["4th", ], ClopperPearson_exact_CI_1x2_beta_version(X, n)) # alternative syntax
ClopperPearson_exact_CI_1x2_beta_version(ligarden_2010["X"], ligarden_2010["n"])

The Clopper-Pearson mid-P confidence interval

Description

The Clopper-Pearson mid-P confidence interval for the binomial probability Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

ClopperPearson_midP_CI_1x2(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

ClopperPearson_midP_CI_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"])
ClopperPearson_midP_CI_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
ClopperPearson_midP_CI_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
with(singh_2010["4th", ], ClopperPearson_midP_CI_1x2(X, n)) # alternative syntax
ClopperPearson_midP_CI_1x2(ligarden_2010["X"], ligarden_2010["n"])

The Cochran Q test of homogeneity of effects over strata

Description

The Cochran Q test of homogeneity of effects over strata

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

Cochran_Q_test_stratified_2x2(n, link = "linear", estimatetype = "MH")

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

link

the link function ('linear', 'log', or 'logit')

estimatetype

Mantel-Haenszel or inverse variance estimate ('MH' or 'IV')

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Cochran_Q_test_stratified_2x2(doll_hill_1950)
Cochran_Q_test_stratified_2x2(hine_1989)

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

Description

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

Described in Chapter 5 "The Ordered rx2 Table"

Usage

CochranArmitage_CI_rx2(n, a = seq_len(nrow(n)), alpha = 0.05)

Arguments

n

the observed counts (an rx2 matrix)

a

scores assigned to the rows

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

CochranArmitage_CI_rx2(mills_graubard_1987, c(1, 2, 3, 4, 5))
CochranArmitage_CI_rx2(indredavik_2008, c(1, 2, 3, 4, 5))

The Cochran-Armitage exact conditional and mid-P tests

Description

The Cochran-Armitage exact conditional and mid-P tests

Described in Chapter 5 "The Ordered rx2 Table"

Usage

CochranArmitage_exact_cond_midP_tests_rx2(n, a)

Arguments

n

the observed counts (an rx2 matrix)

a

scores assigned to the rows

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

## Not run: 
CochranArmitage_exact_cond_midP_tests_rx2(mills_graubard_1987, c(1, 2, 3, 4, 5))

## End(Not run)
CochranArmitage_exact_cond_midP_tests_rx2(indredavik_2008, c(1, 2, 3, 4, 5))

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

Description

Described in Chapter 5 "The Ordered rx2 Table"

Usage

CochranArmitage_MH_tests_rx2(n, a)

Arguments

n

the observed counts (an rx2 matrix)

a

scores assigned to the rows

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

CochranArmitage_MH_tests_rx2(mills_graubard_1987, c(1, 2, 3, 4, 5))
CochranArmitage_MH_tests_rx2(indredavik_2008, c(1, 2, 3, 4, 5))

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

Description

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

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

CochranMantelHaenszel_test_stratified_2x2(n)

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

CochranMantelHaenszel_test_stratified_2x2(doll_hill_1950)
CochranMantelHaenszel_test_stratified_2x2(hine_1989)

Statistical Analysis of Contingency tables

Description

Statistical Analysis of Contingency Tables is an invaluable tool for statistical inference in contingency tables. It covers effect size estimation, confidence intervals, and hypothesis tests for the binomial and the multinomial distributions, unpaired and paired 2x2 tables, rxc tables, ordered rx2 and 2xc tables, paired cxc tables, and stratified tables. This package provides functions that accompany the "Statistical Analysis of Contingency Tables" book by Fagerland et. al. <ISBN 9781466588172>.

Author(s)

Maintainer: Waldir Leoncio [email protected]

Authors:

Other contributors:

  • Stian Lydersen [contributor]

  • Petter Laake [contributor]

  • Ole Christian Lingjærde [translator]

  • Brad J. Biggerstaff [contributor]

References

  • Fagerland MW, Lydersen S, Laake P (2017) Statistical Analysis of Contingency Tables. Chapman & Hall/CRC, Boca Raton, FL

  • https://contingencytables.com/

  • https://www.routledge.com/Statistical-Analysis-of-Contingency-Tables/Fagerland-Lydersen-Laake/p/book/9781466588172

  • https://ocbe-uio.github.io/contingencytables/

See Also

print.contingencytables_result to read about printing alternatives.


contingencytables_result class

Description

A class for output of the main functions on this package

Usage

contingencytables_result(statistics, print_structure)

Arguments

statistics

Either a value or a list of values to be filled by print_format

print_structure

Either a string of a function instructing how to print the values from statistics

Value

an object of class contingencytables_result

Author(s)

Waldir Leoncio

See Also

print.contingencytables_result


The Cornfield exact conditional confidence interval for the odds ratio

Description

The Cornfield exact conditional confidence interval for the odds ratio

Described in Chapter 4 "The 2x2 Table"

Usage

Cornfield_exact_conditional_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed table (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Cornfield_exact_conditional_CI_2x2(tea)
Cornfield_exact_conditional_CI_2x2(perondi_2004)
Cornfield_exact_conditional_CI_2x2(lampasona_2013)
Cornfield_exact_conditional_CI_2x2(ritland_2007)

The Cornfield mid-P confidence interval for the odds ratio

Description

The Cornfield mid-P confidence interval for the odds ratio

Described in Chapter 4 "The 2x2 Table"

Usage

Cornfield_midP_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed table (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Cornfield_midP_CI_2x2(tea)
Cornfield_midP_CI_2x2(perondi_2004)
Cornfield_midP_CI_2x2(lampasona_2013)
Cornfield_midP_CI_2x2(ritland_2007)

Cumulative logit and probit models

Description

Cumulative logit and probit models

Described in Chapter 6 "The Ordered 2xc Table"

Usage

Cumulative_models_for_2xc(n, linkfunction = "logit", alpha = 0.05)

Arguments

n

the observed table (a 2xc matrix) with at least 3 columns

linkfunction

either "logit" or "probit"

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Cumulative_models_for_2xc(fontanella_2008)
Cumulative_models_for_2xc(lydersen_2012a)

Cumulative logit and probit models

Description

Cumulative logit and probit models

Described in Chapter 7 "The rxc Table"

Usage

Cumulative_models_for_rxc(n, linkfunction = "logit", alpha = 0.05)

Arguments

n

the observed table (an rxc matrix) with at least 3 columns

linkfunction

either "logit" or "probit"

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Cumulative_models_for_rxc(table_7.5)
Cumulative_models_for_rxc(table_7.6)

Smoking and lung cancer

Description

Smoking and lung cancer

Usage

doll_hill_1950

Format

An object of class array of dimension 2 x 2 x 2.

References

Doll and Hill (1950)


The exact binomial test for the binomial probability (pi)

Description

H_0 pi = pi0 vs H_A: pi ~= pi0 (two-sided)

Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

Exact_binomial_test_1x2(X, n, pi0)

Arguments

X

the number of successes

n

the total number of observations

pi0

a given probability

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Exact_binomial_test_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"], pi0 = 0.513)
Exact_binomial_test_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"], pi0 = 0.513)
Exact_binomial_test_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"], pi0 = 0.513)
Exact_binomial_test_1x2(singh_2010["4th", "X"], singh_2010["4th", "n"], pi0 = 0.513)
Exact_binomial_test_1x2(ligarden_2010["X"], ligarden_2010["n"], pi0 = 0.5)

Exact conditional and mid-P linear rank tests

Description

Exact conditional and mid-P linear rank tests

Described in Chapter 6 "The Ordered 2xc Table"

Usage

Exact_cond_midP_linear_rank_tests_2xc(n, b = 0)

Arguments

n

the observed table (a 2xc matrix)

b

scores assigned to the columns (if b=0, midranks will be used as scores)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Exact_cond_midP_linear_rank_tests_2xc(lydersen_2012a)
## Not run: Exact_cond_midP_linear_rank_tests_2xc(fontanella_2008)

Exact conditional and mid-P tests for the rxc table

Description

Exact conditional and mid-P tests for the rxc table: the Fisher-Freeman-Halton, Pearson, likelihood ratio, Kruskal-Wallis, linear-by-linear, and Jonckheere-Terpstra tests.

Described in Chapter 7 "The rxc Table"

Usage

Exact_cond_midP_tests_rxc(n)

Arguments

n

the observed counts (an rxc matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Note

Works only for 3x2 and 3x3 tables

Examples

Exact_cond_midP_tests_rxc(table_7.3)  # a 3x2 table
## Not run: 
  Exact_cond_midP_tests_rxc(table_7.6) # a 3x3 table

## End(Not run)

The exact conditional and mid-P tests for unspecific ordering

Description

The exact conditional and mid-P tests for unspecific ordering. May also be used for 2xc tables, after flipping rows and columns (i.e. if n is a 2xc table, call this function with n' (the transpose of n) as the first argument).

Described in Chapter 5 "The Ordered rx2 Table"

Usage

Exact_cond_midP_unspecific_ordering_rx2(n, direction, statistic = "Pearson")

Arguments

n

the observed counts (an rx2 matrix)

direction

the direction of the success probabilities ("increasing" or "decreasing")

statistic

the Pearson test statistic ("Pearson") or the likelihood ratio test statistic ("LR"). Can also be used for cumulative ORs in 2xc tables with "PearsonCumOR" or "LRCumOR".

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Chapter 6: Postoperative nausea (Lydersen et al., 2012a)
n <- t(lydersen_2012a)
Exact_cond_midP_unspecific_ordering_rx2(n, "decreasing")
Exact_cond_midP_unspecific_ordering_rx2(n, "decreasing", "PearsonCumOR")

The exact multinomial test for multinomial probabilities

Description

The exact multinomial test for multinomial probabilities

Described in Chapter 3 "The 1xc Table and the Multinomial Distribution"

Usage

Exact_multinomial_test_1xc(n, pi0)

Arguments

n

the observed counts (a 1xc vector, where c is the number of categories)

pi0

given probabilities (a 1xc vector)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Genotype counts for SNP rs 6498169 in RA patients
Exact_multinomial_test_1xc(n = snp6498169$complete$n, pi0 = snp6498169$complete$pi0)

# subset of 10 patients
Exact_multinomial_test_1xc(n = snp6498169$subset$n, pi0 = snp6498169$subset$pi0)

Exact unconditional test for association in 2x2 tables

Description

Exact unconditional test for association in 2x2 tables

Described in Chapter 4 "The 2x2 Table"

Usage

Exact_unconditional_test_2x2(n, statistic = "Pearson", gamma = 1e-04)

Arguments

n

the observed counts (a 2x2 matrix)

statistic

'Pearson' (Suissa-Shuster test default), 'LR' (likelihood ratio), ' unpooled' (unpooled Z), or 'Fisher' (Fisher-Boschloo test)

gamma

parameter for the Berger and Boos procedure (default=0.0001 gamma=0: no adj)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Note

Somewhat crude code with maximization over a simple partition of the nuisance parameter space into 'num_pi_values' equally spaced values (1000, hardcoded). This method could be improved with a better algorithm for the maximization however, it works well for most purposes. plot() the results to get an indication of the precision. A refinement of the maximization can be done with a manual restriction of the parameter space.

Examples

Exact_unconditional_test_2x2(tea)
Exact_unconditional_test_2x2(perondi_2004)
Exact_unconditional_test_2x2(lampasona_2013)
Exact_unconditional_test_2x2(ritland_2007)

Floppy eyelid syndrome vs obstructive sleep apnea

Description

Floppy eyelid syndrome vs obstructive sleep apnea

Usage

ezra_2010

Format

An object of class matrix (inherits from array) with 2 rows and 2 columns.

References

Ezra et al. (2010)


A comparison between serial and retrospective measurements

Description

A comparison between serial and retrospective measurements

Usage

fischer_1999

Format

An object of class matrix (inherits from array) with 5 rows and 5 columns.

References

Fischer et al. (1999)


The Fisher exact test for association in 2x2 tables

Description

The Fisher exact test for association in 2x2 tables

Described in Chapter 4 "The 2x2 Table"

Usage

Fisher_exact_test_2x2(n, statistic = "Pearson")

Arguments

n

the observed counts (a 2x2 matrix)

statistic

'hypergeometric' (i.e. Fisher-Irwin; default), 'Pearson', or 'LR' (likelihood ratio)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Fisher_exact_test_2x2(tea)
Fisher_exact_test_2x2(perondi_2004)
Fisher_exact_test_2x2(lampasona_2013)
Fisher_exact_test_2x2(ritland_2007)

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

Description

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

Described in Chapter 4 "The 2x2 Table"

Usage

Fisher_midP_test_2x2(n, statistic = "hypergeometric")

Arguments

n

the observed counts (a 2x2 matrix)

statistic

'hypergeometric' (i.e. Fisher-Irwin default), 'Pearson', or 'LR' (likelihood ratio)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Fisher_midP_test_2x2(tea)
Fisher_midP_test_2x2(perondi_2004)
Fisher_midP_test_2x2(lampasona_2013)
Fisher_midP_test_2x2(ritland_2007)

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

Description

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

Described in Chapter 7 "The rxc Table"

Usage

FisherFreemanHalton_asymptotic_test_rxc(n)

Arguments

n

the observed counts (an rxc matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Note

May not give results for all tables, due to overflow

Examples

FisherFreemanHalton_asymptotic_test_rxc(table_7.3)

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

Description

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

Usage

fleiss_2003

Format

An object of class matrix (inherits from array) with 3 rows and 3 columns.

References

Fleiss et al. (2003)


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

Description

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

Described in Chapter 9 "The Paired cxc Table"

Usage

FleissEveritt_test_paired_cxc(n)

Arguments

n

the observed table (a cxc matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

FleissEveritt_test_paired_cxc(fleiss_2003)

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

Description

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

Described in Chapter 9 "The Paired cxc Table"

Usage

FleissLevinPaik_test_paired_cxc(n)

Arguments

n

the observed table (a cxc matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Pretherapy susceptability of pathogens *without the N / A category*
FleissLevinPaik_test_paired_cxc(peterson_2007[-4, -4])

The Adolescent Placement Study

Description

The Adolescent Placement Study

Usage

fontanella_2008

Format

An object of class matrix (inherits from array) with 2 rows and 4 columns.

References

Fontanella et al. (2008)


The gamma coefficient

Description

The gamma coefficient

Described in Chapter 7 "The rxc Table"

Usage

gamma_coefficient_rxc(n)

Arguments

n

the observed table (an rxc matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

gamma_coefficient_rxc(table_7.7)
gamma_coefficient_rxc(table_7.8)
gamma_coefficient_rxc(table_7.9)

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

Description

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

Described in Chapter 7 "The rxc Table"

Usage

gamma_coefficient_rxc_bca(n, nboot = 10000, alpha = 0.05)

Arguments

n

the observed table (an rxc matrix)

nboot

number of bootstrap samples

alpha

the nominal significance level, used to compute a 100(1-alpha) confidence interval

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

set.seed(9623)
gamma_coefficient_rxc_bca(table_7.7, nboot = 800)
gamma_coefficient_rxc_bca(table_7.8, nboot = 200)
## Not run: 
  gamma_coefficient_rxc_bca(table_7.9, nboot = 3000, alpha = 0.2)

## End(Not run)

The Gart adjusted logit confidence interval for the odds ratio

Description

The Gart adjusted logit confidence interval for the odds ratio

Described in Chapter 4 "The 2x2 Table"

Usage

Gart_adjusted_logit_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed table (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Gart_adjusted_logit_CI_2x2(lampasona_2013)
Gart_adjusted_logit_CI_2x2(ritland_2007)

The Gold Wald simultaneous intervals for the multinomial probabilities

Description

The Gold Wald simultaneous intervals for the multinomial probabilities (with Scheffe adjustment)

Described in Chapter 3 "The 1xc Table and the Multinomial Distribution"

Usage

Gold_Wald_CIs_1xc(n, alpha = 0.05)

Arguments

n

the observed counts (a 1xc vector, where c is the number of categories)

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Gold_Wald_CIs_1xc(n = snp6498169$complete$n)

The Goodman Wald simultaneous intervals for the multinomial probabilities

Description

The Goodman Wald simultaneous intervals for the multinomial probabilities

(with Bonferroni adjustment)

Described in Chapter 3 "The 1xc Table and the Multinomial Distribution"

Usage

Goodman_Wald_CIs_1xc(n, alpha = 0.05)

Arguments

n

the observed counts (a 1xc vector, where c is the number of categories)

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Goodman_Wald_CIs_1xc(n = snp6498169$complete$n)

The Goodman Wald simultaneous intervals for the differences between the

Description

The Goodman Wald simultaneous intervals for the differences between the

multinomial probabilities (with Scheffe or Bonferroni adjustment)

Described in Chapter 3 "The 1xc Table and the Multinomial Distribution"

Usage

Goodman_Wald_CIs_for_diffs_1xc(n, alpha = 0.05, adjustment = "Bonferroni")

Arguments

n

the observed counts (a 1xc vector, where c is the number of categories)

alpha

the nominal level, e.g. 0.05 for 95# CIs

adjustment

Scheffe or Bonferroni adjustment ("Scheffe" or "Bonferroni")

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Goodman_Wald_CIs_for_diffs_1xc(n = snp6498169$complete$n)

The Goodman Wilson score simultaneous intervals for the multinomial probabilities

Description

The Goodman Wilson score simultaneous intervals for the multinomial probabilities

(with Bonferroni adjustment)

Described in Chapter 3 "The 1xc Table and the Multinomial Distribution"

Usage

Goodman_Wilson_score_CIs_1xc(n, alpha = 0.05)

Arguments

n

the observed counts (a 1xc vector, where c is the number of categories)

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Goodman_Wilson_score_CIs_1xc(n = snp6498169$complete$n)

Prophylactice use of Lidocaine in myocardial infarction

Description

Prophylactice use of Lidocaine in myocardial infarction

Usage

hine_1989

Format

An object of class array of dimension 2 x 2 x 6.

References

Hine et al. (1989)


Hypothetical experiment

Description

Hypothetical experiment

Usage

hypothetical

Format

An object of class numeric of length 5.


The Independence-smoothed logit confidence interval for the odds ratio

Description

The Independence-smoothed logit confidence interval for the odds ratio

Described in Chapter 4 "The 2x2 Table"

Usage

Independence_smoothed_logit_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed table (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Independence_smoothed_logit_CI_2x2(lampasona_2013)
Independence_smoothed_logit_CI_2x2(ritland_2007)

Elevated troponin T levels in stroke patients

Description

Elevated troponin T levels in stroke patients

Usage

indredavik_2008

Format

An object of class matrix (inherits from array) with 5 rows and 2 columns.

References

Indredavik et al. (2008)


The inverse hyperbolic sine confidence interval for the odds ratio

Description

The inverse hyperbolic sine confidence interval for the odds ratio

Described in Chapter 4 "The 2x2 Table"

Usage

Inv_sinh_CI_OR_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Inv_sinh_CI_OR_2x2(lampasona_2013)
Inv_sinh_CI_OR_2x2(ritland_2007)

The inverse hyperbolic sine confidence interval for the ratio of probabilities

Description

The inverse hyperbolic sine confidence interval for the ratio of probabilities

Described in Chapter 4 "The 2x2 Table"

Usage

Inv_sinh_CI_ratio_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Inv_sinh_CI_ratio_2x2(perondi_2004)
Inv_sinh_CI_ratio_2x2(ritland_2007)

The inverse variance estimate of the overall effect across strata

Description

The inverse variance estimate of the overall effect across strata

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

InverseVariance_estimate_stratified_2x2(n, link = "logit")

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

link

the link function ('linear', 'log', or 'logit')

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

InverseVariance_estimate_stratified_2x2(doll_hill_1950)
InverseVariance_estimate_stratified_2x2(hine_1989)

Jeffreys confidence interval for the binomial probability

Description

Jeffreys confidence interval for the binomial probability

Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

Jeffreys_CI_1x2(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Jeffreys_CI_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"])
Jeffreys_CI_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
Jeffreys_CI_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
with(singh_2010["4th", ], Jeffreys_CI_1x2(X, n)) # alternative syntax
Jeffreys_CI_1x2(ligarden_2010["X"], ligarden_2010["n"])

The Jonckheere-Terpstra test for association

Description

The Jonckheere-Terpstra test for association

Described in Chapter 7 "The rxc Table"

Usage

JonckheereTerpstra_test_rxc(n)

Arguments

n

the observed table (an rxc matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

JonckheereTerpstra_test_rxc(table_7.7)
JonckheereTerpstra_test_rxc(table_7.8)
JonckheereTerpstra_test_rxc(table_7.9)

The Katz log confidence interval for the ratio of probabilities

Description

The Katz log confidence interval for the ratio of probabilities

Described in Chapter 4 "The 2x2 Table"

Usage

Katz_log_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Katz_log_CI_2x2(perondi_2004)
Katz_log_CI_2x2(ritland_2007)

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

Description

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

Described in Chapter 7 "The rxc Table"

Usage

Kendalls_tau_b_rxc(n, alpha = 0.05)

Arguments

n

the observed table (an rxc matrix)

alpha

the nominal significance level, used to compute a 100(1-alpha)% confidence interval

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Kendalls_tau_b_rxc(table_7.7)
Kendalls_tau_b_rxc(table_7.8)
Kendalls_tau_b_rxc(table_7.9)

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

Description

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

Described in Chapter 7 "The rxc Table"

Usage

Kendalls_tau_b_rxc_bca(n, nboot = 10000, alpha = 0.05)

Arguments

n

the observed table (an rxc matrix)

nboot

number of bootstrap samples

alpha

the nominal significance level, used to compute a 100(1-alpha) confidence interval

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

set.seed(9974)
Kendalls_tau_b_rxc_bca(table_7.7, nboot = 800)
Kendalls_tau_b_rxc_bca(table_7.8, nboot = 200)
## Not run: 
  Kendalls_tau_b_rxc_bca(table_7.9)

## End(Not run)

The Koopman asymptotic score confidence interval for the ratio of probabilities

Description

The Koopman asymptotic score confidence interval for the ratio of probabilities

Described in Chapter 4 "The 2x2 Table"

Usage

Koopman_asymptotic_score_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Note

This versions uses the score test statistic of the Miettinen-Nurminen interval without the variance correction term.

Examples

Koopman_asymptotic_score_CI_2x2(perondi_2004)
Koopman_asymptotic_score_CI_2x2(ritland_2007)

The Kruskal-Wallis asymptotic test for singly ordered rxc tables

Description

The Kruskal-Wallis asymptotic test for singly ordered rxc tables

Described in Chapter 7 "The rxc Table"

Usage

KruskalWallis_asymptotic_test_rxc(n)

Arguments

n

the observed counts (an rxc matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

KruskalWallis_asymptotic_test_rxc(table_7.5)
KruskalWallis_asymptotic_test_rxc(table_7.6)

A case-control study of GADA exposure on IPEX syndrome

Description

A case-control study of GADA exposure on IPEX syndrome

Usage

lampasona_2013

Format

An object of class matrix (inherits from array) with 2 rows and 2 columns.

References

Lampasona et al. (2013)


Ligarden et al., 2010

Description

Ligarden et al., 2010

Usage

ligarden_2010

Format

An object of class numeric of length 2.

References

ligarden_2010


The linear-by-linear test for association

Description

The linear-by-linear test for association

Described in Chapter 7 "The rxc Table"

Usage

linear_by_linear_test_rxc(n, a = seq_len(ncol(n)), b = seq_len(nrow(n)))

Arguments

n

the observed table (an rxc matrix)

a

scores assigned to the rows

b

scores assigned to the columns

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

linear_by_linear_test_rxc(table_7.7)
linear_by_linear_test_rxc(table_7.8)
linear_by_linear_test_rxc(table_7.9)

List functions from a chapter

Description

Complements the ?chapX command by printing a list of functions related to a particular chapter X on the R console.

Usage

list_functions(chap_num)

Arguments

chap_num

Number of book chapter (from 2 to 10)

Value

List of functions from that chapter

Author(s)

Waldir Leoncio


The likelihood ratio confidence interval for the binomial probability

Description

The likelihood ratio confidence interval for the binomial probability. Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

LR_CI_1x2(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

LR_CI_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"])
LR_CI_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
LR_CI_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
with(singh_2010["4th", ], LR_CI_1x2(X, n)) # alternative syntax
LR_CI_1x2(ligarden_2010["X"], ligarden_2010["n"])

The likelihood ratio test for the binomial probability (pi)

Description

The likelihood ratio test for the binomial probability (pi) H_0: pi = pi0 vs H_A: pi ~= pi0 (two-sided). Described in Chapter 2 "The 1x2 Table and the Binomial Distribution".

Usage

LR_test_1x2(X, n, pi0)

Arguments

X

the number of successes

n

the total number of observations

pi0

a given probability

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

LR_test_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"], pi0 = .5)
LR_test_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"], pi0 = .5)
LR_test_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"], pi0 = .5)
LR_test_1x2(singh_2010["4th", "X"], singh_2010["4th", "n"], pi0 = .5)
LR_test_1x2(ligarden_2010["X"], ligarden_2010["n"], pi0 = .5)

The likelihood ratio test for multinomial probabilities

Description

The likelihood ratio test for multinomial probabilities

Described in Chapter 3 "The 1xc Table and the Multinomial Distribution"

Usage

LR_test_1xc(n, pi0)

Arguments

n

the observed counts (a 1xc vector, where c is the number of categories)

pi0

given probabilities (a 1xc vector)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Genotype counts for SNP rs 6498169 in RA patients
LR_test_1xc(n = snp6498169$complete$n, pi0 = snp6498169$complete$pi0)
# subset of 10 patients
LR_test_1xc(n = snp6498169$subset$n, pi0 = snp6498169$subset$pi0)

The likelihood ratio test for association in 2x2 tables

Description

The likelihood ratio test for association in 2x2 tables

Described in Chapter 4 "The 2x2 Table"

Usage

LR_test_2x2(n)

Arguments

n

the observed counts (a 2x2 matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

LR_test_2x2(tea)
LR_test_2x2(perondi_2004)
LR_test_2x2(lampasona_2013)
LR_test_2x2(ritland_2007)

Postoperative nausea

Description

Postoperative nausea

Usage

lydersen_2012a

Format

An object of class matrix (inherits from array) with 2 rows and 4 columns.

References

Lydersen et al. (2012a)


The Mantel-Haenszel estimate of the overall effect across strata

Description

The Mantel-Haenszel estimate of the overall effect across strata

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

MantelHaenszel_estimate_stratified_2x2(n, link = "logit")

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

link

the link function ('linear', 'log', or 'logit')

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

MantelHaenszel_estimate_stratified_2x2(doll_hill_1950)
MantelHaenszel_estimate_stratified_2x2(hine_1989)

The Mantel-Haenszel test of association with column scores

Description

The Mantel-Haenszel test of association with column scores

Described in Chapter 6 "The Ordered 2xc Table"

Usage

MantelHaenszel_test_2xc(n, b = 0)

Arguments

n

the observed counts (a 2xc matrix)

b

scores assigned to the columns (if b=0, midranks will be used as scores)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

MantelHaenszel_test_2xc(lydersen_2012a)

The McNemar asymptotic test with continuity correction

Description

The McNemar asymptotic test with continuity correction

Described in Chapter 8 "The Paired 2x2 Table"

Usage

McNemar_asymptotic_test_CC_paired_2x2(n)

Arguments

n

the observed table (a 2x2 matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

McNemar_asymptotic_test_CC_paired_2x2(bentur_2009)
McNemar_asymptotic_test_CC_paired_2x2(cavo_2012)
McNemar_asymptotic_test_CC_paired_2x2(ezra_2010)

The McNemar asymptotic test

Description

The McNemar asymptotic test

Described in Chapter 8 "The Paired 2x2 Table"

Usage

McNemar_asymptotic_test_paired_2x2(n)

Arguments

n

the observed table (a 2x2 matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

McNemar_asymptotic_test_paired_2x2(bentur_2009)
McNemar_asymptotic_test_paired_2x2(cavo_2012)
McNemar_asymptotic_test_paired_2x2(ezra_2010)

The McNemar exact conditional test

Description

The McNemar exact conditional test

Described in Chapter 8 "The Paired 2x2 Table"

Usage

McNemar_exact_cond_test_paired_2x2(n)

Arguments

n

the observed table (a 2x2 matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

McNemar_exact_cond_test_paired_2x2(bentur_2009)
McNemar_exact_cond_test_paired_2x2(cavo_2012)
McNemar_exact_cond_test_paired_2x2(ezra_2010)

The McNemar exact unconditional test

Description

The McNemar exact unconditional test

Described in Chapter 8 "The Paired 2x2 Table"

Usage

McNemar_exact_unconditional_test_paired_2x2(
  n,
  gamma = 1e-04,
  num_pi_values = 1000L
)

Arguments

n

the observed table (a 2x2 matrix)

gamma

parameter for the Berger and Boos procedure (default=0.0001; gamma=0: no adj)

num_pi_values

number of values to use in the partition of the nuisance parameter space (default=1000)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Note

Somewhat crude code with maximization over a simple partition of the nuisance parameter space into 'num_pi_values' equally spaced values The number may be changed. This method could be improved with a better algorithm for the maximization; however, it works well for most purposes. Try showplot=1 to get an indication of the precision. A refinement of the maximization can be done with a manual restriction of the parameter space.

Examples

McNemar_exact_unconditional_test_paired_2x2(bentur_2009)
## Not run: 
  McNemar_exact_unconditional_test_paired_2x2(cavo_2012, gamma = 0)
  McNemar_exact_unconditional_test_paired_2x2(ezra_2010)

## End(Not run)

The McNemar mid-P test

Description

The McNemar mid-P test

Described in Chapter 8 "The Paired 2x2 Table"

Usage

McNemar_midP_test_paired_2x2(n)

Arguments

n

the observed table (a 2x2 matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

McNemar_midP_test_paired_2x2(bentur_2009)
McNemar_midP_test_paired_2x2(cavo_2012)
McNemar_midP_test_paired_2x2(ezra_2010)

The McNemar-Bowker test for marginal symmetry

Description

The McNemar-Bowker test for marginal symmetry

Described in Chapter 9 "The Paired cxc Table"

Usage

McNemarBowker_test_paired_cxc(n)

Arguments

n

the observed table (a cxc matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Pretherapy susceptability of pathogens (Peterson et al., 2007)
McNemarBowker_test_paired_cxc(peterson_2007)

The Mee asymptotic score confidence interval for the difference between probabilities

Description

The Mee asymptotic score confidence interval for the difference between probabilities

Described in Chapter 4 "The 2x2 Table"

Usage

Mee_asymptotic_score_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# An RCT of high vs standard dose of epinephrine (Perondi et al., 2004):
Mee_asymptotic_score_CI_2x2(perondi_2004)

# The association between CHRNA4 genotype and XFS (Ritland et al., 2007):
Mee_asymptotic_score_CI_2x2(ritland_2007)

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

Description

The mid-P binomial test for the binomial probability (pi) H_0: pi = pi0 vs H_A: pi ~= pi0 (two-sided) Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

MidP_binomial_test_1x2(X, n, pi0)

Arguments

X

the number of successes

n

the total number of observations

pi0

a given probability

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# The number of 1st order male births (Singh et al. 2010, adapted)
MidP_binomial_test_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"], pi0 = .5)
# The number of 2nd order male births (Singh et al. 2010, adapted)
MidP_binomial_test_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"], pi0 = .5)
# The number of 3rd order male births (Singh et al. 2010, adapted)
MidP_binomial_test_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"], pi0 = .5)
# The number of 4th order male births (Singh et al. 2010, adapted)
MidP_binomial_test_1x2(singh_2010["4th", "X"], singh_2010["4th", "n"], pi0 = .5)
# Ligarden et al. (2010, adapted)
MidP_binomial_test_1x2(ligarden_2010["X"], ligarden_2010["n"], pi0 = .5)

The mid-P multinomial test for multinomial probabilities

Description

The mid-P multinomial test for multinomial probabilities

Described in Chapter 3 "The 1xc Table and the Multinomial Distribution"

Usage

MidP_multinomial_test_1xc(n, pi0)

Arguments

n

the observed counts (a 1xc vector, where c is the number of categories)

pi0

given probabilities (a 1xc vector)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Genotype counts for SNP rs 6498169 in RA patients
MidP_multinomial_test_1xc(n = snp6498169$complete$n, pi0 = snp6498169$complete$pi0)

# subset of 10 patients
MidP_multinomial_test_1xc(n = snp6498169$subset$n, pi0 = snp6498169$subset$pi0)

The Miettinen-Nurminen asymptotic score confidence interval for the

Description

The Miettinen-Nurminen asymptotic score confidence interval for the

difference between probabilities

Described in Chapter 4 "The 2x2 Table"

Usage

MiettinenNurminen_asymptotic_score_CI_difference_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# An RCT of high vs standard dose of epinephrine (Perondi et al., 2004):
MiettinenNurminen_asymptotic_score_CI_difference_2x2(perondi_2004)
# The association between CHRNA4 genotype and XFS (Ritland et al., 2007):
MiettinenNurminen_asymptotic_score_CI_difference_2x2(ritland_2007)

The Miettinen-Nurminen asymptotic score CI for the odds ratio

Description

The Miettinen-Nurminen asymptotic score confidence interval for the odds ratio

Described in Chapter 4 "The 2x2 Table"

Usage

MiettinenNurminen_asymptotic_score_CI_OR_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# A case-control study of GADA exposure on IPEX syndrome (Lampasona et al., 2013)
MiettinenNurminen_asymptotic_score_CI_OR_2x2(lampasona_2013)
# The association between CHRNA4 genotype and XFS (Ritland et al., 2007)
MiettinenNurminen_asymptotic_score_CI_OR_2x2(ritland_2007)

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

Description

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

Described in Chapter 4 "The 2x2 Table"

Usage

MiettinenNurminen_asymptotic_score_CI_ratio_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# An RCT of high vs standard dose of epinephrine (Perondi et al., 2004)
MiettinenNurminen_asymptotic_score_CI_ratio_2x2(perondi_2004)
# The association between CHRNA4 genotype and XFS (Ritland et al., 2007)
MiettinenNurminen_asymptotic_score_CI_ratio_2x2(ritland_2007)

Alcohol consumption and malformations

Description

Alcohol consumption and malformations

Usage

mills_graubard_1987

Format

An object of class matrix (inherits from array) with 5 rows and 2 columns.

References

Mills and Graubard (1987)


Calculate ML estimates

Description

Calculate ML estimates

Usage

ML_estimates(...)

Arguments

...

arguments passed to methods

Note

This function has little use to the user, it is exported for confirmity to R package standards.


Maximum likelihood estimates with CIs of the grouping and strata effects

Description

Maximum likelihood estimates with CIs of the grouping and strata effects

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

ML_estimates_and_CIs_stratified_2x2(n, link = "log", alpha = 0.05)

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

link

the link function ('linear', 'log', or 'logit')

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Smoking and lung cancer (Doll and Hill, 1950)
ML_estimates_and_CIs_stratified_2x2(doll_hill_1950)

# Prophylactice use of Lidocaine in myocardial infarction (Hine et al., 1989)
ML_estimates_and_CIs_stratified_2x2(hine_1989)

The MOVER-R Wilson confidence interval for the odds ratio

Description

The MOVER-R Wilson confidence interval for the odds ratio

Described in Chapter 4 "The 2x2 Table"

Usage

MOVER_R_Wilson_CI_OR_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# A case-control study of GADA exposure on IPEX syndrome (Lampasona et al., 2013):
MOVER_R_Wilson_CI_OR_2x2(lampasona_2013)

# The association between CHRNA4 genotype and XFS (Ritland et al., 2007):
MOVER_R_Wilson_CI_OR_2x2(ritland_2007)

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

Description

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

Described in Chapter 4 "The 2x2 Table"

Usage

MOVER_R_Wilson_CI_ratio_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# An RCT of high vs standard dose of epinephrine (Perondi et al., 2004)
MOVER_R_Wilson_CI_ratio_2x2(perondi_2004)

# The association between CHRNA4 genotype and XFS (Ritland et al., 2007)
MOVER_R_Wilson_CI_ratio_2x2(ritland_2007)

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

Description

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

Described in Chapter 8 "The Paired 2x2 Table"

Usage

MOVER_Wilson_score_CI_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

MOVER_Wilson_score_CI_paired_2x2(bentur_2009)
MOVER_Wilson_score_CI_paired_2x2(cavo_2012)

The Newcombe hybrid score confidence interval for the difference between probabilities

Description

The Newcombe hybrid score confidence interval for the difference between probabilities

Described in Chapter 4 "The 2x2 Table"

Usage

Newcombe_hybrid_score_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# An RCT of high vs standard dose of epinephrine (Perondi et al., 2004)
Newcombe_hybrid_score_CI_2x2(perondi_2004)

# The association between CHRNA4 genotype and XFS (Ritland et al., 2007)
Newcombe_hybrid_score_CI_2x2(ritland_2007)

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

Description

The Newcombe square-and-add confidence interval for the difference between paired probabilities.

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Newcombe_square_and_add_CI_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed table (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Airway hyper-responsiveness before and after stem cell transplantation
# (Bentur et al., 2009)
Newcombe_square_and_add_CI_paired_2x2(bentur_2009)

# Complete response before and after consolidation therapy
# (Cavo et al., 2012)
Newcombe_square_and_add_CI_paired_2x2(cavo_2012)

The Pearson chi-squared test for multinomial probabilities

Description

The Pearson chi-squared test for multinomial probabilities

Described in Chapter 3 "The 1xc Table and the Multinomial Distribution"

Usage

Pearson_chi_squared_test_1xc(n, pi0)

Arguments

n

the observed counts (a 1xc vector, where c is the number of categories)

pi0

given probabilities (a 1xc vector)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Genotype counts for SNP rs 6498169 in RA patients
Pearson_chi_squared_test_1xc(n = snp6498169$complete$n, pi0 = snp6498169$complete$pi0)
# subset of 10 patients
Pearson_chi_squared_test_1xc(n = snp6498169$subset$n, pi0 = snp6498169$subset$pi0)

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

Description

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

Described in Chapter 4 "The 2x2 Table"

Usage

Pearson_chi_squared_test_2x2(n)

Arguments

n

the observed counts (a 2x2 matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Example: A lady tasting a cup of tea
Pearson_chi_squared_test_2x2(tea)

# Example: Perondi et al. (2004)
Pearson_chi_squared_test_2x2(perondi_2004)

# Example: Lampasona et al. (2013)
Pearson_chi_squared_test_2x2(lampasona_2013)

# Example: Ritland et al. (2007)
Pearson_chi_squared_test_2x2(ritland_2007)

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

Description

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

with continuity correction

Described in Chapter 4 "The 2x2 Table"

Usage

Pearson_chi_squared_test_CC_2x2(n)

Arguments

n

the observed counts (a 2x2 matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Example: A lady tasting a cup of tea
Pearson_chi_squared_test_CC_2x2(tea)

# Example: Perondi et al. (2004)
Pearson_chi_squared_test_CC_2x2(perondi_2004)

# Example: Lampasona et al. (2013)
Pearson_chi_squared_test_CC_2x2(lampasona_2013)

# Example: Ritland et al. (2007)
Pearson_chi_squared_test_CC_2x2(ritland_2007)

The Pearson correlation coefficient

Description

The Pearson correlation coefficient

Described in Chapter 7 "The rxc Table"

Usage

Pearson_correlation_coefficient_rxc(
  n,
  a = seq_len(nrow(n)),
  b = seq_len(ncol(n)),
  alpha = 0.05
)

Arguments

n

the observed table (an rxc matrix)

a

scores assigned to the rows

b

scores assigned to the columns

alpha

the nominal significance level, used to compute a 100(1-alpha) confidence interval

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Pearson_correlation_coefficient_rxc(table_7.7)
  Pearson_correlation_coefficient_rxc(table_7.8)
  Pearson_correlation_coefficient_rxc(table_7.9)

The Pearson correlation coefficient with the bias-corrected and accelerated

Description

The Pearson correlation coefficient with the bias-corrected and accelerated

boostrap confidence interval

Described in Chapter 7 "The rxc Table"

Usage

Pearson_correlation_coefficient_rxc_bca(
  n,
  nboot = 10000,
  a = seq_len(nrow(n)),
  b = seq_len(ncol(n)),
  alpha = 0.05
)

Arguments

n

the observed table (an rxc matrix)

nboot

number of bootstrap samples

a

scores assigned to the rows

b

scores assigned to the columns

alpha

the nominal significance level, used to compute a 100(1-alpha) confidence interval

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

set.seed(3509)
Pearson_correlation_coefficient_rxc_bca(table_7.7, nboot = 800)
Pearson_correlation_coefficient_rxc_bca(table_7.8, nboot = 200)
## Not run: 
  Pearson_correlation_coefficient_rxc_bca(table_7.9)

## End(Not run)

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

Description

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

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

Pearson_LR_homogeneity_test_stratified_2x2(n, link = "logit")

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

link

the link function ('linear', 'log', or 'logit')

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Smoking and lung cancer (Doll and Hill, 1950)
Pearson_LR_homogeneity_test_stratified_2x2(doll_hill_1950)

# Prophylactice use of Lidocaine in myocardial infarction (Hine et al., 1989)
Pearson_LR_homogeneity_test_stratified_2x2(hine_1989)

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

Description

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

between probabilities (link = 'linear'), ratio of probabilities (link =

'log'), or odds ratio (link = 'logit')

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

Pearson_LR_test_common_effect_stratified_2x2(n, link = "logit")

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

link

the link function ('linear', 'log', or 'logit')

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Smoking and lung cancer (Doll and Hill, 1950)
Pearson_LR_test_common_effect_stratified_2x2(doll_hill_1950)

# Prophylactice use of Lidocaine in myocardial infarction (Hine et al., 1989)
Pearson_LR_test_common_effect_stratified_2x2(hine_1989)

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

Description

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

Described in Chapter 6 "The Ordered 2xc Table"

Usage

Pearson_LR_tests_cum_OR_2xc(n, direction = "decreasing")

Arguments

n

the observed counts (a 2xc matrix)

direction

the direction of column probabilities ("increasing" or "decreasing")

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Postoperative nausea (Lydersen et al., 2012a)
Pearson_LR_tests_cum_OR_2xc(lydersen_2012a)

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

Description

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

Described in Chapter 7 "The rxc Table"

Usage

Pearson_LR_tests_rxc(n)

Arguments

n

the observed counts (an rxc matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Examples from Chapter 5 (ordered rx2 tables)

## Alcohol consumption and malformations (Mills and Graubard, 1987):
Pearson_LR_tests_rxc(mills_graubard_1987)

## Elevated troponin T levels in stroke patients (Indredavik et al., 2008):
Pearson_LR_tests_rxc(indredavik_2008)

# Examples from Chapter 6 (ordered 2xc tables)
## The Adolescent Placement Study (Fontanella et al., 2008):
Pearson_LR_tests_rxc(fontanella_2008)

## Postoperative nausea (Lydersen et al., 2012a):
Pearson_LR_tests_rxc(lydersen_2012a)

# Examples from Chapter 7 (unordered rxc tables)

## Treatment for ear infection (van Balen et al., 2003):
Pearson_LR_tests_rxc(table_7.3)

## Psychiatric diagnoses vs PA (Mangerud et al., 2004):
Pearson_LR_tests_rxc(table_7.4)

## Psychiatric diag. vs BMI (Mangerud et al., 2004):
Pearson_LR_tests_rxc(table_7.5)

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

Description

The Pearson chi-squared and likelihood ratio tests for unspecific ordering in rx2 tables. Described in Chapter 5 "The Ordered rx2 Table". May also be used for 2xc tables, after flipping rows and columns (i.e. if n is a 2xc table, call this function with n' (the transpose of n) as the first argument).

Usage

Pearson_LR_tests_unspecific_ordering_rx2(n, direction)

Arguments

n

the observed counts (an rx2 matrix)

direction

the direction of the success probabilities ("increasing" or "decreasing")

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Chapter 5: Alcohol consumption and malformations (Mills and Graubard, 1987)
Pearson_LR_tests_unspecific_ordering_rx2(mills_graubard_1987, "increasing")

# Chapter 5: Elevated troponin T levels in stroke patients (Indredavik et al., 2008)
Pearson_LR_tests_unspecific_ordering_rx2(indredavik_2008, "decreasing")

# Chapter 6: Postoperative nausea (Lydersen et al., 2012a)
Pearson_LR_tests_unspecific_ordering_rx2(t(lydersen_2012a), "decreasing")

The Pearson residuals and the standardized Pearson residuals

Description

The Pearson residuals and the standardized Pearson residuals

Described in Chapter 7 "The rxc Table"

Usage

Pearson_residuals_rxc(n)

Arguments

n

the observed counts (an rxc matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

## Treatment for ear infection (van Balen et al., 2003):
Pearson_residuals_rxc(table_7.3)

## Psychiatric diagnoses vs PA (Mangerud et al., 2004):
Pearson_residuals_rxc(table_7.4)

## Psychiatric diag. vs BMI (Mangerud et al., 2004):
Pearson_residuals_rxc(table_7.5)

An RCT of high vs standard dose of epinephrine

Description

An RCT of high vs standard dose of epinephrine

Usage

perondi_2004

Format

An object of class matrix (inherits from array) with 2 rows and 2 columns.

References

Perondi et al. (2004)


Pretherapy susceptability of pathogens

Description

Pretherapy susceptability of pathogens

Usage

peterson_2007

Format

An object of class matrix (inherits from array) with 4 rows and 4 columns.

References

Peterson et al. (2007)


The Peto test for homogeneity of odds ratios over strata

Description

The Peto test for homogeneity of odds ratios over strata

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

Peto_homogeneity_test_stratified_2x2(n)

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

Examples

# Smoking and lung cancer (Doll and Hill, 1950)
Peto_homogeneity_test_stratified_2x2(doll_hill_1950)

# Prophylactice use of Lidocaine in myocardial infarction (Hine et al., 1989)
Peto_homogeneity_test_stratified_2x2(hine_1989)

The Peto estimate of the common odds ratio across strata

Description

The Peto estimate of the common odds ratio across strata

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

Peto_OR_estimate_stratified_2x2(n)

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Smoking and lung cancer (Doll and Hill, 1950)
Peto_OR_estimate_stratified_2x2(doll_hill_1950)

# Prophylactice use of Lidocaine in myocardial infarction (Hine et al., 1989)
Peto_OR_estimate_stratified_2x2(hine_1989)

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

Description

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

Described in Chapter 4 "The 2x2 Table"

Usage

PriceBonett_approximate_Bayes_CI_2x2(n, a = 1.25, b = 2.5, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

a, b

parameters of the beta distribution

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# An RCT of high vs standard dose of epinephrine (Perondi et al., 2004)
PriceBonett_approximate_Bayes_CI_2x2(perondi_2004)

# The association between CHRNA4 genotype and XFS (Ritland et al., 2007)
PriceBonett_approximate_Bayes_CI_2x2(ritland_2007)

Output from a contingency tables method

Description

Output from a contingency tables method

Usage

## S3 method for class 'contingencytables_result'
print(x, as_list = FALSE, ...)

Arguments

x

The output from a function from the contingencytables package

as_list

Print the elements of x as a list

...

unused (kept for consistency with the generic base::print())


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

Description

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

(with Scheffe adjustment)

Described in Chapter 3 "The 1xc Table and the Multinomial Distribution"

Usage

QuesenberryHurst_Wilson_score_CIs_1xc(n, alpha = 0.05)

Arguments

n

the observed counts (a 1xc vector, where c is the number of categories)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Genotype counts for SNP rs 6498169 in RA patients
QuesenberryHurst_Wilson_score_CIs_1xc(n = snp6498169$complete$n)

The RBG test and CI for a common odds ratio

Description

The RBG test and CI for a common odds ratio

(A Wald-type test and CI based on the Mantel-Haenszel estimate)

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

RBG_test_and_CI_stratified_2x2(n, alpha = 0.05)

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Smoking and lung cancer (Doll and Hill, 1950)
RBG_test_and_CI_stratified_2x2(doll_hill_1950)

# Prophylactice use of Lidocaine in myocardial infarction (Hine et al., 1989)
RBG_test_and_CI_stratified_2x2(hine_1989)

The association between CHRNA4 genotype and XFS

Description

The association between CHRNA4 genotype and XFS

Usage

ritland_2007

Format

An object of class matrix (inherits from array) with 2 rows and 2 columns.

References

Ritland et al. (2007)


Scheffe-type confidence intervals for differences of marginal probabilities

Description

Scheffe-type confidence intervals for differences of marginal probabilities

Described in Chapter 9 "The Paired kxk Table"

Usage

Scheffe_type_CIs_paired_cxc(n, alpha = 0.05)

Arguments

n

the observed table (a cxc matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Pretherapy susceptability of pathogens (Peterson et al., 2007)
Scheffe_type_CIs_paired_cxc(peterson_2007)

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

Description

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

Described in Chapter 7 "The rxc Table"

Usage

Scheffe_type_CIs_rxc(n, alpha = 0.05)

Arguments

n

the observed counts (an rx2 vector)

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Example: Treatment for ear infection
Scheffe_type_CIs_rxc(table_7.3)

The score test for the binomial probability (pi)

Description

The score test for the binomial probability (pi) H_0: pi = pi0 vs H_A: pi ~= pi0 (two-sided) Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

Score_test_1x2(X, n, pi0)

Arguments

X

the number of successes

n

the total number of observations

pi0

a given probability

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# The number of 1st order male births (Singh et al. 2010, adapted)
Score_test_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"], pi0 = .5)
# The number of 2nd order male births (Singh et al. 2010, adapted)
Score_test_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"], pi0 = .5)
# The number of 3rd order male births (Singh et al. 2010, adapted)
Score_test_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"], pi0 = .5)
# The number of 4th order male births (Singh et al. 2010, adapted)
Score_test_1x2(singh_2010["4th", "X"], singh_2010["4th", "n"], pi0 = .5)
# Ligarden et al. (2010, adapted)
Score_test_1x2(ligarden_2010["X"], ligarden_2010["n"], pi0 = .5)

Score test and CI marginal mean scores paired CxC

Description

The score test and confidence interval for the difference between marginal mean scores Described in Chapter 9 "The Paired cxc Table"

Usage

Score_test_and_CI_marginal_mean_scores_paired_cxc(
  n,
  a = seq_len(nrow(n)),
  alpha = 0.05
)

Arguments

n

the observed table (a cxc matrix)

a

scores assigned to the outcome categories

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# A comparison between serial and retrospective measurements
# (Fischer et al., 1999)
a <- c(8, 3.5, 0, -3.5, -8)
Score_test_and_CI_marginal_mean_scores_paired_cxc(fischer_1999, a)

The score test with continuity correction for the

Description

The score test with continuity correction for the binomial probability (pi). H_0: pi = pi0 vs H_A: pi ~= pi0 (two-sided). Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

Score_test_CC_1x2(X, n, pi0)

Arguments

X

the number of successes

n

the total number of observations

pi0

a given probability

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# The number of 1st order male births (Singh et al. 2010, adapted)
Score_test_CC_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"], pi0 = .5)
# The number of 2nd order male births (Singh et al. 2010, adapted)
Score_test_CC_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"], pi0 = .5)
# The number of 3rd order male births (Singh et al. 2010, adapted)
Score_test_CC_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"], pi0 = .5)
# The number of 4th order male births (Singh et al. 2010, adapted)
Score_test_CC_1x2(singh_2010["4th", "X"], singh_2010["4th", "n"], pi0 = .5)
# Ligarden et al. (2010, adapted)
Score_test_CC_1x2(ligarden_2010["X"], ligarden_2010["n"], pi0 = .5)

Score test for effect in the cumulative probit model

Description

The score test for effect in the cumulative probit model described in Chapter 6 "The Ordered 2xc Table"

Usage

Score_test_for_effect_in_the_probit_model_2xc(n, alphahat0)

Arguments

n

the observed counts (a 2xc matrix)

alphahat0

a column vector with c-1 estimated coefficients (alpha_j) under the null hypothesis (beta = 0)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Note

Must give the alphahats under the null hypothesis as input, because Matlab does not calculate an intercept-only probit model (and this may apply to R code as well). alphahat0 can be calculated in, for instance, Stata.

Examples

# The Adolescent Placement Study (Fontanella et al., 2008)
alphahat0 <- c(-1.246452, -0.5097363, 0.2087471)
Score_test_for_effect_in_the_probit_model_2xc(fontanella_2008, alphahat0)

# Postoperative nausea (Lydersen et al., 2012a)
alphahat0 <- c(-0.1923633, 0.5588396, 1.271953)
Score_test_for_effect_in_the_probit_model_2xc(lydersen_2012a, alphahat0)

Calculate ML estimates

Description

Calculate ML estimates

Usage

score_test_statistic(...)

Arguments

...

arguments passed to methods

Note

This function has little use to the user, it is exported for confirmity to R package standards.


The number of n-th order male births

Description

The number of n-th order male births

Usage

singh_2010

Format

An object of class data.frame with 4 rows and 2 columns.

References

Singh et al. (2010)


Genotype counts for SNP rs 6498169 in RA patients

Description

Genotype counts for SNP rs 6498169 in RA patients

Usage

snp6498169

Format

An object of class list of length 2.


The Spearman correlation coefficient

Description

The Spearman correlation coefficient

Described in Chapter 7 "The rxc Table"

Usage

Spearman_correlation_coefficient_rxc(n, alpha = 0.05)

Arguments

n

the observed table (an rxc matrix)

alpha

the nominal significance level, used to compute a 100(1-alpha)# confidence interval

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Spearman_correlation_coefficient_rxc(table_7.7)
Spearman_correlation_coefficient_rxc(table_7.8)
Spearman_correlation_coefficient_rxc(table_7.9)

The Spearman correlation coefficient with the bias-corrected and accelerated

Description

The Spearman correlation coefficient with the bias-corrected and accelerated

boostrap confidence interval

Described in Chapter 7 "The rxc Table"

Usage

Spearman_correlation_coefficient_rxc_bca(n, nboot = 10000, alpha = 0.05)

Arguments

n

the observed table (an rxc matrix)

nboot

number of bootstrap samples

alpha

the nominal significance level, used to compute a 100(1-alpha) confidence interval

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

set.seed(2921)
Spearman_correlation_coefficient_rxc_bca(table_7.7, nboot = 800)
Spearman_correlation_coefficient_rxc_bca(table_7.8, nboot = 200)
## Not run: 
  Spearman_correlation_coefficient_rxc_bca(table_7.9)

## End(Not run)

Stratified 2x2 tables

Description

Stratified 2x2 tables

Usage

stratified_2x2_tables(n, alpha = 0.05)

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

NULL. This function should be called for its printed output

Examples

# Smoking and lung cancer (Doll and Hill, 1950)
stratified_2x2_tables(doll_hill_1950)

# Prophylactice use of Lidocaine in myocardial infarction (Hine et al., 1989)
stratified_2x2_tables(hine_1989)

The Stuart test for marginal homogeneity

Description

The Stuart test for marginal homogeneity

Described in Chapter 9 "The Paired cxc Table"

Usage

Stuart_test_paired_cxc(n)

Arguments

n

the observed table (a cxc matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Pretherapy susceptability of pathogens (Peterson et al., 2007)
Stuart_test_paired_cxc(peterson_2007)

Treatment for ear infection

Description

Status after 21 days treatment of the ear infection acute otitis externa (Van Balen et al., 2003).

Van Balen et al. (2003) report a randomized, double-blind, controlled trial comparing three treatments for an ear infection. The numbers and proportions of patients reported cured and not cured after 21 days of treatment are summarized in Table 7.3. Because there is no ordering between the treatments, we regard Table 7.3 as an unordered 3 × 2 table.

Usage

table_7.3
vanbalen_2003

Format

An object of class matrix (inherits from array) with 3 rows and 2 columns.

References

Fagerland MW, Lydersen S, Laake P (2017)

Van Balen et al. (2003)


Psychiatric Diagnoses and Physical Activity

Description

Psychiatric diagnoses and participation in team sports (Mangerud et al., 2014)

Table 7.4 shows the number of subjects participating in team sports within each of six psychiatric diagnoses, based on data from a study of physical activity in adolescents aged 13 to 18 years who were referred to a child and adolescent psychiatric clinic from 2009 to 2001 (Mangerud et al., 2014). The psychiatric diagnoses are unordered, and we shall treat this as an unordered 6 x 2 table

Usage

table_7.4
mangerud_2014_PA

Format

An object of class matrix (inherits from array) with 6 rows and 2 columns.

References

Fagerland MW, Lydersen S, Laake P (2017)


Psychiatric diag. vs BMI with hyperkinetic disorders as reference category

Description

Psychiatric diagnoses and weight categories based on age- and sex-adjusted BMI (Mangerud et al., 2014).

Table 7.5 shows the number of thin, normal weight, and overweight subjects within each of six psychiatric diagnoses, based on the same study as in Section 7.2.2 (Mangerud et al., 2014). Body mass index (BMI) is calculated as the weight in kg divided by the squared height in meters. In subjects aged 18 years or older, the cut-off points for being categorized as thin, normal weight, and overweight are BMI less than 18.5, BMI between 18.5 and 25, and BMI above 25, respectively. For younger subjects (below 18 years of age), the categorization was done following internationally adopted cut-off points for age and sex (Cole et al., 2000, 2007). For example, the cut-off point for being overweight at age 13 is 21.91 for males and 22.58 for females.

Usage

table_7.5
mangerud_2014_BMI

Format

An object of class matrix (inherits from array) with 6 rows and 3 columns.

References

Fagerland MW, Lydersen S, Laake P (2017)

Mangerud et al. (2014)


Low Birth Weight vs psychiatric morbitidy with control as reference category

Description

Categories of birth weight and psychiatric problems at age 20 years (Lund et al., 2012).

Lund et al. (2012) report psychiatric morbidity in young adulthood in two low birth weight groups and a control group. The subjects were born between 1986 and 1988. The very low birth weight (VLBW) group consisted of babies born preterm with birth weight up to 1500 grams. The small for gestational age at term (SGA) group was born at term with birth weight below the 10th percentile adjusted for gestational age, sex, and parity. The control group was born at term, and was not small for gestational age. Table 7.6 shows the severity level of psychiatric problems at age 20 years. We shall regard the birth groups as unordered; however, the diagnostic groups are naturally ordered. Hence, Table 7.6 is a singly ordered 3 × 3 table with unordered rows and ordered columns.

Usage

table_7.6
lund_2012

Format

An object of class matrix (inherits from array) with 3 rows and 3 columns.

References

Fagerland MW, Lydersen S, Laake P (2017)

Lund et al. (2012)


Colorectal cancer (Table 7.7)

Description

Duration of symptoms and tumor stage for patients treated for colorectal cancer (Jullumstroe et al., 2009).

Early detection and treatment of colorectal cancer is beneficial, because advanced stages of colorectal cancer have poorer prognosis. Table 7.7 displays duration of symptoms (rows) versus tumor stage (columns) in a study of 784 patients treated for colorectal cancer at a regional hospital in Norway from 1980 to 2004 (Jullumstroe et al., 2009). The rows as well as the columns are ordered, and Table 7.7 can be regarded as a doubly ordered 4 × 4 table.

Usage

table_7.7
jullumstroe_2009

Format

An object of class matrix (inherits from array) with 4 rows and 4 columns.

References

Fagerland MW, Lydersen S, Laake P (2017)

Jullumstroe et al. (2009)


Breast Tumor

Description

Nuclear pleomorphism from fine needle aspiration smears and breast tumor type (Bofin et al., 2004).

Bofin et al. (2004) studied associations between different findings in fine needle aspiration (FNA) smears from breast tumors and the final histological diagnosis of tumor type in 133 patients. The aim of the study was to identify variables developed from FNA smears that could differentiate between the different tumor diagnoses. Table 7.8 presents the cross-classification of the FNA variable nuclear pleomorphism with tumor types. Both variables can be considered as ordered, with tumor type ordered from benign (as in NPBD) to most malign (as in IDC).

Usage

table_7.8
bofin_2004

Format

An object of class matrix (inherits from array) with 3 rows and 5 columns.

References

Fagerland MW, Lydersen S, Laake P (2017)

Bofin et al. (2004)


Self-rated health (Table 7.9)

Description

Self-rated health for 12 to 17 years old adolescents in Young-HUNT 1 and four years later in Young-HUNT 2 (Breidablik et al., 2008).

In the HUNT study (Nord-Trøndelag county health survey), one of the questions is: “How is your overall health at the moment?” The outcome categories are “Very good”, “Good”, “Not very good”, and “Poor”. Table 7.9 shows the counts for the adolescents aged 12 to 17 years in 1995 to 1997 (Young-HUNT 1), and for the same individuals four years later (Young-HUNT 2; Breidablik et al. (2008)). Both the rows and the columns are ordered. In this example, it may be appropriate to regard self-rated health as an unobserved (latent) continuous variable, where only a categorized version has been observed. Table 7.9 is actually an example of a paired c × c table with ordinal data.

Usage

table_7.9
breidablik_2008

Format

An object of class matrix (inherits from array) with 4 rows and 4 columns.

References

Fagerland MW, Lydersen S, Laake P (2017)

Breidablik et al. (2008)


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

Description

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

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Tang_asymptotic_score_CI_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed table (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Airway hyper-responsiveness before and after stem cell transplantation
# (Bentur et al., 2009)
Tang_asymptotic_score_CI_paired_2x2(bentur_2009)

# Complete response before and after consolidation therapy
# (Cavo et al., 2012)
Tang_asymptotic_score_CI_paired_2x2(cavo_2012)

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

Description

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

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Tango_asymptotic_score_CI_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Airway hyper-responsiveness before and after stem cell transplantation
# (Bentur et al., 2009)
Tango_asymptotic_score_CI_paired_2x2(bentur_2009)

# Complete response before and after consolidation therapy
# (Cavo et al., 2012)
Tango_asymptotic_score_CI_paired_2x2(cavo_2012)

A lady tasting a cup of tea

Description

A lady tasting a cup of tea

Usage

tea

Format

An object of class matrix (inherits from array) with 2 rows and 2 columns.


The 1x2 Table CIs

Description

The 1x2 Table CIs

Usage

the_1x2_table_CIs(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

NULL. This function should be called for its printed output

Examples

# The number of 1st order male births (Singh et al. 2010)
the_1x2_table_CIs(singh_2010["1st", "X"], singh_2010["1st", "n"])
# The number of 2nd order male births (Singh et al. 2010)
the_1x2_table_CIs(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
# The number of 3rd order male births (Singh et al. 2010)
the_1x2_table_CIs(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
# The number of 4th order male births (Singh et al. 2010)
with(singh_2010["4th", ], the_1x2_table_CIs(X, n)) # alternative syntax
# Ligarden et al. (2010)
the_1x2_table_CIs(ligarden_2010["X"], ligarden_2010["n"])

The 1x2 Table tests

Description

The 1x2 Table tests

Usage

the_1x2_table_tests(X, n, pi0)

Arguments

X

the number of successes

n

the total number of observations

pi0

a given probability

Value

NULL. This function should be called for its printed output

Examples

# Example: The number of 1st order male births (Singh et al. 2010)
the_1x2_table_tests(singh_2010["1st", "X"], singh_2010["1st", "n"], pi0 = 0.513)
# Example: The number of 2nd order male births (Singh et al. 2010)
the_1x2_table_tests(singh_2010["2nd", "X"], singh_2010["2nd", "n"], pi0 = 0.513)
# Example: The number of 3rd order male births (Singh et al. 2010)
the_1x2_table_tests(singh_2010["3rd", "X"], singh_2010["3rd", "n"], pi0 = 0.513)
# Example: The number of 4th order male births (Singh et al. 2010)
the_1x2_table_tests(singh_2010["4th", "X"], singh_2010["4th", "n"], pi0 = 0.513)
# Example: Ligarden et al. (2010)
the_1x2_table_tests(ligarden_2010["X"], ligarden_2010["n"], pi0 = 0.5)

The 1xc table CIs

Description

The 1xc table CIs

Usage

the_1xc_table_CIs(n, alpha = 0.05)

Arguments

n

the observed counts (a 1xc vector, where c is the number of categories)

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

NULL. This function should be called for its printed output

Examples

# Genotype counts for SNP rs 6498169 in RA patients
the_1xc_table_CIs(n = snp6498169$complete$n)

The 1xc table tests

Description

The 1xc table tests

Usage

the_1xc_table_tests(n, pi0, chacko.test = FALSE)

Arguments

n

the observed counts (a 1xc vector, where c is the number of categories)

pi0

given probabilities (a 1xc vector)

chacko.test

if TRUE, only performs the Chacko test

Value

NULL. This function should be called for its printed output

Examples

# Genotype counts for SNP rs 6498169 in RA patients
the_1xc_table_tests(n = snp6498169$complete$n, pi0 = snp6498169$complete$pi0)
# subset of 10 patients
the_1xc_table_tests(n = snp6498169$subset$n, pi0 = snp6498169$subset$pi0)
# Example for the Chacko test: Hypothetical experiment
the_1xc_table_tests(n = hypothetical, pi0 = c(0.402, 0.479, 0.119), TRUE)

The 2x2 table CIs difference

Description

Wrapper for ⁠_CI_2x2⁠ functions on Chapter 4.

Usage

the_2x2_table_CIs_difference(n, alpha = 0.05)

Arguments

n

frequency matrix

alpha

type I error

Value

NULL. This function should be called for its printed output

Examples

# An RCT of high vs standard dose of epinephrine (Perondi et al., 2004)
the_2x2_table_CIs_difference(perondi_2004)

# The association between CHRNA4 genotype and XFS (Ritland et al., 2007)
the_2x2_table_CIs_difference(ritland_2007)

The 2x2 table CIs odds ratio

Description

Wrapper for ⁠_CI_OR_2x2⁠ functions on Chapter 4.

Usage

the_2x2_table_CIs_OR(n, alpha = 0.05)

Arguments

n

frequency matrix

alpha

type I error

Value

NULL. This function should be called for its printed output

Examples

# Example: A lady tasting a cup of tea
the_2x2_table_CIs_OR(tea)

# Example: Perondi et al. (2004)
the_2x2_table_CIs_OR(perondi_2004)

# Example: Lampasona et al. (2013)
the_2x2_table_CIs_OR(lampasona_2013)

# Example: Ritland et al. (2007)
the_2x2_table_CIs_OR(ritland_2007)

The 2x2 table CIs ratio

Description

Wrapper for ⁠_CI_2x2⁠ functions on Chapter 4.

Usage

the_2x2_table_CIs_ratio(n, alpha = 0.05)

Arguments

n

frequency matrix

alpha

type I error

Value

NULL. This function should be called for its printed output

See Also

the_2x2_table_CIs_difference the_2x2_table_CIs_OR the_2x2_table_tests

Examples

# An RCT of high vs standard dose of epinephrine (Perondi et al., 2004)
the_2x2_table_CIs_ratio(perondi_2004)

# The association between CHRNA4 genotype and XFS (Ritland et al., 2007)
the_2x2_table_CIs_ratio(ritland_2007)

The 2x2 table tests

Description

Wrapper for ⁠_test_2x2⁠ functions on Chapter 4.

Usage

the_2x2_table_tests(n, gamma = 1e-04)

Arguments

n

frequency matrix

gamma

parameter for the Berger and Boos procedure

Value

NULL. This function should be called for its printed output

Examples

# Example: A lady tasting a cup of tea
the_2x2_table_tests(tea)

# Example: Lampasona et al. (2013)
the_2x2_table_tests(lampasona_2013)

## Not run: 
  the_2x2_table_tests(perondi_2004) # Example: Perondi et al. (2004)
  the_2x2_table_tests(ritland_2007) # Example: Ritland et al. (2007)

## End(Not run)

The 2xc table

Description

The 2xc table

Usage

the_2xc_table(n, alpha = 0.05, direction = "increasing")

Arguments

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

direction

the direction of the success probabilities

Value

NULL. This function should be called for its printed output.

Examples

## Not run: 
# The Adolescent Placement Study (Fontanella et al., 2008)
the_2xc_table(fontanella_2008)

# Postoperative nausea (Lydersen et al., 2012a)
the_2xc_table(lydersen_2012a, direction = "decreasing")

## End(Not run)

The Paired 2x2 table CIs difference

Description

The Paired 2x2 table CIs difference

Usage

the_paired_2x2_table_CIs_difference(n, alpha = 0.05)

Arguments

n

frequency matrix

alpha

type I error

Value

NULL. This function should be called for its printed output.

Examples

# Airway hyper-responsiveness before and after stem cell transplantation
# (Bentur et al., 2009)
the_paired_2x2_table_CIs_difference(bentur_2009)

# Complete response before and after consolidation therapy
# (Cavo et al., 2012)
the_paired_2x2_table_CIs_difference(cavo_2012)

The Paired 2x2 table CIs OR

Description

The Paired 2x2 table CIs OR

Usage

the_paired_2x2_table_CIs_OR(n, alpha = 0.05)

Arguments

n

frequency matrix

alpha

type I error

Value

NULL. This function should be called for its printed output.

Examples

the_paired_2x2_table_CIs_OR(ezra_2010)

The Paired 2x2 table CIs ratio

Description

The Paired 2x2 table CIs ratio

Usage

the_paired_2x2_table_CIs_ratio(n, alpha = 0.05)

Arguments

n

frequency matrix

alpha

type I error

Value

NULL. This function should be called for its printed output.

Examples

# Airway hyper-responsiveness before and after stem cell transplantation
# (Bentur et al., 2009)
the_paired_2x2_table_CIs_ratio(bentur_2009)

# Complete response before and after consolidation therapy
# (Cavo et al., 2012)
the_paired_2x2_table_CIs_ratio(cavo_2012)

The Paired 2x2 table tests

Description

The Paired 2x2 table tests

Usage

the_paired_2x2_table_tests(n, gamma = 1e-04, num_pi_values = 1000L)

Arguments

n

frequency matrix

gamma

parameter for the Berger and Boos procedure

num_pi_values

number of values to use in the partition of the nuisance parameter space (default=1000)

Value

NULL. This function should be called for its printed output.

Examples

the_paired_2x2_table_tests(bentur_2009)
the_paired_2x2_table_tests(cavo_2012, gamma = 0, num_pi_values = 10)
the_paired_2x2_table_tests(ezra_2010, gamma = 0, num_pi_values = 20)

The Paired CxC table - nominal

Description

The Paired CxC table - nominal

Usage

the_paired_cxc_table_nominal(n, alpha = 0.05)

Arguments

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

NULL. This function should be called for its printed output.

Examples

# Pretherapy susceptability of pathogens (Peterson et al., 2007)
the_paired_cxc_table_nominal(peterson_2007)

The Paired CxC table - ordinal

Description

The Paired CxC table - ordinal

Usage

the_paired_cxc_table_ordinal(n, a = seq_len(nrow(n)), alpha = 0.05)

Arguments

n

the total number of observations

a

scores assigned to the outcome categories

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

NULL. This function should be called for its printed output.

Examples

the_paired_cxc_table_ordinal(fischer_1999, c(8, 3.5, 0, -3.5, -8))

The rx2 table

Description

The rx2 table

Usage

the_rx2_table(n, alpha = 0.05, direction = "increasing", skip_exact = FALSE)

Arguments

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

direction

the direction of the success probabilities

skip_exact

If FALSE, skips the exact conditional and mid-P tests for unspecific ordering (often saves calculation time) ("increasing" or "decreasing")

Value

NULL. This function should be called for its printed output.

Examples

the_rx2_table(mills_graubard_1987, skip_exact = TRUE)
the_rx2_table(indredavik_2008, direction = "decreasing", skip_exact = TRUE)

The rxc table

Description

The rxc table

Usage

the_rxc_table(n, alpha = 0.05, nboot = 10000)

Arguments

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

nboot

number of boostrap samples. If 0, skips tests that use bootstrapping

Value

NULL. This function should be called for its printed output.

Examples

set.seed(8047)
# Unordered tables

## Treatment for ear infection (van Balen et al., 2003)
the_rxc_table(table_7.3, nboot = 200)

## Psychiatric diagnoses vs PA (Mangerud et al., 2004)
the_rxc_table(table_7.4, nboot = 0)

# Singly ordered tables

## Psychiatric diag. vs BMI (Mangerud et al., 2004)
the_rxc_table(table_7.5, nboot = 0)

## Low birth weight vs psychiatric morbitidy (Lund et al., 2012)
the_rxc_table(table_7.6, nboot = 150)

# Doubly ordered tables

## Colorectal cancer (Jullumstroe et al., 2009)
the_rxc_table(table_7.7, nboot = 0)

## Breast Tumor (Bofin et al., 2004)
the_rxc_table(table_7.8, nboot = 200)

## Self-rated health (Breidablik et al., 2008)
the_rxc_table(table_7.9, nboot = 0)

The Transformed Blaker exact confidence interval for the conditional odds ratio

Description

The Transformed Blaker exact confidence interval for the conditional odds ratio

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Transformed_Blaker_exact_CI_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Transformed_Blaker_exact_CI_paired_2x2(ezra_2010)

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

Description

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

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Transformed_Clopper_Pearson_exact_CI_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Transformed_Clopper_Pearson_exact_CI_paired_2x2(ezra_2010)

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

Description

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

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Transformed_Clopper_Pearson_midP_CI_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Transformed_Clopper_Pearson_midP_CI_paired_2x2(ezra_2010)

The Transformed Wilson score confidence interval for the conditional odds ratio

Description

The Transformed Wilson score confidence interval for the conditional odds ratio

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Transformed_Wilson_score_CI_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Transformed_Wilson_score_CI_paired_2x2(ezra_2010)

Trend estimate for linear and logit models

Description

Trend estimate for linear and logit models

  • The Wald test and CI

  • Likelihood ratio test

  • The Pearson goodness-of-fit test

  • Likelihood ratio (deviance) goodness-of-fit test

Described in Chapter 5 "The Ordered rx2 Table"

Usage

Trend_estimate_CI_tests_rx2(
  n,
  a = seq_len(nrow(n)),
  linkfunction = "logit",
  alpha = 0.05
)

Arguments

n

the observed counts (an rx2 matrix)

a

scores assigned to the rows

linkfunction

Link function for the binomial distribution see ?family for more details

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Alcohol consumption and malformations (Mills and Graubard, 1987)
Trend_estimate_CI_tests_rx2(mills_graubard_1987, 1:5)

# levated troponin T levels in stroke patients (Indredavik et al., 2008)
Trend_estimate_CI_tests_rx2(indredavik_2008, 1:5)

The uncorrected asymptotic score confidence interval for the odds ratio

Description

The uncorrected asymptotic score confidence interval for the odds ratio

Described in Chapter 4 "The 2x2 Table"

Usage

Uncorrected_asymptotic_score_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# A case-control study of GADA exposure on IPEX syndrome
# (Lampasona et al., 2013):
Uncorrected_asymptotic_score_CI_2x2(lampasona_2013)

# The association between CHRNA4 genotype and XFS (Ritland et al., 2007):
Uncorrected_asymptotic_score_CI_2x2(ritland_2007)

Validate arguments of a function

Description

This is an internal function used by user-level functions to validate their arguments.

Usage

validateArguments(x, types = "default")

Arguments

x

named list containing function arguments and their values

types

named vector of types for x

Details

Accepted validation types are:

  • "counts"

  • "positive"

  • "probability"

  • "linear, log or logit"

  • "MH or IV"

  • "logit or probit"

  • "increasing or decreasing"

  • A vector of possible values

Value

Nothing if all arguments fit their type. An error message otherwise.

Note

Types are evaluated alphabetically, and errors accuse no more than one invalid argument at a time.

Author(s)

Waldir Leoncio

Examples

Adjusted_inv_sinh_CI_OR_2x2(ritland_2007)
## Not run: Adjusted_inv_sinh_CI_OR_2x2(-ritland_2007)

The Wald confidence interval for the binomial probability

Description

Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

Wald_CI_1x2(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Wald_CI_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"])
Wald_CI_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
Wald_CI_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
with(singh_2010["4th", ], Wald_CI_1x2(X, n)) # alternative syntax
Wald_CI_1x2(ligarden_2010["X"], ligarden_2010["n"]) # Ligarden et al. (2010)

The Wald confidence interval for the difference between probabilities

Description

The Wald confidence interval for the difference between probabilities

Described in Chapter 4 "The 2x2 Table"

Usage

Wald_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# An RCT of high vs standard dose of epinephrine (Perondi et al., 2004):
Wald_CI_2x2(n = perondi_2004)
# The association between CHRNA4 genotype and XFS (Ritland et al., 2007):
Wald_CI_2x2(n = ritland_2007)

The Wald confidence interval for the difference between paired probabilities

Description

The Wald confidence interval for the difference between paired probabilities

with the pseudo-frequency adjustment suggested by Agresti and Min (2005)

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Wald_CI_AgrestiMin_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Airway hyper-responsiveness before and after stem cell transplantation
# (Bentur et al., 2009)
Wald_CI_AgrestiMin_paired_2x2(bentur_2009)

# Complete response before and after consolidation therapy
# (Cavo et al., 2012)
Wald_CI_AgrestiMin_paired_2x2(cavo_2012)

The Wald confidence interval for the difference between paired probabilities

Description

The Wald confidence interval for the difference between paired probabilities

with the pseudo-frequency adjustment suggested by Bonett and Price(2012)

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Wald_CI_BonettPrice_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Airway hyper-responsiveness before and after stem cell transplantation
# (Bentur et al., 2009)
Wald_CI_BonettPrice_paired_2x2(bentur_2009)

# Complete response before and after consolidation therapy
# (Cavo et al., 2012)
Wald_CI_BonettPrice_paired_2x2(cavo_2012)

The Wald CI with CC for the binomial probability

Description

The Wald confidence interval with continuity correction for the binomial probability. Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

Wald_CI_CC_1x2(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95# CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# The number of 1st order male births (Singh et al. 2010)
Wald_CI_CC_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"])
# The number of 2nd order male births (Singh et al. 2010)
Wald_CI_CC_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
# The number of 3rd order male births (Singh et al. 2010)
Wald_CI_CC_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
# The number of 4th order male births (Singh et al. 2010)
with(singh_2010["4th", ], Wald_CI_CC_1x2(X, n)) # alternative syntax
# Ligarden et al. (2010)
Wald_CI_CC_1x2(ligarden_2010["X"], ligarden_2010["n"])

The Wald confidence interval for the difference between probabilities

Description

The Wald confidence interval for the difference between probabilities with Yates's continuity correction. Described in Chapter 4 "The 2x2 Table"

Usage

Wald_CI_CC_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# An RCT of high vs standard dose of epinephrine (Perondi et al., 2004)
Wald_CI_CC_2x2(perondi_2004)

# The association between CHRNA4 genotype and XFS (Ritland et al., 2007)
Wald_CI_CC_2x2(ritland_2007)

The Wald confidence interval for the difference between paired probabilities

Description

The Wald confidence interval for the difference between paired probabilities

with continuity correction

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Wald_CI_diff_CC_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Airway hyper-responsiveness before and after stem cell transplantation
# (Bentur et al., 2009)
Wald_CI_diff_CC_paired_2x2(bentur_2009)

# Complete response before and after consolidation therapy
# (Cavo et al., 2012)
Wald_CI_diff_CC_paired_2x2(cavo_2012)

The Wald confidence interval for the difference between paired probabilities

Description

The Wald confidence interval for the difference between paired probabilities

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Wald_CI_diff_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Airway hyper-responsiveness before and after stem cell transplantation
# (Bentur et al., 2009)
Wald_CI_diff_paired_2x2(bentur_2009)

# Complete response before and after consolidation therapy
# (Cavo et al., 2012)
Wald_CI_diff_paired_2x2(cavo_2012)

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

Description

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

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Wald_CI_OR_Laplace_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Wald_CI_OR_Laplace_paired_2x2(ezra_2010)

The Wald confidence interval for the conditional odds ratio

Description

The Wald confidence interval for the conditional odds ratio

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Wald_CI_OR_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

Wald_CI_OR_paired_2x2(ezra_2010)

The Wald confidence interval for the ratio of paired probabilities

Description

The Wald confidence interval for the ratio of paired probabilities

Described in Chapter 8 "The Paired 2x2 Table"

Usage

Wald_CI_ratio_paired_2x2(n, alpha = 0.05)

Arguments

n

the observed counts (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Airway hyper-responsiveness before and after stem cell transplantation
# (Bentur et al., 2009)
Wald_CI_ratio_paired_2x2(bentur_2009)

# Complete response before and after consolidation therapy
# (Cavo et al., 2012)
Wald_CI_ratio_paired_2x2(cavo_2012)

The Wald test for the binomial probability (pi)

Description

The Wald test for the binomial probability (pi)

H_0: pi = pi0 vs H_A: pi ~= pi0 (two-sided)

Usage

Wald_test_1x2(X, n, pi0)

Arguments

X

the number of successes

n

the total number of observations

pi0

a given probability

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# The number of 1st order male births (adapted from Singh et al. 2010)
Wald_test_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"], pi0 = 0.1)
# The number of 2nd order male births (adapted from Singh et al. 2010)
Wald_test_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"], pi0 = 0.1)
# The number of 3rd order male births (adapted from Singh et al. 2010)
Wald_test_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"], pi0 = 0.1)
# The number of 4th order male births (adapted from Singh et al. 2010)
Wald_test_1x2(singh_2010["4th", "X"], singh_2010["4th", "n"], pi0 = 0.1)
# Ligarden et al. (2010)
Wald_test_1x2(ligarden_2010["X"], ligarden_2010["n"], pi0 = 0.1)

The Wald test and CI for a common difference between probabilities

Description

The Wald test and CI for a common difference between probabilities based on either the Mantel-Haenszel or inverse variance estimate

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

Wald_test_and_CI_common_diff_stratified_2x2(
  n,
  estimatetype = "MH",
  alpha = 0.05
)

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

estimatetype

Mantel-Haenszel or inverse variance estimate ('MH' or 'IV')

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Smoking and lung cancer (Doll and Hill, 1950)
Wald_test_and_CI_common_diff_stratified_2x2(doll_hill_1950)

# Prophylactice use of Lidocaine in myocardial infarction (Hine et al., 1989)
Wald_test_and_CI_common_diff_stratified_2x2(hine_1989)

The Wald test and CI for a common ratio of probabilities

Description

The Wald test and CI for a common ratio of probabilities

based on either the Mantel-Haenszel or inverse variance estimate

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

Wald_test_and_CI_common_ratio_stratified_2x2(
  n,
  estimatetype = "MH",
  alpha = 0.05
)

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

estimatetype

Mantel-Haenszel or inverse variance estimate ('MH' or 'IV')

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Smoking and lung cancer (Doll and Hill, 1950)
Wald_test_and_CI_common_ratio_stratified_2x2(doll_hill_1950)

# Prophylactice use of Lidocaine in myocardial infarction (Hine et al., 1989)
Wald_test_and_CI_common_ratio_stratified_2x2(hine_1989)

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

Description

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

Described in Chapter 9 "The Paired cxc Table"

Usage

Wald_test_and_CI_marginal_mean_ranks_paired_cxc(n, alpha = 0.05)

Arguments

n

the observed table (a cxc matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# A comparison between serial and retrospective measurements
# (Fischer et al., 1999)
Wald_test_and_CI_marginal_mean_ranks_paired_cxc(fischer_1999)

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

Description

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

Described in Chapter 9 "The Paired cxc Table"

Usage

Wald_test_and_CI_marginal_mean_scores_paired_cxc(
  n,
  a = seq_len(nrow(n)),
  alpha = 0.05
)

Arguments

n

the observed table (a cxc matrix)

a

scores assigned to the outcome categories

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# A comparison between serial and retrospective measurements
# (Fischer et al., 1999)
a <- c(8, 3.5, 0, -3.5, -8)
Wald_test_and_CI_marginal_mean_scores_paired_cxc(fischer_1999, a)

The Wald test with continuity correction for the binomial probability

Description

The Wald test with continuity correction for the binomial probability (pi)

H_0: pi = pi0 vs H_A: pi ~= pi0 (two-sided)

Usage

Wald_test_CC_1x2(X, n, pi0)

Arguments

X

the number of successes

n

the total number of observations

pi0

a given probability

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# The number of 1st order male births (adapted from Singh et al. 2010)
Wald_test_CC_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"], pi0 = 0.1)
# The number of 2nd order male births (adapted from Singh et al. 2010)
Wald_test_CC_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"], pi0 = 0.1)
# The number of 3rd order male births (adapted from Singh et al. 2010)
Wald_test_CC_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"], pi0 = 0.1)
# The number of 4th order male births (adapted from Singh et al. 2010)
Wald_test_CC_1x2(singh_2010["4th", "X"], singh_2010["4th", "n"], pi0 = 0.1)
# Ligarden et al. (2010)
Wald_test_CC_1x2(ligarden_2010["X"], ligarden_2010["n"], pi0 = 0.1)

The Wilson score confidence interval

Description

The Wilson score confidence interval

Usage

Wilson_score_CI_1x2(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

References

Reference Wilson EB (1927) Probable inference, the law of succession, and statistical inference. Journal of the American Statistical Association 22209-212

Examples

# birth order 1, Singh et al. (2010)
Wilson_score_CI_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"])
# birth order 2, Singh et al. (2010)
Wilson_score_CI_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
# birth order 3, Singh et al. (2010)
Wilson_score_CI_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
# birth order 4, Singh et al. (2010)
with(singh_2010["4th", ], Wilson_score_CI_1x2(X, n)) # alternative syntax
# Ligarden (2010)
Wilson_score_CI_1x2(ligarden_2010["X"], ligarden_2010["n"])

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

Description

Described in Chapter 2 "The 1x2 Table and the Binomial Distribution"

Usage

Wilson_score_CI_CC_1x2(X, n, alpha = 0.05)

Arguments

X

the number of successes

n

the total number of observations

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

References

Reference Wilson EB (1927) Probable inference, the law of succession, and statistical inference. Journal of the American Statistical Association; 22209-212

Examples

# The number of 1st order male births (Singh et al. 2010)
Wilson_score_CI_CC_1x2(singh_2010["1st", "X"], singh_2010["1st", "n"])
# The number of 2nd order male births (Singh et al. 2010)
Wilson_score_CI_CC_1x2(singh_2010["2nd", "X"], singh_2010["2nd", "n"])
# The number of 3rd order male births (Singh et al. 2010)
Wilson_score_CI_CC_1x2(singh_2010["3rd", "X"], singh_2010["3rd", "n"])
# The number of 4th order male births (Singh et al. 2010)
with(singh_2010["4th", ], Wilson_score_CI_CC_1x2(X, n)) # alternative syntax
# Ligarden et al. (2010)
Wilson_score_CI_CC_1x2(ligarden_2010["X"], ligarden_2010["n"])

The Woolf logit confidence interval for the odds ratio

Description

The Woolf logit confidence interval for the odds ratio

Described in Chapter 4 "The 2x2 Table"

Usage

Woolf_logit_CI_2x2(n, alpha = 0.05)

Arguments

n

the observed table (a 2x2 matrix)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# A case-control study of GADA exposure on IPEX syndrome
# (Lampasona et al., 2013):
Woolf_logit_CI_2x2(lampasona_2013)

# The association between CHRNA4 genotype and XFS (Ritland et al., 2007):
Woolf_logit_CI_2x2(ritland_2007)

The Woolf test and CI for a common odds ratio

Description

The Woolf test and CI for a common odds ratio

(A Wald-type test and CI based on the inverse variance estimate)

Described in Chapter 10 "Stratified 2x2 Tables and Meta-Analysis"

Usage

Woolf_test_and_CI_stratified_2x2(n, alpha = 0.05)

Arguments

n

the observed table (a 2x2xk matrix, where k is the number of strata)

alpha

the nominal level, e.g. 0.05 for 95% CIs

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Smoking and lung cancer (Doll and Hill, 1950)
Woolf_test_and_CI_stratified_2x2(doll_hill_1950)

# Prophylactice use of Lidocaine in myocardial infarction (Hine et al., 1989)
Woolf_test_and_CI_stratified_2x2(hine_1989)

The Z-unpooled test for association in 2x2 tables

Description

The Z-unpooled test for association in 2x2 tables

Described in Chapter 4 "The 2x2 Table"

Usage

Z_unpooled_test_2x2(n)

Arguments

n

the observed counts (a 2x2 matrix)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Examples

# Example: A lady tasting a cup of tea
Z_unpooled_test_2x2(tea)

# Example: Perondi et al. (2004)
Z_unpooled_test_2x2(perondi_2004)

# Example: Lampasona et al. (2013)
Z_unpooled_test_2x2(lampasona_2013)

# Example: Ritland et al. (2007)
Z_unpooled_test_2x2(ritland_2007)