Learn R Programming

bonsaiforest (version 0.1.1)

generate_stacked_data: Generation of Stacked Data by Subgroups

Description

Function to generate stacked data by the subgroups considered in the model.

Usage

generate_stacked_data(
  base_model,
  subgroup_model,
  data,
  resptype = c("survival", "binary")
)

Value

Data frame of the stacked data.

Arguments

base_model

(formula)
the formula of the basic model that is going to be fitted. Depending on resptype it will be the formula corresponding to a coxph model or to a glm model. In the case of "survival" a formula like Surv(time, status) ~ trt would be expected and in the "binary" case a formula like y ~ trt.

subgroup_model

(formula)
the formula with all the subgroup variables.

data

(data frame)
the data frame with the variables.

resptype

(string)
the type of data used. Can be "survival" or "binary".

Examples

Run this code
generate_stacked_data(Surv(tt_pfs, ev_pfs) ~ arm, ~ x_1 + x_2, example_data, "survival")

Run the code above in your browser using DataLab