TimeSurvProb: Predict cumulative survival probabilities for new data at...

View source: R/ext.R

TimeSurvProbR Documentation

Predict cumulative survival probabilities for new data at given time points

Description

Given a readily fitted regularized Cox regression model, this function predicts the cumulative survival probabilities for new data at time points determined by the user. The function uses c060-package's functionality for computing base hazard, and then performs linear predictions for new observations using the fitted regularized Cox regression model.

Usage

TimeSurvProb(
  fit,
  time,
  event,
  olddata,
  newdata,
  s,
  times = c(1:36) * 30.5,
  plot = FALSE
)

Arguments

fit

A single regularized Cox regression model fitted using glmnet

time

Time to events for the training data

event

Event indicators for the training data (0 censored, 1 event)

olddata

The old data matrix used to fit the original 'fit' glmnet-object

newdata

The new data matrix for which to predict time-to-event prediction (should comform to the old data matrix)

s

The optimal lambda parameter as used in the glmnet-package for its fit objects

times

The time points at which to estimate the cumulative survival probabilities (by default in days)

plot

Should the cumulative survival probabilities be plotted as a function of time

Value

Cumulative survival probabilities at the chosen time points

Author(s)

Teemu Daniel Laajala teelaa@utu.fi


Syksy/ePCR documentation built on Feb. 20, 2024, 10:16 p.m.