Skip to contents

Runs the poolability likelihood-ratio test (Haas, Rose & Gerba): for each model, fit every dataset separately (unpooled) and the stacked combination (pooled), then compare the deviance difference to a chi-squared distribution. Datasets are poolable when the pooled model does not fit significantly worse than the separate models, i.e. one shared parameter set is adequate.

Usage

poolability_test(
  datasets,
  models = c("exponential", "beta_poisson"),
  alpha = 0.05
)

Arguments

datasets

A named list of dose-response data frames (accepted by as_dose_response()) or already-standardized tibbles. Unnamed elements are named dataset_1, dataset_2, and so on.

models

Character vector of models, a subset of "exponential", "beta_poisson", and "exact_beta_poisson".

alpha

Significance level for the chi-squared test.

Value

A tibble with one row per model: model, n_datasets, deviance_pooled, deviance_unpooled, lrt_statistic, df, chi_square_critical, p_value, poolable, converged, and a human-readable conclusion.

Details

Datasets are combined by stacking their rows (each dataset's dose groups are kept as separate binomial observations); they are not aggregated, so repeated doses across datasets are preserved.

Check that hosts, dose units, and endpoints match before testing. The current pooling functions do not enforce metadata compatibility. poolable = TRUE means the test did not detect a significantly worse pooled fit at alpha; it does not prove equivalence or adequate absolute fit. Inspect converged before interpreting the result.

Examples

path <- system.file("extdata", "pooling-example.csv", package = "singlehit")
raw <- readr::read_csv(path, show_col_types = FALSE)
trials <- split(raw, raw$study_id)
result <- poolability_test(trials[c("A", "B")])
result[c("model", "p_value", "poolable", "converged", "conclusion")]
#> # A tibble: 2 × 5
#>   model        p_value poolable converged conclusion                            
#>   <chr>          <dbl> <lgl>    <lgl>     <chr>                                 
#> 1 exponential    0.940 TRUE     TRUE      The datasets are poolable under the E…
#> 2 beta_poisson   0.925 TRUE     TRUE      The datasets are poolable under the B…
# A and B pass under both models. This test covers only the supplied set.