predict.ICcforest: Predict from an ICcforest model

Description Usage Arguments Value See Also Examples

View source: R/predict.ICcforest.R

Description

Compute predictions from ICcforest objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## S3 method for class 'ICcforest'
predict(
  object,
  newdata = NULL,
  OOB = FALSE,
  suppress = TRUE,
  type = c("response", "prob", "weights", "node"),
  FUN = NULL,
  simplify = TRUE,
  scale = TRUE,
  ...
)

Arguments

object

an object as returned by ICcforest.

newdata

an optional data frame containing test data.

OOB

a logical specifying whether out-of-bag predictions are desired

(only if newdata = NULL).

suppress

a logical specifying whether the messages from getFitEsts are suppressed. If FALSE, the messages are printed. suppress = TRUE is set by default.

type

a character string denoting the type of predicted value returned.

For "type = response", the mean of a numeric response, the median survival time for the interval-censored response is returned. For "type = prob", a list with the survival function constructed using the non-parametric maximum likelihood estimator for each observation is returned. "type = weights" returns an integer vector of prediction weights. For type = "node", a list of terminal node ids for each of the trees in the forest is returned.

FUN

a function to compute summary statistics. Predictions for each node must be computed based on arguments (y, w) where y is the response and w are case weights.

simplify

a logical indicating whether the resulting list of predictions should be converted to a suitable vector or matrix (if possible), see cforest.

scale

a logical indicating scaling of the nearest neighbor weights by the sum of weights in the corresponding terminal node of each tree, see cforest.

...

additional arguments.

Value

An object of class ICcforest, as a subclass of cforest.

See Also

sbrier_IC for evaluation of model fit for interval-censored data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(icenReg)
data(miceData)

## For ICcforest to run, Inf should be set to be a large number, for example, 9999999.
miceData$u[miceData$u == Inf] <- 9999999.

## First, fit an iterval-censored conditional inference forest
Cforest <- ICcforest(formula = Surv(l,u,type="interval2")~grp, data = miceData)
## Predict the survival function constructed using the non-parametric maximum likelihood estimator
Pred <- predict(Cforest, type = "prob")

## Out-of-bag prediction of the median survival time
PredOOB <- predict(Cforest, type = "response", OOB = TRUE)

ICcforest documentation built on Feb. 17, 2020, 9:07 a.m.