Skip to contents

Helper function to summarize outputs from glm fit

Usage

glm_makeup(binobj, legend = "before matching", weighted = FALSE)

Arguments

binobj

returned object from stats::glm

legend

label to indicate the binary fit

weighted

logical flag indicating whether weights have been applied in the glm fit

Value

A data.frame containing a summary of the number of events and subjects in a logistic regression model.

Examples

data(adrs_sat)
pseudo_adrs <- get_pseudo_ipd_binary(
  binary_agd = data.frame(
    ARM = rep("B", 2),
    RESPONSE = c("YES", "NO"),
    COUNT = c(280, 120)
  ),
  format = "stacked"
)
pseudo_adrs$RESPONSE <- as.numeric(pseudo_adrs$RESPONSE)
combined_data <- rbind(adrs_sat[, c("USUBJID", "ARM", "RESPONSE")], pseudo_adrs)
combined_data$ARM <- as.factor(combined_data$ARM)
binobj_dat <- stats::glm(RESPONSE ~ ARM, combined_data, family = binomial("logit"))
glm_makeup(binobj_dat)
#>   treatment            type   n events events_pct
#> A         A before matching 500    390         78
#> B         B before matching 400    280         70