ff_permute: Permuate explanatory variables to produce multiple output...

View source: R/ff_permute.R

ff_permuteR Documentation

Permuate explanatory variables to produce multiple output tables for common regression models

Description

Permuate explanatory variables to produce multiple output tables for common regression models

Usage

ff_permute(
  .data,
  dependent = NULL,
  explanatory_base = NULL,
  explanatory_permute = NULL,
  multiple_tables = FALSE,
  include_base_model = TRUE,
  include_full_model = TRUE,
  base_on_top = TRUE,
  ...
)

finalfit_permute(
  .data,
  dependent = NULL,
  explanatory_base = NULL,
  explanatory_permute = NULL,
  multiple_tables = FALSE,
  include_base_model = TRUE,
  include_full_model = TRUE,
  base_on_top = TRUE,
  ...
)

Arguments

.data

Data frame or tibble.

dependent

Character vector of length 1: quoted name of dependent variable. Can be continuous, a binary factor, or a survival object of form Surv(time, status).

explanatory_base

Character vector of any length: quoted name(s) of base model explanatory variables.

explanatory_permute

Character vector of any length: quoted name(s) of explanatory variables to permute through models.

multiple_tables

Logical. Multiple model tables as a list, or a single table including multiple models.

include_base_model

Logical. Include model using explanatory_base variables only.

include_full_model

Logical. Include model using all explanatory_base and explanatory_permute variables.

base_on_top

Logical. Base variables at top of table, or bottom of table.

...

Other arguments to finalfit

Value

Returns a list of data frame with the final model table.

Examples

explanatory_base = c("age.factor", "sex.factor")
explanatory_permute = c("obstruct.factor", "perfor.factor", "node4.factor")

# Linear regression
colon_s %>%
  finalfit_permute("nodes", explanatory_base, explanatory_permute)

# Cox proportional hazards regression
colon_s %>%
  finalfit_permute("Surv(time, status)", explanatory_base, explanatory_permute)

# Logistic regression
# colon_s %>%
#   finalfit_permute("mort_5yr", explanatory_base, explanatory_permute)

# Logistic regression with random effect (glmer)
# colon_s %>%
#   finalfit_permute("mort_5yr", explanatory_base, explanatory_permute,
#     random_effect = "hospital")

finalfit documentation built on Sept. 11, 2024, 9:01 p.m.