Skip to contents

helper function: sort out a nice report table to summarize binary analysis results

Usage

report_table_binary(
  binobj,
  weighted_result = NULL,
  eff_measure = c("OR", "RD", "RR"),
  tag = NULL
)

Arguments

binobj

object from glm()

weighted_result

weighted result object

eff_measure

a string, binary effect measure, could be "OR", "RR", "RD"

tag

a string, by default NULL, if specified, an extra 1st column is created in the output

Value

a data frame with sample size, incidence rate, estimate of binary effect measure with 95% CI and Wald test of hazard ratio

Examples

data(adrs_sat)
testdat <- data.frame(Yes = 280, No = 120)
rownames(testdat) <- "B"
pseudo_ipd_binary_sat <- get_pseudo_ipd_binary(
  binary_agd = testdat,
  format = "unstacked"
)
combined_data <- rbind(adrs_sat[, c("USUBJID", "RESPONSE", "ARM")], pseudo_ipd_binary_sat)
combined_data$ARM <- as.factor(combined_data$ARM)

binobj_dat <- glm(RESPONSE ~ ARM, combined_data, family = binomial(link = "logit"))
report_table_binary(binobj_dat, eff_measure = "OR")
#> Waiting for profiling to be done...
#>   treatment   N n.events(%)      OR[95% CI] p-Value
#> B         B 400   280(70.0) 0.66[0.49;0.89]   0.006
#> A         A 500   390(78.0)