generate_stacked_data {bonsaiforest}R Documentation

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")
)

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".

Value

Data frame of the stacked data.

Examples

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

[Package bonsaiforest version 0.1.0 Index]