Get a `tof_model`'s training data
Examples
feature_tibble <-
dplyr::tibble(
sample = as.character(1:100),
cd45 = runif(n = 100),
pstat5 = runif(n = 100),
cd34 = runif(n = 100),
outcome = (3 * cd45) + (4 * pstat5) + rnorm(100),
class =
as.factor(
dplyr::if_else(outcome > median(outcome), "class1", "class2")
),
multiclass =
as.factor(
c(rep("class1", 30), rep("class2", 30), rep("class3", 40))
),
event = c(rep(0, times = 30), rep(1, times = 70)),
time_to_event = rnorm(n = 100, mean = 10, sd = 2)
)
split_data <- tof_split_data(feature_tibble, split_method = "simple")
# train a regression model
regression_model <-
tof_train_model(
split_data = split_data,
predictor_cols = c(cd45, pstat5, cd34),
response_col = outcome,
model_type = "linear"
)
tof_get_model_training_data(regression_model)
#> # A tibble: 100 × 9
#> sample cd45 pstat5 cd34 outcome class multiclass event time_to_event
#> <chr> <dbl> <dbl> <dbl> <dbl> <fct> <fct> <dbl> <dbl>
#> 1 43 0.897 0.923 0.539 7.94 class1 class2 1 9.40
#> 2 80 0.240 0.518 0.0689 5.32 class1 class3 1 11.8
#> 3 68 0.966 0.0931 0.388 3.12 class2 class3 1 8.53
#> 4 77 0.221 0.409 0.167 3.81 class1 class3 1 10.4
#> 5 90 0.00685 0.147 0.125 0.216 class2 class3 1 7.29
#> 6 3 0.658 0.0921 0.456 2.91 class2 class1 0 7.66
#> 7 17 0.675 0.613 0.308 4.75 class1 class1 0 9.83
#> 8 38 0.676 0.711 0.588 6.80 class1 class2 1 10.2
#> 9 81 0.307 0.561 0.727 4.04 class1 class3 1 8.87
#> 10 42 0.290 0.641 0.732 4.59 class1 class2 1 11.0
#> # ℹ 90 more rows