Type: Package
Title: Classification of Sparseness in 2-by-2 Categorical Data
Version: 1.0.5
Date: 2025-09-29
Maintainer: Subbiah M <sisufive@gmail.com>
Description: Provides functions for classifying sparseness in 2 x 2 categorical data where one or more cells have zero counts. The classification uses three widely applied summary measures: Risk Difference (RD), Relative Risk (RR), and Odds Ratio (OR). Helps in selecting suitable continuity corrections for zero cells in multi-centre or meta-analysis studies. Also supports sensitivity analysis and can detect phenomena such as Simpson's paradox. The methodology is based on Subbiah and Srinivasan (2008) <doi:10.1016/j.spl.2008.06.023>.
License: GPL-2
Encoding: UTF-8
RoxygenNote: 7.3.1
NeedsCompilation: no
Packaged: 2025-09-28 23:45:33 UTC; admin
Author: Subbiah M [aut, cre]
Repository: CRAN
Date/Publication: 2025-10-06 05:40:02 UTC

Classify Sparseness in 2x2 Tables using Odds Ratio

Description

Classifies sparseness in 2x2 categorical tables where one or more cells are zero. The classification uses widely applied summary measures and a continuity correction to determine whether a table exhibits mild, moderate, or severe sparseness.

Usage

nose.or(nos, cc)

Arguments

nos

A numeric matrix or data.frame with 4 columns representing counts in a 2x2 table: a (top-left), b (top-right), c (bottom-left), d (bottom-right). Each row corresponds to a separate 2x2 table.

cc

Continuity correction factor (numeric, e.g., 0.3)

Value

A matrix combining the input counts with an extra column indicating the sparseness classification for each table.

Examples

# Simple example: one 2x2 table with a zero cell
xx <- matrix(c(0, 3, 2, 5), nrow = 1, byrow = TRUE)
nose.or(xx, cc = 0.3)

# Multiple tables example: each row is a separate 2x2 table
tables <- matrix(c(
  0, 3, 2, 5,
  2, 0, 1, 4,
  0, 0, 2, 3
), nrow = 3, byrow = TRUE)
nose.or(tables, cc = 0.3)

Classify Sparseness in 2x2 Tables using Risk Difference

Description

Classifies sparseness in 2x2 categorical tables where one or more cells are zero. The classification uses widely applied summary measures and a continuity correction to determine whether a table exhibits mild, moderate, or severe sparseness.

Usage

nose.rd(nos, cc)

Arguments

nos

A numeric matrix or data.frame with 4 columns representing counts in a 2x2 table: a (top-left), b (top-right), c (bottom-left), d (bottom-right). Each row corresponds to a separate 2x2 table.

cc

Continuity correction factor (numeric, e.g., 0.3)

Value

A matrix combining the input counts with an extra column indicating the sparseness classification for each table.

Examples

# Simple example: one 2x2 table with a zero cell
xx <- matrix(c(0, 3, 2, 5), nrow = 1, byrow = TRUE)
nose.rd(xx, cc = 0.3)

# Multiple tables example: each row is a separate 2x2 table
tables <- matrix(c(
  0, 3, 2, 5,
  2, 0, 1, 4,
  0, 0, 2, 3
), nrow = 3, byrow = TRUE)
nose.rd(tables, cc = 0.3)

Classify Sparseness in 2x2 Tables using Risk Ratio

Description

Classifies sparseness in 2x2 categorical tables where one or more cells are zero. The classification uses widely applied summary measures and a continuity correction to determine whether a table exhibits mild, moderate, or severe sparseness.

Usage

nose.rr(nos, cc)

Arguments

nos

A numeric matrix or data.frame with 4 columns representing counts in a 2x2 table: a (top-left), b (top-right), c (bottom-left), d (bottom-right). Each row corresponds to a separate 2x2 table.

cc

Continuity correction factor (numeric, e.g., 0.3)

Value

A matrix combining the input counts with an extra column indicating the sparseness classification for each table.

Examples

# Simple example: one 2x2 table with a zero cell
xx <- matrix(c(0, 3, 2, 5), nrow = 1, byrow = TRUE)
nose.rr(xx, cc = 0.3)

# Multiple tables example: each row is a separate 2x2 table
tables <- matrix(c(
  0, 3, 2, 5,
  2, 0, 1, 4,
  0, 0, 2, 3
), nrow = 3, byrow = TRUE)
nose.rr(tables, cc = 0.3)