diagTab {mcradds} | R Documentation |
Creates Contingency Table
Description
Creates a 2x2 contingency table from the data frame or matrix for the qualitative performance and reader precision of downstream analysis.
Usage
diagTab(
formula = ~.,
data,
bysort = NULL,
dimname = NULL,
levels = NULL,
rep = FALSE,
across = NULL
)
Arguments
formula |
( |
data |
( |
bysort |
( |
dimname |
( |
levels |
( |
rep |
( |
across |
( |
Value
A object MCTab
contains the 2x2 contingency table.
Note
To be attention that if you would like to generate the 2x2 contingency table for reproducibility analysis, the original data should be long structure and using the corresponding formula.
See Also
Summary()
for object to calculate diagnostic accuracy criteria.
Examples
# For qualitative performance with wide data structure
data("qualData")
qualData %>% diagTab(formula = ~ CandidateN + ComparativeN)
qualData %>%
diagTab(
formula = ~ CandidateN + ComparativeN,
levels = c(1, 0)
)
# For qualitative performance with long data structure
dummy <- data.frame(
id = c("1001", "1001", "1002", "1002", "1003", "1003"),
value = c(1, 0, 0, 0, 1, 1),
type = c("Test", "Ref", "Test", "Ref", "Test", "Ref")
)
dummy %>%
diagTab(
formula = type ~ value,
bysort = "id",
dimname = c("Test", "Ref"),
levels = c(1, 0)
)
# For Between-Reader precision performance
data("PDL1RP")
reader <- PDL1RP$btw_reader
reader %>%
diagTab(
formula = Reader ~ Value,
bysort = "Sample",
levels = c("Positive", "Negative"),
rep = TRUE,
across = "Site"
)