The manyregs package provides a concise and yet flexible way to specify, fit, summarize, and plot potentially large numbers of regression models.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | N <- 100L
data <- data.frame(
y1 = factor(as.integer(cut(rnorm(N), 2)) - 1L),
y2 = factor(as.integer(cut(rnorm(N), 2)) - 1L),
x1 = factor(as.integer(cut(rnorm(N), 2)) - 1L),
x2 = factor(as.integer(cut(rnorm(N), 3))),
x3 = rnorm(N),
z1 = factor(as.integer(cut(rnorm(N), 3))),
z2 = rnorm(N))
outcomes <- c("y1", "y2")
exposures <- c("x1", "x2", "x3")
adjustments <- list("z1", c("z1", "z2"))
logistic <- function(model, data) {
with(data, glm(as.formula(model), family = "binomial"))
}
models <- create_models(outcomes, exposures, adjustments, logistic)
fitted_models <- fit_models(models, data)
summarized_models <- summarize_models(fitted_models)
## Not run:
create_pdf("plots.pdf", fitted_models, rows = "exposures", columns = "outcomes")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.