Add extra case to absoluteRisk
Closed this issue · 0 comments
The signature of absoluteRisk is this:
absoluteRisk(
object,
time,
newdata,
method = c("numerical", "montecarlo"),
nsamp = 100,
s = c("lambda.1se", "lambda.min"),
n.trees,
onlyMain = TRUE,
type = c("CI", "survival"),
addZero = TRUE,
...
)
Depending on whether time
and newdata
are missing or not, the function behaves differently:
- If both
time
andnewdata
are missing: Compute risk for each person in the original data at their respective failure times (so a single probability for each person). - If only
time
is supplied: Compute the risk at all supplied time points for all individuals in the original data (so every person gets a whole curve). - If both
time
andnewdata
are supplied: For each row innewdata
, compute the risk at all supplied time points (so every supplied covariate profile gets a whole curve).
What is missing is the fourth possibility: what if only newdata
is supplied?
Proposed solution: For each row in newdata
, compute the risk between 0 and max(originalData$timeVar)
at 100 equidistant points.
We also want to provide a fifth alternative: something like newdata = "typical"
, whereby we would compute the risk for only one "typical" covariate profile (median of continuous variables, reference level for factors).
While we're at it, we can also add the class absRiskCB
to the output of absoluteRisk
. This will allow us to create a plot.absRiskCB
method such that we can easily plot the cumulative incidence curves:
plot(absoluteRisk(fit_obj, newdata = "typical"))