Similar to other predict methods, this function predicts fitted values from a fitted "CoxProportionalHazard" object.

# S3 method for CoxProportionalHazard
predict(
  model,
  data,
  key,
  features = NULL,
  response.type = NULL,
  significance.level = NULL
)

Format

S3 methods

Arguments

model

R6Class object
A "CoxProportionalHazard" object for prediction.

data

DataFrame
DataFrame containting the data.

key

character
Name of the ID column.

features

character of list of characters, optional
Name of feature columns for prediction.
If not provided, it defaults to all non-key columns of data.

response.type

c("risk", "linear"), optional
Specifies the response type of the predicted values.

  • "risk": Response in risk space, i.e. exponential value of linear response.

  • "linear": Linear response.

Defaults to "risk".

significance.level

numeric, optional
Significance level for the confidence interval and prediction interval.
Defaults to 0.05.

Value

Predicted values are returned as a DataFrame, structured as follows.

  • ID: with same name and type as data's ID column.

  • PREDICTION: type DOUBLE, representing predicted values.

  • SE: standard error.

  • CI_LOWER: lower bound of the confidence interval.

  • CI_UPPER: upper bound of the confidence interval.

Examples

DataFrame data2 for prediction:


> data2$Collect()
  ID X1 X2
1  1  0  0
2  2  2  0
3  3  1  0
4  4  1  0
5  5  1  1
6  6  0  1
7  7  0  1

Perform prediction based on a "LogarithmicRegression" Object cph:


> predict(cph, data2, key = "ID", significance.level = 0.05,
          response.type = "risk")

  ID PREDICTION        SE   CI_LOWER  CI_UPPER
1  1  0.3835904 0.4125263 0.04660757  3.157032
2  2  1.8297584 1.3858338 0.41467272  8.073876
3  3  0.8377815 0.4008941 0.32795551  2.140162
4  4  0.8377815 0.4008941 0.32795551  2.140162
5  5  2.1314132 2.0762107 0.31587249 14.382140
6  6  0.9758985 0.5758764 0.30698117  3.102398
7  7  0.9758985 0.5758764 0.30698117  3.102398