osat_score {designit} | R Documentation |
Compute OSAT score for sample assignment.
Description
The OSAT score is intended to ensure even distribution of samples across batches and is closely related to the chi-square test contingency table (Yan et al. (2012) doi:10.1186/1471-2164-13-689).
Usage
osat_score(bc, batch_vars, feature_vars, expected_dt = NULL, quiet = FALSE)
Arguments
bc |
BatchContainer with samples
or |
batch_vars |
character vector with batch variable names to take into account for the score computation. |
feature_vars |
character vector with sample variable names to take into account for score computation. |
expected_dt |
A |
quiet |
Do not warn about |
Value
a list with two attributes: $score
(numeric score value), $expected_dt
(expected counts data.table
for reuse)
Examples
sample_assignment <- tibble::tribble(
~ID, ~SampleType, ~Sex, ~plate,
1, "Case", "Female", 1,
2, "Case", "Female", 1,
3, "Case", "Male", 2,
4, "Control", "Female", 2,
5, "Control", "Female", 1,
6, "Control", "Male", 2,
NA, NA, NA, 1,
NA, NA, NA, 2,
)
osat_score(sample_assignment,
batch_vars = "plate",
feature_vars = c("SampleType", "Sex")
)