Convert scalib object into a flat data.table containing input and output data.

# S3 method for scalib
as.data.table(x, ...)

Arguments

x

An object of class scalib (see scalib).

...

currently not used

Value

a data.table object

Examples



 library(data.table)

 sc <- scalib(pred_risk = pbc_scalib$predrisk,
              pred_horizon = 2500,
              event_time = pbc_scalib$test$time,
              event_status = pbc_scalib$test$status)

 print(sc)
#> 
#> Survival calibration object with prediction horizon of 2500
#> 
#> -- Input data ----------------------------------------------------------------
#> 
#>      event_time event_status prop_hazard rsf_axis gradient_booster rsf_oblique
#>           <int>        <num>       <num>    <num>            <num>       <num>
#>   1:        400            1      0.9990   0.9026           0.9351      0.9463
#>   2:       4500            0      0.4272   0.3072           0.0524      0.3680
#>   3:       1925            1      0.8286   0.4722           0.2342      0.5982
#>   4:       1832            0      0.0358   0.1474           0.0422      0.1460
#>   5:       2466            1      0.0392   0.1925           0.0568      0.1558
#>  ---                                                                          
#> 134:       1300            0      0.1509   0.1783           0.0629      0.1669
#> 135:       1293            0      0.1805   0.3466           0.1299      0.2416
#> 136:       1250            0      0.9823   0.4743           0.3254      0.5727
#> 137:       1230            0      0.0182   0.0589           0.0322      0.0637
#> 138:       1153            0      0.0718   0.1637           0.0527      0.1220

 as.data.table(sc)
#>              ._id_. pred_horizon              inputs
#> 1:      prop_hazard         2500 <data.table[138x3]>
#> 2:         rsf_axis         2500 <data.table[138x3]>
#> 3: gradient_booster         2500 <data.table[138x3]>
#> 4:      rsf_oblique         2500 <data.table[138x3]>

 sc_gnd <- scalib_gnd(sc)

 as.data.table(sc_gnd)
#>              ._id_. pred_horizon              inputs           outputs
#> 1:      prop_hazard         2500 <data.table[138x3]> <data.table[1x5]>
#> 2:         rsf_axis         2500 <data.table[138x3]> <data.table[1x5]>
#> 3: gradient_booster         2500 <data.table[138x3]> <data.table[1x5]>
#> 4:      rsf_oblique         2500 <data.table[138x3]> <data.table[1x5]>