Skip to contents

Fits each requested model once to the stacked dose groups of several datasets, the pooled fit that poolability_test() compares against separate fits. Rows are stacked, not merged, so a dose shared by two datasets remains two binomial observations.

Usage

fit_pooled_dose_response(datasets, models = c("exponential", "beta_poisson"))

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".

Value

A qdr_model_set with one qdr_fit per model. Each fit's data holds the stacked rows, and the set carries them as its data attribute. Use bootstrap_dose_response_models() to bootstrap the pooled fits; refits resample the stacked rows and do not merge shared doses. Use plot_dose_response() with a fit and its bootstrap to draw bands, because a pooled fit is not a qdr_analysis.

Details

The datasets are not tested for poolability here; run poolability_test() first. Datasets that carry dose_unit metadata must share one unit (see poolability_test()); host and endpoint are not checked. Single-dataset input is allowed and fits that dataset alone.

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)
pooled <- fit_pooled_dose_response(trials[c("A", "B")], models = "exponential")
pooled$exponential
#> <qdr_fit> Exponential dose-response model
#> # A tibble: 1 × 5
#>   term  estimate std.error statistic  p.value
#>   <chr>    <dbl>     <dbl>     <dbl>    <dbl>
#> 1 k        0.101   0.00598      16.8 1.38e-63
#> Deviance: 0.6187 on 7 df
nrow(pooled$exponential$data)
#> [1] 8