The Pearson residuals and the standardized Pearson residuals

Described in Chapter 7 "The rxc Table"

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)
#> Pearson residuals:
#>            [,1]      [,2]
#> [1,] -1.5753727  3.045850
#> [2,]  0.8467851 -1.637187
#> [3,]  0.7124830 -1.377526
#> 
#> Standardized Pearson residuals:
#>           [,1]      [,2]
#> [1,] -4.178875  4.178875
#> [2,]  2.213411 -2.213411
#> [3,]  1.949026 -1.949026

## Psychiatric diagnoses vs PA (Mangerud et al., 2004):
Pearson_residuals_rxc(table_7.4)
#> Pearson residuals:
#>             [,1]        [,2]
#> [1,]  0.90342075 -1.27588328
#> [2,]  0.04289348 -0.06057761
#> [3,] -1.21560402  1.71677356
#> [4,]  1.07887352 -1.52367176
#> [5,] -0.66563137  0.94005804
#> [6,]  0.00532264 -0.00751706
#> 
#> Standardized Pearson residuals:
#>              [,1]         [,2]
#> [1,]  1.697143624 -1.697143624
#> [2,]  0.086555318 -0.086555318
#> [3,] -2.147109879  2.147109879
#> [4,]  1.933370535 -1.933370535
#> [5,] -1.466663369  1.466663369
#> [6,]  0.009671725 -0.009671725

## Psychiatric diag. vs BMI (Mangerud et al., 2004):
Pearson_residuals_rxc(table_7.5)
#> Pearson residuals:
#>             [,1]       [,2]        [,3]
#> [1,] -1.53043754  0.5236911  0.06719368
#> [2,] -1.32840101  1.0010884 -0.76324572
#> [3,]  3.07824372  0.1955264 -2.01247808
#> [4,]  0.92452195 -0.6207156  0.41693475
#> [5,]  0.09530522 -0.4109633  0.56456984
#> [6,]  1.20826157 -1.1035988  0.98441639
#> 
#> Standardized Pearson residuals:
#>           [,1]       [,2]        [,3]
#> [1,] -1.734762  0.9357843  0.08575454
#> [2,] -1.622368  1.9273863 -1.04951534
#> [3,]  3.285383  0.3289763 -2.41834590
#> [4,]  1.002982 -1.0615604  0.50927014
#> [5,]  0.127442 -0.8663136  0.84999783
#> [6,]  1.327766 -1.9118241  1.21798982