generate_stacked_data function

Generation of Stacked Data by Subgroups

Generation of Stacked Data by Subgroups

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

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

Returns

Data frame of the stacked data.

Examples

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