# Create example data
set.seed(456)
n <- 500
df <- data.frame(
age = rnorm(n, 50, 10),
sex = factor(sample(c("M", "F"), n, replace = TRUE)),
treatment = factor(sample(c("A", "B"), n, replace = TRUE)),
outcome1 = rpois(n, lambda = 5),
outcome2 = rpois(n, lambda = 8),
outcome3 = rpois(n, lambda = 3)
)
# Basic usage: Poisson regression for multiple outcomes
regtab(df,
outcomes = c("outcome1", "outcome2", "outcome3"),
predictors = ~ age + sex + treatment,
family = poisson(link = "log"))
# With custom labels and no robust SEs
regtab(df,
outcomes = c("outcome1", "outcome2"),
predictors = "age + sex",
labels = c(outcome1 = "Primary Endpoint", outcome2 = "Secondary Endpoint"),
robust = FALSE)
# Logistic regression with p-values
df$binary_outcome <- rbinom(n, 1, 0.4)
regtab(df,
outcomes = "binary_outcome",
predictors = ~ age + sex,
family = binomial(),
p_values = TRUE)
Run the code above in your browser using DataLab