Learn R Programming

Colossus (version 1.2)

Convert_Model_Eq: Converts a string equation to regression model inputs

Description

Convert_Model_Eq Converts a string expression of a risk model into the vectors used by different Colossus regression functions

Usage

Convert_Model_Eq(Model_Eq, df)

Value

returns a list of regression inputs

Arguments

Model_Eq

String representation of a survival model. Left hand side details the model (cox, poisson, cox_strata, poisson_strata), time columns, event, and strata when used. The right hand side details the subterm effects. The 'Unified Equation Representation' vignette provides more details.

df

a data.table containing the columns of interest

See Also

Other Data Cleaning Functions: Check_Dupe_Columns(), Check_Trunc(), Check_Verbose(), Correct_Formula_Order(), Date_Shift(), Def_Control(), Def_Control_Guess(), Def_model_control(), Def_modelform_fix(), Event_Count_Gen(), Event_Time_Gen(), Joint_Multiple_Events(), Replace_Missing(), Time_Since(), factorize(), factorize_par(), gen_time_dep(), interact_them()

Examples

Run this code
library(data.table)
a <- c(0, 1, 2, 3, 4, 5, 6)
b <- c(1, 2, 3, 4, 5, 6, 7)
c <- c(0, 1, 0, 0, 0, 1, 0)
d <- c(1, 2, 3, 4, 5, 6, 7)
e <- c(2, 3, 4, 5, 6, 7, 8)
table <- data.table::data.table(
  "a" = a, "b" = b, "c" = c,
  "d" = d, "e" = e
)
Model_Eq <- "cox(a,b, c) ~ loglinear(d, factor(e), 0) + multiplicative()"
e <- Convert_Model_Eq(Model_Eq, table)

Run the code above in your browser using DataLab