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

Described in Chapter 7 "The rxc Table"

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)
#> Pearson chi-squared test: T = 12.082, df = 4, P = 0.01675
#> Likelihood ratio test:    T =  6.202, df = 4, P = 0.18456

## Elevated troponin T levels in stroke patients (Indredavik et al., 2008):
Pearson_LR_tests_rxc(indredavik_2008)
#> Pearson chi-squared test: T = 13.490, df = 4, P = 0.00912
#> Likelihood ratio test:    T = 14.625, df = 4, P = 0.00555

# Examples from Chapter 6 (ordered 2xc tables)
## The Adolescent Placement Study (Fontanella et al., 2008):
Pearson_LR_tests_rxc(fontanella_2008)
#> Pearson chi-squared test: T = 51.571, df = 3, P = 0.00000
#> Likelihood ratio test:    T = 54.831, df = 3, P = 0.00000

## Postoperative nausea (Lydersen et al., 2012a):
Pearson_LR_tests_rxc(lydersen_2012a)
#> Pearson chi-squared test: T =  3.813, df = 3, P = 0.28238
#> Likelihood ratio test:    T =  3.914, df = 3, P = 0.27090

# Examples from Chapter 7 (unordered rxc tables)

## Treatment for ear infection (van Balen et al., 2003):
Pearson_LR_tests_rxc(table_7.3)
#> Pearson chi-squared test: T = 17.562, df = 2, P = 0.00015
#> Likelihood ratio test:    T = 16.700, df = 2, P = 0.00024

## Psychiatric diagnoses vs PA (Mangerud et al., 2004):
Pearson_LR_tests_rxc(table_7.4)
#> Pearson chi-squared test: T = 11.687, df = 5, P = 0.03934
#> Likelihood ratio test:    T = 11.851, df = 5, P = 0.03689

## Psychiatric diag. vs BMI (Mangerud et al., 2004):
Pearson_LR_tests_rxc(table_7.5)
#> Pearson chi-squared test: T = 25.092, df = 10, P = 0.00517
#> Likelihood ratio test:    T = 24.272, df = 10, P = 0.00691